Common Characteristics of Memory Management System Services


This appendix describes several types of memory management system services. The original system services accept only 32-bit address arguments and have been supplemented with 64-bit services that take 64-bit address arguments. The latter have names ending in _64 to indicate that they accept 64-bit addresses by reference. For example, $CRETVA is the original system service requested to create virtual address space. It continues to be used, but to create P2 space, an application must request $CRETVA_64. This appendix uses the term 32-bit services to refer to the original services and the term 64-bit services for the services whose names end in _64 or services that can affect P2 space.

When 64-bit support was provided for $CRMPSC, that complex system service was split into a number of new services. $CRMPSC both creates and maps various types of process and global sections. The new services deal with either process or global sections, but not both. Generally, three new services are provided for each type of section: one to create the section if it does not already exist and then to map it, one simply to create the section, and one simply to map an existing section. The names of many of the new services end in _64, for example, $CRMPSC_PFN_64, but those without address arguments do not, for example, $CREATE_GPFN.

A process's ability to use the services described in this appendix may be limited by access mode, process quotas, limits, privileges, and SYSGEN parameters.

The level 3 page table entry (L3PTE) associated with each page of virtual address space contains an owner field (see Figure 2.12) that specifies which access mode owns the page. The memory management system service checks the owner field to determine whether the service's requestor has an access mode at least as privileged as the owner mode of the page and thus is able to manipulate the page in the desired fashion.

In general, a process is only permitted to affect P0, P1, and P2 address space, not system space, with these services. The only exception is when a process uses the buffer object services to double-map process-private address space into system space.

Almost all the memory management system services accept a desired virtual address range as one or more input arguments. Many of the services can partly succeed, that is, affect only a portion of the specified address range. A system service indicates partial success by returning an error status and the address range for which the operation completed.

Common Characteristics of the 32-Bit System Services

Many of the 32-bit memory management system services have similar structures and sequences and similar arguments. The input range for a 32-bit service is specified by the address of a two-longword array, the INADR argument. The first longword is the starting address, and the second, the address of the last byte to be created. The RETADR argument is the address of a two-longword array that receives the addresses of the starting and ending bytes actually created. The ACMODE argument specifies the owner of the address space, the least privileged mode that can access it.

Each 32-bit system service first executes code generated by a MACRO-32 macro that tests whether enough arguments have been supplied and, if not, returns the error status SS$_INSFARG to the requestor.

Each service validates its arguments. A typical service makes the following checks:

  • It tests the accessibility of the INADR and RETADR arguments.

  • It maximizes the ACMODE argument with the mode of the service requestor.

  • It tests the starting and ending addresses and, if either is a system space address, returns the error status SS$_NOPRIV.

The service then explicitly creates scratch space on the stack to record information about the service request.

The macro $MMGDEF defines symbolic offsets into this scratch space, which is pointed to by the frame pointer (FP) register while the system service procedure is executing. Figure D-1 shows the layout of the scratch space on the stack. Some fields are used by only a few system services; others are common to all.

click to expand
Figure D-1: Layout of Scratch Space on the Stack

MMG$L_MMG_FLAGS contains flag bits associated with the operation. Some of the 64-bit services use these same flags, passing them to inner mode routines as an argument.

  • Bit MMG$V_CHGPAGFIL in this longword, when set, means page file quota should be charged for the operation.

  • Bit MMG$V_NOWAIT_IPL0, when set, means that a memory management routine should return with an error status rather than waiting at interrupt priority level (IPL) 0 for I/O completion.

  • Bit MMG$V_NO_OVERMAP, when set, means that address space to be created may not overlap existing address space.

  • Bit MMG$V_PARTIAL_FIRST, when set, means that the first page to be mapped is only partially backed by section file.

  • Bit MMG$V_PARTIAL_LAST, when set, means that the last page to be mapped is only partially backed by section file.

  • Bit MMG$V_NO_IRP_DELETE, when set, means that an I/O request packet created by the $UPDSEC system service is currently in use and should not be deallocated to nonpaged pool.

  • Bit MMG$V_DELPAG_NOP, when set, means that not all pages in the specified region could be deleted.

  • Bit MMG$V_CLUSTER_DEL, when set, means that the per-page deletion routine can delete a whole cluster of pages at once.

  • Bit MMG$V_WINDOW, when set, means that the page is part of a memoryresident global section or a section mapped by page frame number (PFN).

  • Bit MMG$V_SHARED_L3PTS, when set, means that the page is part of a memoryresident global section that is mapped with shared page tables.

  • Bit MMG$V_RWAST_AT_IPL0, when set, means that the per-page deletion routine (see Section 3.10.2) should wait the kernel thread at IPL 0 rather than IPL 2. The bit is set by the $DELTVA and $DELTVA_64 system services. The IPL 0 wait enables Extended QIO Processor (XQP) kernel mode asynchronous system traps (ASTs) to be delivered, preventing a deadlock in certain circumstances. MMG$L_ACCESS_MODE contains the access mode associated with the operation, the maximized ACMODE argument.

MMG$L_PER_PAGE is the per-page processing context area. It contains one defined flag, MMG$V_DELGBLDON. When set, the bit means that global pages in the range have already been deleted.

MMG$L_CALLEDIPL records the IPL from which the service was requested, typically 0.

MMG$L_SAVRETADR contains the value of the optional service RETADR argument.

MMG$L_PAGESUBR contains the procedure value of the executive routine that performs the requested service on a single page.

MMG$L_SVSTARTVA saves the starting virtual address specified by the service requestor.

MMG$L_VFYFLAGS contains the section flags passed as an argument to a service such as $CRMPSC and verified by the service.

MMG$L_PAGCNT and MMG$L_EFBLK are two names for the same field. MMG$L_PAGCNT, used by services related to buffer objects, contains the number of pages in a buffer object being created or deleted. MMG$L_EFBLK contains the number of the end-of-file block for a section file.

MMG$L_PGFLCNT contains the number of pages of page file quota that have been reserved against the job's quota for this request.

After creating and initializing the scratch space on the stack, a 32-bit memory management system service takes the following steps:

  1. It performs argument validation.

  2. It raises IPL to 2 to block the delivery of an AST. In addition to blocking process deletion, this prevents the execution of AST code that could cause unexpected changes to the page tables, working set list, region descriptor entries (RDEs), and other data structures.

  3. If appropriate, it checks page ownership to ensure that a less privileged access mode is not attempting to alter the properties of pages owned by a more privileged access mode.

  4. It calls the routine MMG$CREDEL, in module SYSCREDEL, passing it the procedure value of a per-page service-specific routine to accomplish the desired action of the system service. MMG$CREDEL performs general page processing and calls the per-page routine for each page in the desired range.

  5. It reprobes write accessibility of any output arguments.

  6. It returns the address range actually affected by MMG$CREDEL's actions in the optional RETADR argument.

  7. It restores the entry IPL and returns to its requestor.

In some cases, step 4 in that sequence is replaced by calling a routine that affects all pages in the desired range.

MMG$CREDEL takes the following steps:

  1. It tests the starting and ending addresses of the range and, if either is in system space, returns the error status SS$_NOPRIV.

  2. It initializes MMG$L_PAGESUBR and MMG$L_SVSTARTVA in the scratch space and loads registers with information such as process control block (PCB) address, process header (PHD) address, page count, starting virtual address, and ending virtual address.

  3. MMG$CREDEL calls the per-page routine. Unless the routine returns an error status, MMG$CREDEL continues to call it, once per page.

  4. If the per-page routine returns the status SS$_REGISFULL, MMG$CREDEL converts it to SS$_VASFULL.

  5. When an error occurs or there are no more pages, MMG$CREDEL returns to its caller with a status code and the address of the last affected page.

Common Characteristics of the 64-Bit System Services

The 64-bit system services have a common structure and sequence and similar arguments. They do not explicitly use scratch space on the stack.

A 64-bit service typically takes the following steps:

  1. It performs argument validation, for example:

    • These services are written in C and must explicitly test whether too few or too many arguments have been supplied. Each checks the number of arguments and, if incorrect, returns either the error status SS$_INSFARG or SS$_TOO_MANY_ARGS.

    • It checks that output arguments are accessible and, if not, returns the error status SS$_ACCVIO.

    • If the service has a FLAGS argument, it checks that only valid flags were set in the argument and, if not, returns the error status SS$_IVSECFLG.

    • It maximizes the ACMODE argument.

  2. It raises IPL to 2 to block AST delivery.

  3. If appropriate, it checks page ownership.

  4. It loops, calling a per-page service-specific routine, typically the same routine as its 32-bit counterpart.

  5. It reprobes write accessibility of any output arguments.

  6. It returns the address range actually affected in the RETURN_VA_64 and RETURN_LENGTH_64 arguments.

  7. It restores the entry IPL and returns to its requestor.




Getting Started with OpenVMS System Management
Getting Started with OpenVMS System Management (HP Technologies)
ISBN: 1555582818
EAN: 2147483647
Year: 2004
Pages: 130
Authors: David Miller

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net