vm_galloc Kernel Service

Purpose

Allocates a region of global memory in the 64-bit kernel.

Syntax

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

int vm_galloc (int  type, vmsize_t  size, ulong * eaddr)

Description

The vm_galloc kernel service allocates memory from the kernel global memory pool on the 64-bit kernel. The allocation size is rounded up to the nearest 4K boundary. The default page protection key for global memory segments is 00 unless overridden with the V_UREAD flag.

The type field may have the following values, which may be combined:

Item Description
V_WORKING Required. Creates a working storage segment.
V_SYSTEM The new allocation is a global system area that does not belong to any application. Storage reference errors to this area will result in system crashes.
V_UREAD Overrides the default page protection of 00 and creates the new region with a default page protection of 01.
V_NOEXEC Pages in the region will have no-execute protection by default. Only supported on POWER4 and later hardware.

The vm_galloc kernel service is intended for subsystems that have large data structures for which xmalloc is not the best choice for management. The kernel xmalloc heap itself does reside in global memory.

Parameters

Item Description
type Flags that may be specified to control the allocation.
size Specifies the size, in bytes, of the desired allocation.
eaddr Pointer to where vm_galloc will return the start address of the allocated storage.

Execution Environment

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

Return Values

Item Description
0 Successful completion. A new region was allocated, and its start address is returned at the address specified by the eaddr parameter.
EINVAL Invalid size or type specified.
ENOSPC Not enough space in the galloc heap to perform the allocation.
ENOMEM Insufficient resources available to satisfy the request.