xlate_pin Kernel Service

Purpose

Pins all pages of a virtual buffer.

Syntax

int xlate_pin (dp, baddr, count, rw)
struct xmem *dp;
caddr_t baddr;
int count;
int rw;

Description

The xlate_pin kernel service pins all pages of the virtual buffer indicated by the baddr parameter for length of count and also appends pretranslation information to the cross memory descriptor pointed to by the dp parameter.

The xlate_pin kernel service results in a short-term pin, which will support mmap and shmatt allocated memory buffers.

In addition to pinning and translating each page, the access permissions to the page are verified according to the desired access (as specified by the rw parameter). For a setting of B_READ, write access to the page must be allowed. For a setting of B_WRITE, only read access to the page must be allowed.

The caller can preallocate pretranslation data structures and append them to the cross memory descriptor prior to the call (through a call to the xlate_create kernel service) , or have this service allocate the necessary data structures. If the cross memory descriptor is already of type XMEM_XLATE, it is assumed that the data structures are already allocated. If callers want to have the pretranslation data structures persist across the subsequent xlate_unpin call, they should also set the XLATE_PERSISTENT flag on the call to the xlate_create kernel service.

Parameters

Item Description
dp Points to the cross memory descriptor.
baddr Points to the virtual buffer.
count Specifies the length of the virtual buffer.
rw Specifies the access permissions for each page.

Return Values

If successful, the xlate_pin kernel service returns 0. If unsuccessful, one of the following is returned:
Item Description
EINVAL Invalid cross memory descriptor or parameters.
ENOMEM Unable to allocate memory.
ENOSPC Out of Paging Resources.
XMEM_FAIL Page Access violation.

Execution Environment

The xlate_pin kernel service is only callable from the process environment, and the cross memory descriptor must be valid.