as_lw_det64 Kernel Service

Purpose

Unmaps and deallocates a region in the current user address space that was mapped using the as_lw_att64 kernel service.

Syntax

#include <sys/errno.h>
#include <sys/adspace.h>
#include <sys/xmem.h>
int as_lw_det64 (dp, addr, length)
xmem* dp;
void* addr;
size_t length;

Parameters

Item Description
dp The cross memory descriptor describing the attached virtual memory.
addr Specifies the first effective address of the region to be deallocated.
length Specifies the length of the region to be deallocated.

Description

Note: The as_lw_det64 kernel service should be used with caution. Read the documentation for this and the other lightweight services (as_lw_att64 and as_lw_pool_init) carefully before doing so. There is a risk that illegal data accesses will be allowed if these services are not used correctly.

The as_lw_det64 kernel service unmaps the virtual memory from the region starting at the specified effective address, which is specified by the addr parameter. This service (and only this service) must be used to unmap regions mapped by the as_lw_att64 kernel service. It must be called by the same thread that called the as_lw_att64 kernel service. The addr parameter must be the value returned by the as_lw_att64 kernel service, and the dp parameter and the length parameter must be the same dp and length passed to it. The xmdetach kernel service must not be called to release the dp parameter until any outstanding attaches of the dp parameter using the as_lw_att64 kernel service have been detached using the as_lw_det64 kernel service.

The as_lw_det64 kernel service cannot be used to detach a region not mapped by the as_lw_att64 kernel service.

The as_lw_det64 kernel service will operate correctly only for 64-bit user address spaces. It will not work for kernel processes (kprocs).

Note: This service only operates on the current process's address space. It is not allowed to operate on another address space.

Execution Environment

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

Return Values

Item Description
0 The region was successfully unmapped and deallocated.
EINVAL An attempt was made to deallocate a region that should not have been deallocated.
ENOSYS The service was called by a 32-bit process.
ENOMEM No lightweight resources allocated to this thread.
EIO Indicates a failure of the lightweight subsystem, process should discontinue use of lightweight kernel services.
EPERM Called by a user thread that is not 1:1 with a kernel thread.

Implementation Specifics

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