Virtual Address Region Creation


The Create Virtual Region ($CREATE_REGION_64) system service is requested to create a region within process-private address space.

Service arguments include the desired length, protection, and flags that specify whether the region is in P0, P1, or P2 space; whether its allocation is to be ascending or descending; whether address space within it should be created automatically in response to an access violation; whether it should be permanent; and whether its space is capable of being mapped with shared page tables. Only memory-resident global sections and Galaxywide global sections are mapped into such a region.

The service creates a region with the requested characteristics, assigns an ID to it, and returns its ID and address.

The $CREATE_REGION_64 system service procedure, EXE$CREATE_REGION_64 in module SYS_REGIONS, runs in kernel mode. EXE$CREATE_REGION_64 takes the following steps:

  1. It calculates the number of PTEs in a page table page and the number of bytes mapped by an L3PT.

  2. In addition to making the checks described in Section 3.1.2, it validates its arguments as follows:

    1. It checks that REGION_PROT is valid, returning SS$_IVPROTECT if not.

    2. It maximizes the create and owner access mode fields in the REGION_PROT argument with that of the requestor. It checks that the owner mode is less or equally privileged to the creator mode, returning SS$_IVREGPROT if not.

    3. It checks that the LENGTH_64 argument is nonzero and a multiple of the size of a page, returning the error status SS$_LEN_NOTPAGMULT if not.

    4. If VA$V_SHARED_PTS in the FLAGS argument is clear, EXE$CREATE_REGION_64 checks that the optional START_VA_64 argument, if supplied, is on a page-aligned boundary and returns the error status SS$_VA_NOTPAGALGN if not.

    5. e. If VA$V_SHARED_PTS in the FLAGS argument is set, indicating that the region can be mapped by shared page tables, EXE$CREATE_REGION_64 checks that the START_VA_64 argument is a multiple of the number of bytes mapped by one L3PT. On a system with an 8 KB page size, an L3PT maps 8 MB. It also rounds up the LENGTH_64 argument to such a multiple.

    6. f. It calculates the address of the process-permanent RDE corresponding to the specified address space.

    7. It checks that the LENGTH_64 argument can be expressed in the number of significant address bits for the system's page size and page table hierarchy, for example, 43 bits for a page size of 8 KB and a three-level page table. If not, it returns the error status SS$_VASFULL.

    8. h. If the START_VA_64 argument was supplied, it checks that the sum of the START_VA_64 and LENGTH_64 arguments can be expressed in that number of bits, returning SS$_VASFULL if not. It also checks that the START_VA_64 and the sum of START_VA_64 and LENGTH_64 are within the process-permanent region specified in the FLAGS argument, returning SS$_VA_IN_USE if not.

  3. It raises IPL to 2.

  4. It allocates an RDE from the P1 allocation region and initializes it with information from the service arguments. It initializes RDE$Q_REGION_ID from the contents of PHD$Q_NEXT_REGION_ID and increments them.

  5. If the argument START_VA_64 was not specified, it determines the alignment requirement for the starting address.

    • For a region without shared page tables, the starting address merely needs to be page-aligned.

    • For a region with shared page tables, EXE$CREATE_REGION_64 first attempts a 512-page alignment so that the shared pages can potentially be mapped as a 512-page granularity hint region. It scans the list of user-defined RDEs within the specified process-permanent region, looking for an unused piece of address space with at least the specified alignment and size. If it fails to find one and this is a shared page table region, it tries again, shrinking the desired alignment to the next smaller granularity hint region size, 64 pages, and then, if necessary, to eight pages, and finally to one page. If it fails to find an unused piece with single-page alignment that is large enough, it deallocates the RDE and returns SS$_VA_IN_USE to its requestor.

  6. If START_VA_64 was specified, it scans the list of user-defined RDEs within the specified process-permanent region, which are ordered by virtual address. It looks for the place at which the new RDE should be inserted.

    • If the address range of the new RDE overlaps the range of an existing userdefined RDE, EXE$CREATE_REGION_64 deallocates the new RDE and returns the error status SS$_VA_IN_USE to its requestor.

    • If there is overlap with the process-permanent region, it adjusts that region so that it ends where the new one begins.

  7. It inserts the RDE into the list and also at the front of the region ID list.

  8. It lowers IPL.

  9. It records peak page file use and virtual size statistics, and stores return information about the newly created RDE in the RETURN_VA_64, RETURN_REGION_ID_64, and RETURN_LENGTH_64 arguments. It returns SS$_NORMAL to its requestor.[1]

[1]The material in Appendix D is drawn from Chapter 3 of Ruth E. Goldenberg, OpenVMS Alpha Internals and Data Structures: Memory Management, 1-55558-159-5, Digital Press, 2002, Compaq Information Technologies Group, L.P.




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