Document revision date: 30 March 2001

## OpenVMS System Services Reference Manual

Previous | Contents | Index

## $CRMPSC_GDZRO_64 (Alpha Only)

> On Alpha systems, allows a process to create a memory-resident global demand-zero section and to map a section of its address space to the global section. Shared page table sections can also be created.

> This service accepts 64-bit addresses.

### Format

> SYS$CRMPSC_GDZRO_64 gs_name_64 ,ident_64 ,prot ,length_64 ,region_id_64 ,section_offset_64 ,acmode ,flags ,return_va_64 ,return_length_64 [[[[,start_va_64] ,map_length_64] ,reserved_length_64] ,rad_mask]

### C Prototype

> int sys$crmpsc_gdzro_64 (void *gs_nam_64, struct _secid *ident_64, unsigned int prot, unsigned __int64 length_64, struct _generic_64 *region_id_64, unsigned __int64 section_offset_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- or 64-bit string descriptor pointing to this name string.

> #### 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 2 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.

> When a section is mapped at creation time, the match control field is ignored. 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.

> #### prot

> OpenVMS usage: | file_protection
> type: | longword (unsigned)
> access: | read only
> mechanism: | by value

> Protection to be applied to the global demand-zero section. The mask contains four 4-bit fields. Bits are read from right to left in each field. The following diagram depicts the mask:

Cleared bits indicate that read, write, execute, and delete access, in that order, are granted to the particular category of user. Only read, write, and execute access are meaningful for section protection. Delete access bits are ignored. Read access also grants execute access for those situations where execute access applies. If zero is specified, read access and write access are granted to all users.

#### length_64

OpenVMS usage: | byte count
type: | quadword (unsigned)
access: | read only
mechanism: | by value

Length, in bytes, of the global demand-zero section to be created. The length_64 must be specified as a multiple of the CPU-specific page size. A length of 0 cannot be specified.

Note Creating a memory-resident global section with shared page table does not imply that the global section must have an even multiple of CPU-specific page table pages. The global section might not fully use the last page table page.

#### 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 page file 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 to start mapping into the process's virtual address space. The offset specified must be a multiple of a CPU-specific page size.

If a shared page table region is specified by the region_id_64 argument, section_offset_64 must be an even multiple of the number of bytes that can be mapped by a CPU-specific page table page.

#### 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 access mode is also the read access mode and the write access mode. The acmode argument is a longword containing the access mode.

If the memory-resident global section is created with shared page tables, this is the access mode that is stored in the owner, read, and write fields of the corresponding shared page table entries (PTEs).

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. The calling process can delete pages only if those pages are owned by an access mode equal to or less privileged than the access mode of the calling process.

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 the type of the global section to be created as well as its characteristics. 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 $CRMPSC_GDZRO_64 service:

Flag | Description
--- | ---
SEC$M_DZRO | Pages are demand-zero pages. By default, this flag is always present in this service and cannot be disabled.
SEC$M_EXPREG | Pages are mapped into the first available space at the current end of the specified region. If the /ALLOCATE qualifier was specified when the global section was registered in the Reserved Memory Registry, virtually aligned addresses after the first available space are chosen for the mapping.
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_PERM | Global section is permanent.
SEC$M_RAD_HINT | When set, the argument rad_mask is used as a mask of RADs from which to allocate memory. See the rad_mask argument description for more information.
SEC$M_READ_ONLY_SHPT | Create shared table pages for the section that allow read access only.
SEC$M_SHMGS | Create a shared-memory global section.
SEC$M_SYSGBL | Pages form a system global section. By default, pages form a group global section.
SEC$M_MRES | Pages form a memory-resident section. By default, this page is always present in this service and cannot be disabled.
SEC$M_WRT | Pages form a read/write section. By default, this flag is always present in this service and cannot be disabled.

All other bits in the flags argument are reserved for future use by Compaq and should be specified as 0. The condition value SS$_IVSECFLG is returned if any undefined bits are set or if an invalid combination of flags is set.

#### return_va_64

OpenVMS usage: | address
type: | quadword address
access: | write only
mechanism: | by 32- or 64-bit reference

The lowest process virtual address into which the global demand-zero 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.

If a shared page table region is specified by the region_id_64 argument and the SEC$M_EXPREG flag is set, the returned virtual address is aligned to a CPU-specific page table page boundary.

#### return_length_64

OpenVMS usage: | byte count
type: | quadword (unsigned)
access: | write only
mechanism: | by 32- or 64-bit reference

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.

#### start_va_64

OpenVMS usage: | address
type: | quadword address
access: | read only
mechanism: | by value

The starting virtual address to map the memory-resident 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 SEC$M_EXPREG is clear, start_va_64 is nonzero, and a shared page table region is specified, the specified starting address must be aligned to a natural page table page boundary; otherwise, the condition value SS$_VA_NOTPAGALGN is returned.

If the /ALLOCATE qualifier was specified when the memory-resident global section was registered in the Reserved Memory Registry and start_va_64 is aligned to a multiple of CPU-specific pages appropriate for taking advantage of granularity hints (8, 64, or 512 pages), then granularity hints are used to map to the global section.

#### map_length_64

OpenVMS usage: | byte count
type: | quadword (unsigned)
access: | read only
mechanism: | by value

Length of the memory-resident global section to be mapped. The length specified must be a multiple of CPU-specific pages. If this argument is not specified or is specified as zero, the global file section is mapped up to and including the last page in that section.

If a shared page table region is specified by the region_id_64 argument, map_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 global section.

#### reserved_length_64

OpenVMS usage: | byte count
type: | quadword (unsigned)
access: | write only
mechanism: | 32- or 64-bit reference

Length, in bytes, of the global section as currently registered in the Reserved Memory Registry. The reserved_length_64 argument is the 32- or 64-bit virtual address of a naturally aligned quadword into which the service returns the reserved length.

If reserved_length_64 is not specified or is specified as 0, no reserved length is returned to the caller.

If the memory-resident global section is not registered, reserved_length_64 is written with the value 0.

#### rad_mask

OpenVMS usage: | mask_quadword
type: | quadword (unsigned)
access: | read only
mechanism: | by value

Use the rad_mask argument to specify from which RADs to allocate memory. Currently only one bit may be set. The specified RAD must contain memory. This argument is only a hint. Memory may be obtained from other RADs if no free memory is available at the time of allocation.

The rad_mask argument is considered only if the SEC$M_RAD_HINT flag is specified. Otherwise, this argument is ignored.

On a system that does not support resource affinity domains (RADs), specifying 1 for the rad_mask argument is allowed.

Note: OpenVMS support for RADs is available only on the new AlphaServer GS series systems. For more information about using RADs, refer to the OpenVMS Alpha Partitioning and Galaxy Guide.

### Description

> The Create and Map to Global Demand-Zero Section service allows a process to create and map to a memory-resident global demand-zero section. If you set the SEC$M_SHMGS flag, the section is created as a Galaxy-wide global demand-zero section in shared memory.

> You must call either the $CREATE_GDZRO service or the $CRMPSC_GDZRO_64 service on each instance where the Galaxy shared memory will be accessed.

> Memory-resident or Galaxy-wide global sections contain demand-zero allocation pages that are writable and memory resident. All pages in these types of global section are shared by all processes that map to the global section.

> If the $CRMPSC_GDZRO_64 service specifies a global section that already exists, the service maps to it only if it is a memory-resident global section. All pages in the memory-resident global section are shared by all processes that map to the global section.

> The global demand-zero pages are always resident in memory and are not backed up by any file on any disk. The global pages are not charged against any page file quota. The process must have the rights identifier VMS$MEM_RESIDENT_USER to create a memory-resident global section; otherwise, the error status SS$_NOMEMRESID is returned.

> The pages are always resident in memory and are not backed up by any file on any disk. The pages are not placed into the process's working set list when the process maps to the global section and the virtual memory is referenced by the process. The pages are also not charged against the process's working set quota or against any page-file quota.

> Only memory-resident sections can be registered with the Reserved Memory Registry in the SYSMAN facility. Memory for Galaxy-wide shared sections is reserved through appropriate settings of the console environment parameters.

> If the memory-resident global section is either not registered in the Reserved Memory Registry or if the /NOALLOCATE qualifier was specified when the global section was registered in the Reserved Memory Registry, invalid global PTEs are written to the global page table and invalid PTEs are placed in the process page table. Physical memory is not allocated until the virtual memory is referenced.

> If the global section is registered in the Reserved Memory Registry, the size of the global section need not match the reserved size. If the global section is not registered in the Reserved Memory Registry or if the reserved size is smaller than the size of the global section, the error status SS$_INSFLPGS is returned if there are not enough fluid pages in the system to satisfy the request.

> If the /ALLOCATE qualifier was specified when the global section was registered in the Reserved Memory Registry, contiguous, aligned physical pages are preallocated during system initialization for this global section. Valid page table entries are placed in the global page table and in the process page table. If the reserved preallocated memory is smaller than the size of the global section, the error SS$_MRES_PFNSMALL is returned and the global section is not created.

> If the memory-resident global section is not registered in the Reserved Memory Registry or if the /PAGE_TABLES qualifier was specified when the global section was registered in the Reserved Memory Registry, shared page tables are created for the global section.

> For more information about using the SYSMAN utility to create entries to the Reserved Memory Registry, refer to the OpenVMS System Management Utilities Reference Manual.

> Shared page tables consume the same internal OpenVMS data structures as a global section. The system parameters GBLPAGES and GBLSECTIONS must account for the additional global pages and the additional 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 $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.
> - 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 value for the section_offset_64 argument that is an even multiple of bytes mapped by a CPU-specific page table page 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 zero, or include the last page of the section.

> See the description of the $CREATE_REGION_64 service for information about calculating virtual addresses that are aligned to a CPU-specific page table page boundary.

> The 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 with 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 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 if 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 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, 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 /ALLOCATE 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 (either 8-page, 64-page, or 512-page alignment).

> 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.

> When you map a Galaxy shared section or a memory resident section that has an associated shared page table section, you have the following options for accessing data:

> Table SYS-7 Shared Page Tables
> Shared Page Tables | Read Only | Read and Write
> --- | --- | ---
> None created | Do not set the SEC$M_WRT flag in the map request. Private page tables will always be used, even if you are specifying a shared page table region into which to map the section. | Set the SEC$M_WRT flag in the map request. Private page tables will always be used, even if you are specifying a shared page table region into which to map the section.
> Write access | Do not set the SEC$M_WRT flag in the map request. Ensure that private page tables will be used. Do not specify a shared page table region into which to map the section. If you do, the error status SS$_IVSECFLG is returned. | Set the SEC$M_WRT flag in the map request. The shared page table section will be used for mapping if you specify a shared page table region into which to map the section.
> Read access | Do not set the SEC$M_WRT flag in the map request. The shared page table section will be used for mapping if you specify a shared page table region into which to map the section. | Set the SEC$M_WRT flag in the map request. Ensure that private page tables will be used. Do not specify a shared page table region into which to map the section. If you do, the error status SS$_IVSECFLG is returned.

> Notes Shared page tables for Galaxy shared sections are also implemented as Galaxy shared sections. This implies that they allow either read access only on all OpenVMS instances connected to this section or read and write access on all instances. The setting of the SEC$M_READ_ONLY_SHPT flag as requested by the first instance to create the section is used on all instances.
> Previous | Next | Contents | Index
> | privacy and legal statement |
> 4527PRO_023.HTML