vm_guatt Kernel Service

Purpose

Attaches an area of global kernel memory to the current process's address space.

Syntax

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

int vm_guatt (kaddr, size, key, flags, uaddr)
void * kaddr;
vmsize_t size;
vmkey_t key;
long flags;
void ** uaddr;

Parameters

Item Description
kaddr Kernel address to be attached (returned from vm_galloc when the global memory was allocated).
size Length of the region to be inserted into the process address space, in bytes.
key Protection key that the process will use when accessing the attached region.
flags Type of vm_guatt operation; must be set to VU_ANYWHERE.
uaddr Pointer to user space address where the region was attached by vm_guatt. The location pointed to by uaddr (*uaddr) must be null when the vm_guatt call is made.

Description

vm_guatt is a kernel service used to attach a region of global kernel memory that was allocated with vm_galloc to a process's address space. If the call is successful, the address in the process address space where the memory was attached is returned in the location pointed to by uaddr.

key can be set to VM_PRIV or VM_UNPRIV. If it is set to VM_PRIV, the process will be able to read and write the attached region. If it is set to VM_UNPRIV, the process will not be able to write the region and will only be able to read it if the vm_galloc of the region was done with the V_UREAD flag on.

vm_guatt attachments are not inherited across a process fork.

Execution Environment

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

Return Values

Item Description
0 Indicates a successful operation.
EINVAL Indicates one of the following errors:
  • flags or key is not set to a valid value, size is 0, or the value pointed to by uaddr is non-NULL.
  • Region indicated by kaddr and size does not lie within a region previously allocated by vm_galloc.

Implementation Specifics

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