HP OpenVMS System Services Reference Manual
The first longword specifies, in the low-order two bits, the matching
criteria. Their valid values, the symbolic names by which they can be
specified, and their meanings are as follows:
Value/Name |
Match Criteria |
0 SEC$K_MATALL
|
Match all versions of the section.
|
1 SEC$K_MATEQU
|
Match only if major and minor identifications match.
|
2 SEC$K_MATLEQ
|
Match if the major identifications are equal and the minor
identification of the mapper is less than or equal to the minor
identification of the global section.
|
The version number is in the second longword and contains two fields: a
minor identification in the low-order 24 bits and a major
identification in the high-order 8 bits.
If you do not specify ident or specify it as the value
0 (the default), the version number and match control fields default to
the value 0.
relpag
OpenVMS usage: |
longword_unsigned |
type: |
longword (unsigned) |
access: |
read only |
mechanism: |
by value |
Relative page number within the section of the first page to be mapped.
The relpag argument is a longword containing this
number.
On Alpha and I64 systems, the relpag argument is
interpreted as an index into the section file, measured in pagelets for
a file-backed section or CPU-specific pages for a PFN-mapped section.
On Alpha, I64, and VAX systems, if you do not specify
relpag or specify it as the value 0 (the default), the
global section is mapped beginning with the first virtual block in a
file-backed section or the first CPU-specific page in a PFN-mapped
section.
Description
The Map Global Section service establishes a correspondence between
pages (maps) in the virtual address space of the process and physical
pages occupied by a global section. The protection mask specified at
the time the global section is created determines the type of access
(for example, read/write or read only) that a particular process has to
the section.
When $MGBLSC maps a global section, it adds pages to the virtual
address space of the process. The section is mapped from a low address
to a high address, whether the section is mapped in the program or
control region.
If an error occurs during the mapping of a global section, the return
address array, if specified, indicates the pages that were successfully
mapped when the error occurred. If no pages were mapped, both longwords
of the return address array contain the value --1.
Required Access or Privileges
Read access is required. If the SEC$M_WRT flag is specified, write
access is required.
Required Quota
The working set quota (WSQUOTA) of the process must be sufficient to
accommodate the increased size of the virtual address space when the
$MGBLSC service maps a section.
If the section pages are copy-on-reference, the process must also have
sufficient paging file quota (PGFLQUOTA).
This system service causes the working set of the calling process to be
adjusted to the size specified by the working set quota (WSQUOTA). If
the working set size of the process is less than quota, the working set
size is increased; if the working set size of the process is greater
than quota, the working set size is decreased.
Related Services
$ADJSTK, $ADJWSL, $CRETVA, $CRMPSC, $DELTVA, $DGBLSC, $EXPREG, $LCKPAG,
$LKWSET, $PURGWS, $SETPRT, $SETSTK, $SETSWM, $ULKPAG, $ULWSET, $UPDSEC,
$UPDSECW
For more information, refer to the chapter on memory management in the
OpenVMS Programming Concepts Manual.
Condition Values Returned
SS$_NORMAL
|
The service completed successfully.
|
SS$_ACCVIO
|
The input address array, the global section name or name descriptor, or
the section identification field cannot be read by the caller; or the
return address array cannot be written by the caller.
|
SS$_ENDOFFILE
|
The starting virtual block number specified is beyond the logical
end-of-file.
|
SS$_EXQUOTA
|
The process exceeded its paging file quota, creating copy-on-reference
pages.
|
SS$_INSFWSL
|
The working set limit of the process is not large enough to accommodate
the increased virtual address space.
|
SS$_INVARG
|
Invalid argument specified to service. Common sources are the incorrect
specification of
relpag or the values in the
inadr array.
|
SS$_IVLOGNAM
|
The global section name has a length of 0 or has more than 43
characters.
|
SS$_IVSECFLG
|
You set a reserved flag.
|
SS$_IVSECIDCTL
|
The match control field of the global section identification is invalid.
|
SS$_NOPRIV
|
The file protection mask specified when the global section was created
prohibits the type of access requested by the caller; or a page in the
input address range is in the system address space.
|
SS$_NOSHPTS
|
The region ID of a shared page-table region was specified.
|
SS$_NOSUCHSEC
|
The specified global section does not exist.
|
SS$_PAGOWNVIO
|
A page in the specified input address range is owned by a more
privileged access mode.
|
SS$_SECREFOVF
|
The maximum number of references for a global section has been reached
(2,147,483,647).
|
SS$_TOOMANYLNAM
|
Logical name translation of the
gsdnam string exceeded the allowed depth.
|
SS$_VA_IN_USE
|
The existing underlying page cannot be deleted because it is associated
with a buffer object.
|
SS$_VASFULL
|
The virtual address space of the process is full; no space is available
in the page tables for the pages created to contain the mapped global
section.
|
$MGBLSC_64 (Alpha and I64)
On Alpha and I64 systems, establishes a correspondence between pages in
the virtual address space of the process and the pages occupied by a
global disk file, page file, or demand-zero section and can map to a
demand-zero section with shared page tables.
This service accepts 64-bit addresses.
Format
SYS$MGBLSC_64 gs_name_64 ,ident_64 ,region_id_64 ,section_offset_64
,length_64 ,acmode ,flags ,return_va_64 ,return_length_64
[,start_va_64]
C Prototype
int sys$mgblsc_64 (void *gsdnam_64, struct _secid *ident_64, struct
_generic_64 *region_id_64, unsigned __int64 section_offset_64, unsigned
__int64 length_64, unsigned int acmode, unsigned int flags, void
*(*(return_va_64)), unsigned __int64 *return_length_64,...);
Arguments
gs_name_64
OpenVMS usage: |
section_name |
type: |
character-coded text string |
access: |
read only |
mechanism: |
by 32- or 64-bit descriptor--fixed-length string
descriptor |
Name of the global section. The gs_name_64 argument is
the 32- or 64-bit virtual address of a naturally aligned 32-bit or
64-bit string descriptor pointing to this name string.
You can specify any name from 1 to 43 characters. All processes mapping
to the same global section must specify the same name. Note that the
name is case sensitive.
Use of characters valid in logical names is strongly encouraged. Valid
values include alphanumeric characters, the dollar sign ($), and the
underscore (_). If the name string begins with an underscore (_), the
underscore is stripped and the resultant string is considered to be the
actual name. Use of the colon (:) is not permitted.
Names are first subject to a logical name translation, after the
application of the prefix GBL$ to the name. If the result translates,
it is used as the name of the section. If the resulting name does not
translate, the name specified by the caller is used as the name of the
section.
Additional information on logical name translations and on section name
processing is available in the OpenVMS Programming Concepts Manual.
ident_64
OpenVMS usage: |
section_id |
type: |
quadword (unsigned) |
access: |
read only |
mechanism: |
by 32- or 64-bit reference |
Identification value specifying the version number of a global section.
The ident_64 argument is a quadword containing three
fields. The ident_64 argument is the 32- or 64-bit
virtual address of a naturally aligned quadword that contains the
identification value.
The first longword specifies the matching criteria in its low-order two
bits.
The valid values, symbolic names by which they can be specified, and
their meanings are as follows:
Value |
Symbolic Name |
Match Criteria |
0
|
SEC$K_MATALL
|
Match all versions of the section.
|
1
|
SEC$K_MATEQU
|
Match only if major and minor identifications match.
|
2
|
SEC$K_MATLEQ
|
Match if the major identifications are equal and the minor
identification of the mapper is less than or equal to the minor
identification of the global section.
|
If you specify the ident_64 argument as 0, the version
number and match control fields default to 0.
The version number is in the second longword. The version number
contains two fields: a minor identification in the low-order 24 bits
and a major identification in the high-order 8 bits. You can assign
values for these fields by installation convention to differentiate
versions of global sections. If no version number is specified when a
section is created, processes that specify a version number when
mapping cannot access the global section.
region_id_64
OpenVMS usage: |
region identifier |
type: |
quadword (unsigned) |
access: |
read only |
mechanism: |
by 32- or 64-bit reference |
The region ID associated with the region to map the global section. The
file VADEF.H in SYS$STARLET_C.TLB and the $VADEF macro in STARLET.MLB
define a symbolic name for each of the three default regions in P0, P1,
and P2 space.
The following region IDs are defined:
Symbol |
Region |
VA$C_P0
|
Program region
|
VA$C_P1
|
Control region
|
VA$C_P2
|
64-bit program region
|
Other region IDs, as returned by the $CREATE_REGION_64 service, can be
specified.
section_offset_64
OpenVMS usage: |
byte offset |
type: |
quadword (unsigned) |
access: |
read only |
mechanism: |
by value |
Offset into the global section at which to start mapping into the
process's virtual address space.
If a map to a global disk file section is being requested, the
section_offset_64 argument specifies an even multiple
of disk blocks. If a map to a global page file or demand-zero section
is being requested, the section_offset_64 argument
specifies an even multiple of CPU-specific pages. If zero is specified,
the global section is mapped beginning with the first page of the
section.
If the region_id_64 argument specifies a shared page
table region, section_offset_64 must be an even
multiple of pages mapped by a page table page.
length_64
OpenVMS usage: |
byte count |
type: |
quadword (unsigned) |
access: |
read only |
mechanism: |
by value |
Length, in bytes, of the desired mapping of the global disk file
section.
If a map to a global section is being requested, the
length_64 argument must specify an even multiple of
disk blocks. If a map to a global page file or demand-zero section is
being requested, the length_64 argument must specify
an even multiple of CPU-specific pages. If zero is specified, the size
of the disk file is used.
If a shared page-table region is specified by the
region_id_64 argument, length_64 must
be an even multiple of the number of bytes that can be mapped by a
CPU-specific page-table page or must include the last page within the
memory-resident global section.
acmode
OpenVMS usage: |
access_mode |
type: |
longword (unsigned) |
access: |
read only |
mechanism: |
by value |
Access mode that is to be the owner of the pages created during the
mapping. This is also the read access mode and, if the SEC$M_WRT flag
is specified, the write access mode. The acmode
argument is a longword containing the access mode.
The $PSLDEF macro in STARLET.MLB and the file PSLDEF.H in
SYS$STARLET_C.TLB define the following symbols and their values for the
four access modes:
Value |
Symbolic Name |
Access Mode |
0
|
PSL$C_KERNEL
|
Kernel
|
1
|
PSL$C_EXEC
|
Executive
|
2
|
PSL$C_SUPER
|
Supervisor
|
3
|
PSL$C_USER
|
User
|
The most privileged access mode used is the access mode of the caller.
Address space cannot be created within a region that has a create mode
associated with it that is more privileged than the caller's mode. The
condition value SS$_IVACMODE is returned if the caller is less
privileged than the create mode for the region.
flags
OpenVMS usage: |
mask_longword |
type: |
longword (unsigned) |
access: |
read only |
mechanism: |
by value |
Flag mask specifying options for the operation. The
flags argument is a longword bit vector in which each
bit corresponds to a flag. The $SECDEF macro and the SECDEF.H file
define a symbolic name for each flag. You construct the
flags argument by performing a logical OR operation on
the symbol names for all desired flags.
The following table describes each flag that is valid for the
$MGBLSC_64 service:
Flag |
Description |
SEC$M_EXPREG
|
Pages are mapped into the first available space at the current end of
the specified region.
If /ALLOCATE was specified when the memory-resident global section
was registered in the Reserved Memory Registry, virtually aligned
addresses after the first available space are chosen for the mapping.
It the
region_id_64 argument specifies a shared page-table
region, the first available space is round up to the beginning of the
next CPU-specific page-table page.
|
SEC$M_GBL
|
Pages form a global section. By default, this flag is always present in
this service and cannot be disabled.
|
SEC$M_NO_OVERMAP
|
Pages cannot overmap existing address space.
|
SEC$M_SHMGS
|
On OpenVMS Galaxy systems, create a shared-memory global section.
|
SEC$M_SYSGBL
|
The global section map is a system global section. By default, the
section is a group global section.
|
SEC$M_WRT
|
Map the section with read/write access.
|
All other bits in the flags argument are reserved for future use by HP
and should be specified as 0. The condition value SS$_IVSECFLG is
returned if any undefined bits are set or if an attempt is made to use
the SEC$M_PAGFIL flag, which applies only to the creation of a
page-file backed section.
return_va_64
OpenVMS usage: |
address |
type: |
quadword address |
access: |
write only |
mechanism: |
by 32- or 64-bit reference |
The process virtual address into which the global disk or page file
section was mapped. The return_va_64 argument is the
32- or 64-bit virtual address of a naturally aligned quadword into
which the service returns the virtual address.
Upon successful completion of this service, if the
section_offset_64 argument was specified, the virtual
address returned in the return_va_64 argument reflects
the offset into the global section mapped such that the virtual address
returned cannot be aligned on a CPU-specific page boundary. The virtual
address returned will always be on an even virtual disk block boundary.
return_length_64
OpenVMS usage: |
byte count |
type: |
quadword (unsigned) |
access: |
write only |
mechanism: |
by 32- or 64-bit reference |
The length of the usable virtual address range mapped. The
return_length_64 argument is the 32- or 64-bit virtual
address of a naturally aligned quadword into which the service returns
the length of the virtual address range mapped in bytes.
Upon successful completion of this service, the value in the
return_length_64 argument might differ from the total
amount of virtual address space mapped. The value in the
return_va_64 argument plus the value in the
return_length_64 argument indicates the address of the
first byte beyond the end of the mapping of the global disk file
section.
If the value in the section_offset_64 argument plus
the value in the length_64 argument did not specify to
map the entire global section, this byte can be located at an even
virtual disk block boundary within the last page of the mapping.
If the section being mapped does not completely fill the last page used
to represent the global disk file section, this byte can be mapped into
your address space; however, it is not backed up by the disk file.
start_va_64
OpenVMS usage: |
address |
type: |
quadword address |
access: |
read only |
mechanism: |
by value |
The starting virtual address to which to map the global section. The
specified virtual address must be a CPU-specific page-aligned address.
If the flag SEC$M_EXPREG is specified, the start_va_64
argument must not be specified or must be specified as 0. If
SEC$M_EXPREG is set and the start_va_64 argument is
nonzero, the condition value SS$_IVSECFLG is returned.
If the region_id_64 argument specifies a shared
page-table region, start_va_64 must be aligned to a
CPU-specific page-table page boundary.
Description
The Map to Global Section service establishes a correspondence between
pages in the virtual address space of the process and pages occupied by
a global disk file, page file, or memory-resident demand-zero section.
This service adds pages to the virtual address space of the process.
If a global disk file or page file backed section is being mapped,
invalid page table entries are placed in the process page table.
If a memory-resident global section is being mapped, global pages are
not charged against the process's working set quota when the virtual
memory is referenced and the global pages are not charged against the
process's pagefile quota.
If the memory-resident global section was not registered in the
Reserved Memory Registry or /NOALLOCATE was specified when the global
section was registered, invalid page table entries are placed in the
process page table.
If the memory-resident global section was registered in the Reserved
Memory Registry and /ALLOCATE was specified when the memory-resident
global section was registered, valid page table entries are placed in
the process page tables.
If a global disk file or page file backed section is being mapped, and
the flag SEC$M_EXPREG is set, the first free virtual address within the
specified region is used to start mapping to the global section.
To use the shared page tables associated with a memory-resident global
section, you must first create a shared page table region (with
SYS$CREATE_REGION_64). To map to the memory-resident global section
using the shared page tables you must do the following:
- Specify a shared page table region in the
region_id_64 argument.
- Specify SEC$M_WRT in the flags argument.
- Set the flag SEC$M_EXPREG or provide a CPU-specific page-table
page-aligned virtual address in the start_va_64
argument.
- Specify a CPU-specific page-table page-aligned value for the
section_offset_64 argument or zero.
- Specify a value for the map_length_64 argument
that is an even multiple of bytes mapped by a CPU-specific page-table
page, or include the last page of the section or zero.
See the description of $CREATE_REGION_64 for information about
calculating virtual addresses that are aligned to a CPU-specific page
table page boundary.
A memory-resident global section can be mapped with shared page tables
or private page tables. The following table lists the factors
associated with determining whether the mapping occurs with shared page
tables or private page tables:
Global Section Created with Shared Page Tables |
Shared Page-Table Region Specified by region_id_64 |
Type of Page Tables Used in Mapping |
No
|
No
|
Private
|
No
|
Yes
|
Private
|
Yes
|
No
|
Private
|
Yes
|
Yes
|
Shared
|
In general, if the flag SEC$M_EXPREG is set, the first free virtual
address within the specified region is used to map to the global
section.
If the flag SEC$M_EXPREG is set, a memory-resident global section is
being mapped and the region_id_64 argument indicates a
shared page-table region, the first free virtual address within the
specified region is rounded up to a CPU-specific page-table page
boundary and used to map to the global section.
If the flag SEC$M_EXPREG is set and the /ALLOCATE qualifier was
specified with the SYSMAN command RESERVED_MEMORY ADD for the
memory-resident global section, the first free virtual address within
the specified region is rounded up to the same virtual alignment as the
physical alignment of the preallocated pages and used to map to the
global section. Granularity hints are set appropriately for each
process private page-table entry (PTE).
In general, if the flag SEC$M_EXPREG is clear, the virtual address in
the start_va_64 argument is used to map to the global
section.
If the flag SEC$M_EXPREG is clear and a memory-resident global section
is being mapped, the value specified in the
start_va_64 argument can determine if the mapping is
possible and if granularity hints are used in the private page tables.
If a shared page-table region is specified by the
region_id_64 argument, the virtual address specified
by the start_va_64 argument must be on an even
CPU-specific page-table page boundary or an error is returned by this
service. If the region_id_64 argument does not specify
a shared page-table region and the /ALLOCATE qualifier was specified
with the SYSMAN command RESERVED_MEMORY ADD for this global section,
granularity hints are used only if the virtual alignment of
start_va_64 is appropriate for the use of granularity
hints:
- On Alpha systems, granularity hints mean multiples of pages,
regardless of page size. The multiples 8, 64, and 512 pages are
architected.
- On I64 systems, OpenVMS initially supports page sizes of 64KB,
256KB, and 4MB instead of granularity hints. Additional pages sizes
will be supported in the future.
Whenever granularity hints are being used within the mapping of a
memory-resident global section, if the length_64
argument is not an exact multiple of the alignment factor, lower
granularity hints factors are used as appropriate at the higher
addressed portion of the global section. If the
section_offset_64 argument is specified, a lower
granularity hint factor can be used throughout the mapping of the
global section to match the physical alignment of the first page mapped.
|