[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel and Subsystems Technical Reference, Volume 1

xmattach64 Kernel Service


Attaches to a user buffer for cross-memory operations.


#include <sys/types.h>
#include <sys/errno.h>
#include <sys/xmem.h>

int xmattach64 ( addr64, count, dp, segflag )
unsigned long long addr64 ;
int count;
struct xmem *dp;
int segflags;


addr64 Specifies the address of the user buffer to be accessed in a cross-memory operation.
count Indicates the size of the user buffer to be accessed in a cross-memory operation.
dp Specifies a cross-memory descriptor. The dp->aspace_id variable must be set to a value of XMEM_INVAL.
segflag Specifies a segment flag. This flag is used to determine the address space of the memory that the cross-memory descriptor applies to. The valid values for this flag can be found in the /usr/include/xmem.h file.


The xmattach64 kernel service prepares the user buffer so that a device driver can access it without executing under the process that requested the I/O operation. A device top-half routine calls the xmattach64 kernel service. The xmattach64 kernel service allows a kernel process or device bottom-half routine to access the user buffer with the xmemin or xmemout kernel services. The device driver must use the xmdetach kernel service to inform the kernel when it has finished accessing the user buffer. The kernel remembers which segments are attached for cross-memory operations. Resources associated with these segments cannot be freed until all cross-memory descriptors have been detached. See "Cross Memory Kernel Services" in Memory Kernel Services

The address of the buffer to attach to: addr64, is interpreted as being either a 64-bit unremapped address, or a 32-bit unremapped address, as a function of both whether the current user-address space is 64 or 32-bits, and the input segflag parameter.

The input addr64 is interpreted to be a 64-bit address (in user space), if and only if, all of the following conditions apply:

In all other cases, the input address (addr64), is treated as a 32-bit unremapped address.

Execution Environment

The xmattach64 kernel service can be called from the process environment only.

Return Values

XMEM_SUCC Indicates a successful operation.
XMEM_FAIL Indicates one of the following errors:
  1. The buffer size indicated by the count parameter is less than or equal to 0.

  2. The cross-memory descriptor is in use (dp->aspace_id != XMEM_INVAL).

  3. The area of memory indicated by the addr64 and count parameters is not defined.

  4. The buffer crosses more than one segment boundary.

Implementation Specifics

The xmattach64 kernel service is part of Base Operating System (BOS) Runtime.

Related Information

The uphysio kernel service, xmdetach kernel service, xmattach kernel service, xmemin kernel service, and xmemout kernel service.

Cross Memory Kernel Services, and Memory Kernel Services.

[ Previous | Next | Contents | Home | Search ]