An application may specify the types of access permitted for memory objects when those objects are allocated, thereby ensuring the proper use of each memory object. The type of access for individual pages within the memory object may be altered subsequent to allocation. The attributes available for memory objects and their component pages are:
The pages within a memory object must be committed in order to be used for read or write operations. Until it is committed, the system merely reserves a linear address range without reserving physical storage. The committing of a page obtains a page frame for the page; see Address Translation for further explanation.
Read access to the page is allowed. All other access attempts will result in a page fault.
Write access to the page is allowed. Write access implies both read and execute access.
Execute access to the page is allowed. Execute access implies read access.
When an application attempts to write into the guard page, a guard page fault exception is generated for the thread that referenced the guard page. This exception can be handled by an application-registered exception handler for this thread. This process is described in Guard Page Technique.
Defining a memory object to be tiled causes it to be placed in the compatibility region and mapped using the 16:16 addressing scheme, even though the object may be used by a 0:32 process.
Specifying this attribute has no effect under OS/2 Version 2.0 as all application-created
storage must reside below the 512MB address limit, and is therefore within
the compatibility region. This attribute is provided to allow applications
to be developed that will be forwardly compatible with future versions of
the operating system. It is likely that in a future release of OS/2 the
32-bit region (above 512MB) will be enabled for application use. This attribute
must then be specified for a memory object that will be used by 16-bit code.
The 80386 processor does not distinguish between read and execute access. The one implies the other. Write access implies both read and execute access.
At allocation, all pages within the object will be given the attributes specified on the DosAllocMem or DosAllocSharedMem. After allocation, attributes of individual pages or groups of pages within the memory object may be changed using the DosSetMem() function. This function is described in OS/2 Version 2.0 - Volume 4: Application Development.