|
HP OpenVMS System Services Reference Manual
Note
Do not use the $CRETVA system service in conjunction with other
user-written procedures or procedures supplied by HP (including
Run-Time Library procedures). This system service provides no means to
communicate a change in virtual address space with other routines. HP
recommends that you use either $EXPREG or the Run-Time Library
procedure Allocate Virtual Memory (LIB$GET_VM) to get memory. You can
find documentation on LIB$GET_VM in the HP OpenVMS RTL Library (LIB$) Manual. When using
$DELTVA, you should take care to delete only pages that you have
specifically created.
|
Condition Values Returned
SS$_NORMAL
|
The service completed successfully.
|
SS$_ACCVIO
|
The
inadr argument cannot be read by the caller, or the
retadr argument cannot be written by the caller.
|
SS$_EXQUOTA
|
The process has exceeded its paging file quota.
|
SS$_INSFWSL
|
The process's working set limit is not large enough to accommodate the
increased size of the virtual address space.
|
SS$_NOPRIV
|
A page in the specified range is in the system address space.
|
SS$_NOSHPTS
|
A virtual address within a shared page table region was specified.
|
SS$_PAGOWNVIO
|
A page in the specified range already exists and cannot be deleted
because it is owned by a more privileged access mode than that of the
caller.
|
SS$_VA_IN_USE
|
The existing underlying page cannot be deleted because it is associated
with a buffer object.
|
SS$_VASFULL
|
The process's virtual address space is full; no space is available in
the page tables for the requested pages.
|
$CRETVA_64 (Alpha and Integrity servers)
On Alpha and Integrity server systems, adds a range of demand-zero
allocation pages to a process's virtual address space for the execution
of the current image. The new pages are added at the virtual address
specified by the caller.
This service accepts 64-bit addresses.
Format
SYS$CRETVA_64 region_id_64 ,start_va_64 ,length_64 ,acmode ,flags
,return_va_64 ,return_length_64
C Prototype
int sys$cretva_64 (struct _generic_64 *region_id_64, void *start_va_64,
unsigned __int64 length_64, unsigned int acmode, unsigned int flags,
void *(*(return_va_64)), unsigned __int64 *return_length_64);
Arguments
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 create the virtual address
range. 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. Also, given a particular virtual address, the region ID for
the region it is in can be obtained by calling the $GET_REGION_INFO
system service specifying the VA$_REGSUM_BY_VA function.
start_va_64
OpenVMS usage: |
address |
type: |
quadword address |
access: |
read only |
mechanism: |
by value |
The starting address for the created virtual address range. The
specified virtual address must be a CPU-specific page aligned address.
length_64
OpenVMS usage: |
byte count |
type: |
quadword (unsigned) |
access: |
read only |
mechanism: |
by value |
Length of the virtual address space to be created. The length specified
must be a multiple of CPU-specific pages.
acmode
OpenVMS usage: |
access_mode |
type: |
longword (unsigned) |
access: |
read only |
mechanism: |
by value |
Access mode associated with the call to $CRETVA_64. The access mode
determines the owner mode of the pages as well as the read and write
protection on the pages. 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 $CRETVA_64 service uses whichever of the following access modes is
least privileged:
- Access mode specified by the acmode argument
- Access mode of the caller
The protection of the pages is read/write for the resultant access mode
and those more privileged.
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 controlling the characteristics of the demand-zero pages
created. The flags argument is a longword bit vector
in which each bit corresponds to a flag. The $VADEF macro and the
VADEF.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 the flag that is valid for the $CRETVA_64
service:
Flag |
Description |
VA$M_NO_OVERMAP
|
Pages cannot overmap existing address space. By default, pages can
overmap existing address space.
|
All other bits in the flags argument are reserved for future use by HP
and should be specified as 0. The condition value SS$_IVVAFLG is
returned if any undefined bits are set.
return_va_64
OpenVMS usage: |
address |
type: |
quadword (unsigned) |
access: |
write only |
mechanism: |
by 32- or 64-bit reference |
The lowest process virtual address of the created virtual address
range. 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.
return_length_64
OpenVMS usage: |
byte count |
type: |
quadword (unsigned) |
access: |
write only |
mechanism: |
by 32- or 64-bit reference |
The length of the virtual address range created. 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 in bytes.
Description
The Create Virtual Address Space service is a kernel mode service that
can be called from any mode. The service adds a range of demand-zero
allocation pages, starting at the virtual address specified by the
start_va_64 argument. The pages are added to a
process's virtual address space for the execution of the current image.
Expansion occurs at the next free available address within the
specified region if the range of addresses is beyond the next free
available address.
The new pages, which were previously inaccessible to the process, are
created as demand-zero pages.
The returned address is always the lowest virtual address in the range
of pages created. The returned length is always an unsigned byte count
indicating the length of the range of pages created.
Successful return status from $CRETVA means that the specified address
space was created of the size specified in the
length_64 argument.
If $CRETVA_64 creates pages that already exist, the service deletes
those pages if they are not owned by a more privileged access mode than
that of the caller. Any such deleted pages are reinitialized as
demand-zero pages.
If the condition value SS$_ACCVIO is returned by this service, a value
cannot be returned in the memory locations pointed to by the
return_va_64 and return_length_64
arguments.
If an address within the specified address range is not within the
bounds of the specified region, the condition value SS$_PAGNOTINREG is
returned.
If a condition value other than SS$_ACCVIO is returned, the returned
address and returned length indicate the pages that were successfully
added before the error occurred. If no pages were added, the
return_va_64 argument will contain the value --1, and
a value cannot be returned in the memory location pointed to
by the return_length_64 argument.
Required Privileges
None
Required Quota
The working set quota (WSQUOTA) of the process must be sufficient to
accommodate the increased length of the process page table required by
the increase in virtual address space.
The process's paging file quota (PGFLQUOTA) must be sufficient to
accommodate the increased size of the virtual address space.
Related Services
$CREATE_BUFOBJ_64, $CREATE_REGION_64, $DELETE_REGION_64, $DELTVA_64,
$EXPREG_64, $LCKPAG_64, $LKWSET_64, $PURGE_WS, $SETPRT_64, $ULKPAG_64,
$ULWSET_64
Condition Values Returned
SS$_NORMAL
|
The service completed successfully.
|
SS$_ACCVIO
|
The
return_va_64 or
return_length_64 argument cannot be written by the
caller.
|
SS$_EXPGFLQUOTA
|
The process has exceeded its paging file quota.
|
SS$_INSFWSL
|
The process's working set limit is not large enough to accommodate the
increased virtual address space.
|
SS$_IVACMODE
|
The caller's mode is less privileged than the create mode associated
with the region.
|
SS$_IVREGID
|
An invalid region ID was specified.
|
SS$_IVVAFLG
|
An invalid flag, a reserved flag, or an invalid combination of flags
and arguments was specified.
|
SS$_LEN_NOTPAGMULT
|
The
length_64 argument is not a multiple of CPU-specific
pages.
|
SS$_NOSHPTS
|
The region ID of a shared page table region was specified.
|
SS$_PAGNOTINREG
|
A page in the specified range is not within the specified region.
|
SS$_PAGOWNVIO
|
A page in the specified range already exists and cannot be deleted
because it is owned by a more privileged access mode than that of the
caller.
|
SS$_REGISFULL
|
The specified virtual region is full.
|
SS$_VA_IN_USE
|
A page in the specified range is already mapped, and the
VA$M_NO_OVERLAP flag was set, or the existing underlying page cannot be
deleted because it is associated with a buffer object.
|
SS$_VA_NOTPAGALGN
|
The
start_va_64 argument is not CPU-specific page aligned.
|
$CRMPSC
Allows a process to associate (map) a section of its address space with
either a specified section of a file (a disk file section) or specified
physical addresses represented by page frame numbers (a page frame
section). This service also allows the process to create either type of
section and to specify that the section be available only to the
creating process (private section) or to all processes that map to it
(global section).
Format
SYS$CRMPSC [inadr] ,[retadr] ,[acmode] ,[flags] ,[gsdnam] ,[ident]
,[relpag] ,[chan] ,[pagcnt] ,[vbn] ,[prot] ,[pfc]
C Prototype
int sys$crmpsc (struct _va_range *inadr, struct _va_range *retadr,
unsigned int acmode, unsigned int flags, void *gsdnam, unsigned int
relpag, unsigned short int chan, unsigned int pagcnt, unsigned int vbn,
unsigned int prot,unsigned int pfc);
Arguments
inadr
OpenVMS usage: |
address_range |
type: |
longword (unsigned) |
access: |
read only |
mechanism: |
by reference |
Starting and ending virtual addresses into which the section is to be
mapped. The inadr argument is the address of a
2-longword array containing, in order, the starting and ending process
virtual addresses. Only the virtual page number portion of each virtual
address is used to specify which pages are to be mapped; the low-order
byte-within-page bits are ignored for this purpose.
The interpretation of the inadr argument depends on
the setting of SEC$M_EXPREG in the flags argument and
on whether you are using an Alpha, an Integrity servers or a VAX
system. The two system types are discussed separately in this section.
Alpha and Integrity servers System Usage
On Alpha and Integrity server systems, if you do not set the
SEC$M_EXPREG flag, the inadr argument specifies the
starting and ending virtual addresses of the region to be mapped.
Addresses in system space are not allowed. The addresses must be
aligned on CPU-specific pages; no rounding to CPU-specific pages
occurs. The lower address of the inadr argument must
be on a CPU-specific page boundary and the higher address of the
inadr argument must be 1 less than a CPU-specific
boundary, thus forming a range, from lowest to highest, of address
bytes. You can use the SYI$_PAGE_SIZE item code in the $GETSYI system
service to set the inadr argument to the proper
values. You do this to avoid programming errors that might arise
because of incorrect programming assumptions about page sizes.
If, on the other hand, you do set the SEC$M_EXPREG flag,
indicating that the mapping should take place using the first available
space in a particular region, the inadr argument is
used only to indicate the desired region: the program region (P0) or
the control region (P1).
Caution
Mapping into the P1 region is generally discouraged, but, if done, must
be executed with extreme care. Because the user stack is mapped in P1,
it is possible that references to the user stack might inadvertently
read or write the pages mapped with $CRMPSC.
|
When the SEC$M_EXPREG flag is set, the second inadr
longword is ignored, while bit 30 (the second most significant bit) of
the first inadr longword is used to determine the
region of choice. If the bit is clear, P0 is chosen; if the bit is set,
P1 is chosen. On Alpha and Integrity server systems, bit 31 (the most
significant bit) of the first inadr longword must
be 0. To ensure compatibility between VAX and Alpha or Integrity
server systems when you choose a region, HP recommends that you
specify, for the first inadr longword, any virtual
address in the desired region.
In general, the inadr argument should be specified;
however, it can be omitted to request a special feature: for permanent
global sections, you can omit the inadr argument, or
specify it as 0, to request that the section be created but not mapped.
Such a request will be granted regardless of the setting of the
SEC$M_EXPREG flag; however, to ensure compatibility between VAX and
Alpha or Integrity server systems, HP recommends that the SEC$M_EXPREG
flag be clear when the inadr argument is omitted.
retadr
OpenVMS usage: |
address_range |
type: |
longword (unsigned) |
access: |
write only |
mechanism: |
by reference--array reference |
Starting and ending process virtual addresses into which the section
was actually mapped by $CRMPSC. The retadr argument is
the address of a 2-longword array containing, in order, the starting
and ending process virtual addresses.
On Alpha and Integrity server systems, the retadr
argument returns starting and ending addresses of the usable
range of addresses. This might differ from the total amount mapped. The
retadr argument is required when the
relpag argument is specified. If the section being
mapped does not completely fill the last page used to map the section,
the retadr argument indicates the highest address that
actually maps the section. If the relpag argument is
used to specify an offset into the section, the retadr
argument reflects the offset.
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. The acmode argument is a longword containing
the access mode.
The $PSLDEF macro defines the following symbols for the four access
modes:
Symbol |
Access Mode |
PSL$C_KERNEL
|
Kernel
|
PSL$C_EXEC
|
Executive
|
PSL$C_SUPER
|
Supervisor
|
PSL$C_USER
|
User
|
The most privileged access mode used is the access mode of the caller.
flags
OpenVMS usage: |
mask_longword |
type: |
longword (unsigned) |
access: |
read only |
mechanism: |
by value |
Flag mask specifying the type of section to be created or mapped to, as
well as its characteristics. The flags argument is a
longword bit vector wherein each bit corresponds to a flag. The $SECDEF
macro defines 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 and the default value that it
supersedes:
Flag |
Description |
SEC$M_CRF
|
Pages are copy-on-reference. By default, pages are shared.
|
SEC$M_DZRO
|
Pages are demand-zero pages. By default, they are not zeroed when
copied.
|
SEC$M_EXECUTE
|
Pages are mapped if the caller has execute access. This flag takes
effect only (1) when specified from executive or kernel mode, (2) when
the SEC$M_GBL flag is also specified, and (3) when SEC$M_WRT is not
specified. By default $CRMPSC performs a read access check against the
section.
|
SEC$M_EXPREG
|
Pages are mapped into the first available space. By default, pages are
mapped into the range specified by the
inadr argument.
See the
inadr argument description for a complete explanation
of how to set the SEC$M_EXPREG flag.
|
SEC$M_GBL
|
Pages form a global section. The default is private section.
|
SEC$M_NO_OVERMAP
|
Pages cannot overmap existing address space. Note that, by default,
pages can overmap existing address space.
|
SEC$M_PAGFIL
|
Pages form a global page file section. By default, pages form a disk
file section. SEC$M_PAGFIL also implies SEC$M_WRT and SEC$M_DZRO.
|
SEC$M_PERM
|
Global section is permanent. By default, global sections are temporary.
|
SEC$M_PFNMAP
|
Pages form a page frame section. By default, pages form a disk file
section. Pages mapped by SEC$M_PFNMAP are not included in or charged
against the process's working set; they are always valid. Do not lock
these pages in the working set by using $LKWSET; this can result in a
machine check if they are in I/O space.
++On Alpha and Integrity server systems, when the SEC$M_PFNMAP flag
is set, the
pagcnt and
relpag arguments are interpreted in CPU-specific pages,
not as pagelets.
|
SEC$M_SYSGBL
|
Pages form a system global section. By default, pages form a group
global section.
|
SEC$M_UNCACHED
|
Flag that must be set when a PFN-mapped section is created if this
section is to be treated as uncached memory. Flag is ignored on Alpha
systems; it applies only to Integrity server systems.
|
SEC$M_WRT
|
Pages form a read/write section. By default, pages form a read-only
section.
|
++Alpha and Integrity servers specific
gsdnam
OpenVMS usage: |
section_name |
type: |
character-coded text string |
access: |
read only |
mechanism: |
by descriptor--fixed-length string descriptor |
Name of the global section. The gsdnam argument is the
address of a character string descriptor pointing to this name string.
For group global sections, the operating system interprets the UIC
group as part of the global section name; thus, the names of global
sections are unique to UIC groups.
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 HP OpenVMS Programming Concepts Manual.
ident
OpenVMS usage: |
section_id |
type: |
quadword (unsigned) |
access: |
read only |
mechanism: |
by reference |
Identification value specifying the version number of a global section
and, for processes mapping to an existing global section, the criteria
for matching the identification. The ident argument is
the address of a quadword structure containing three fields.
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.
|