The Memory kernel services provide kernel extensions with the ability to:
The following information is provided to assist you in learning more about memory kernel services:
The Memory Management services are:
init_heap | Initializes a new heap to be used with kernel memory management services. |
xmalloc | Allocates memory. |
xmfree | Frees allocated memory. |
The Memory Pinning services are:
ltpin | Pins the address range in the system (kernel) space and frees the page space for the associated pages. |
ltunpin | Unpins the address range in system (kernel) address space and reallocates paging space for the specified region. |
pin | Pins the address range in the system (kernel) space. |
pincode | Pins the code and data associated with a loaded object module. |
pinu | Pins the specified address range in user or system memory. |
unpin | Unpins the address range in system (kernel) address space. |
unpincode | Unpins the code and data associated with a loaded object module. |
unpinu | Unpins the specified address range in user or system memory. |
xmempin | Pins the specified address range in user or system memory, given a valid cross-memory descriptor. |
xmemunpin | Unpins the specified address range in user or system memory, given a valid cross-memory descriptor. |
In a system call or kernel extension running under a user process, data in the user process can be moved in or out of the kernel using the copyin and copyout services. The uiomove service is used for scatter and gather operations. If user data is to be referenced asynchronously, such as from an interrupt handler or a kernel process, the cross memory services must be used.
The User-Memory-Access kernel services are:
copyin, copyin64 | Copies data between user and kernel memory. |
copyinstr, copyinstr64 | Copies a character string (including the terminating null character) from user to kernel space. |
copyout, copyout64 | Copies data between user and kernel memory. |
fubyte, fubyte64 | Fetches, or retrieves, a byte of data from user memory. |
fuword, fuword64 | Fetches, or retrieves, a word of data from user memory. |
subyte, subyte64 | Stores a byte of data in user memory. |
suword, suword64 | Stores a word of data in user memory. |
uiomove | Moves a block of data between kernel space and a space defined by a uio structure. |
ureadc | Writes a character to a buffer described by a uio structure. |
uwritec | Retrieves a character from a buffer described by a uio structure. |
These services are described in more detail in Understanding Virtual Memory Manager Interfaces. The Virtual Memory Management services are:
as_att, as_att64 | Selects, allocates, and maps a specified region in the current user address space. |
as_det, as_det64 | Unmaps and deallocates a region in the specified address space that was mapped with the as_att or as_att64 kernel service. |
as_geth, as_geth64 | Obtains a handle to the virtual memory object for the specified address given in the specified address space. The virtual memory object is protected. |
as_getsrval, as_getsrval64 | Obtains a handle to the virtual memory object for the specified address given in the specified address space. |
as_puth as_puth64 | Indicates that no more references will be made to a virtual memory object that was obtained using the as_geth or as_geth64 kernel service. |
as_seth, as_seth64 | Maps a specified region in the specified address space for the specified virtual memory object. |
getadsp | Obtains a pointer to the current process's address space structure for use with the as_att and as_det kernel services. |
io_att | Selects, allocates, and maps a region in the current address space for I/O access. |
io_det | Unmaps and deallocates the region in the current address space at the given address. |
vm_att | Maps a specified virtual memory object to a region in the current address space. |
vm_cflush | Flushes the processor's cache for a specified address range. |
vm_det | Unmaps and deallocates the region in the current address space that contains a given address. |
vm_galloc | Allocates a region of global memory in the 64-bit kernel. |
vm_gfree | Frees a region of global memory in the kernel previously allocated with the vm_galloc kernel service. |
vm_handle | Constructs a virtual memory handle for mapping a virtual memory object with specified access level. |
vm_makep | Makes a page in client storage. |
vm_mount | Adds a file system to the paging device table. |
vm_move | Moves data between a virtual memory object and a buffer specified in the uio structure. |
vm_protectp | Sets the page protection key for a page range. |
vm_qmodify | Determines whether a mapped file has been changed. |
vm_release | Releases virtual memory resources for the specified address range. |
vm_releasep | Releases virtual memory resources for the specified page range. |
vm_uiomove | Moves data between a virtual memory object and a buffer specified in the uio structure. |
vm_umount | Removes a file system from the paging device table. |
vm_vmid | Converts a virtual memory handle to a virtual memory object (id). |
vm_write | Initiates page-out for a page range in the address space. |
vm_writep | Initiates page-out for a page range in a virtual memory object. |
vms_create | Creates a virtual memory object of the type and size and limits specified. |
vms_delete | Deletes a virtual memory object. |
vms_iowait | Waits for the completion of all page-out operations for pages in the virtual memory object. |
The cross-memory services allow data to be moved between the kernel and an address space other than the current process address space. A data area within one region of an address space is attached by calling the xmattach or xmattach64 service. As a result, the virtual memory object cannot be deleted while data is being moved in or out of pages belonging to it. A cross-memory descriptor is filled out by the xmattach or xmattach64 service. The attach operation must be done while under a process. When the data movement is completed, the xmdetach service can be called. The detach operation can be done from an interrupt handler.
The xmemin service can be used to transfer data from an address space to kernel space. The xmemout service can be used to transfer data from kernel space to an address space. These routines may be called from interrupt handler level routines if the referenced buffers are in memory.
Cross-memory services provide the xmemdma or xmemdma64 service to prepare a page for DMA processing. The xmemdma or xmemdma64 service returns the real address of the page for use in preparing DMA address lists. When the DMA transfer is completed, the xmemdma or xmemdma64 service must be called again to unhide the page.
The xmemdma64 service is identical to xmemdma, except that xmemdma64 returns a 64-bit real address. The xmemdma64 service can be called from the process or interrupt environments. It is also present on 32-bit platform to allow a single device driver or kernel extension binary to work on 32-bit or 64-bit platforms with no change and no run-time checks.
Data movement by DMA or an interrupt handler requires that the pages remain in memory. This is ensured by pinning the data areas using the xmempin service. This can only be done under a process, because the memory pinning services page-fault on pages not present in memory.
The xmemunpin service unpins pinned pages. This can be done by an interrupt handler if the data area is the global kernel address space. It must be done under the process if the data area is in user process space.
The Cross-Memory services are:
xmattach, xmattach64 | Attaches to a user buffer for cross-memory operations. |
xmdetach | Detaches from a user buffer used for cross-memory operations. |
xmemin | Performs a cross-memory move by copying data from the specified address space to kernel global memory. |
xmemout | Performs a cross-memory move by copying data from kernel global memory to a specified address space. |
xmemdma | Prepares a page for DMA I/O or processes a page after DMA I/O is complete. |
xmemdma64 | Prepares a page for DMA I/O or processes a page after DMA I/O is complete. Returns 64-bit real address. |