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

rmalloc Kernel Service

Purpose

Allocates an area of memory.

Syntax

#include <sys/types.h>
caddr_t rmalloc (size, align)
int size
int align

Parameters

size Specifies the number of bytes to allocate.
align Specifies alignment characteristics.

Description

The rmalloc kernel service allocates an area of memory from the contiguous real memory heap. This area is the number of bytes in length specified by the size parameter and is aligned on the byte boundary specified by the align parameter. The align parameter is actually the log base 2 of the desired address boundary. For example, an align value of 4 requests that the allocated area be aligned on a 16-byte boundary.

The contiguous real memory heap, real_heap, is a heap of contiguous real memory pages located in the low 16MB of real memory. This heap is mapped virtually into the kernel extension segment. By nature, this heap is implicitly pinned, so no explicit pinning of allocated regions is necessary. This heap is provided primarily for device drivers whose devices can only address 0 to 16MB of real memory, so they must "bounce" the I/O in and out of a buffer rmalloc'ed from this heap. Also, this heap is useful for devices that require greater than 4KB transfers, but do not support scatter/gather.

The real_heap is only supported on platforms with an ISA bus. On unsupported platforms, the rmalloc service returns NULL if the requested memory cannot be allocated.

The rmfree kernel service should be called to free allocation from a previous rmalloc call. The rmalloc kernel service can be called from the process environment only.

Return Values

Upon successful completion, the rmalloc kernel service returns the address of the allocated area. A NULL pointer is returned if the requested memory cannot be allocated.

Implementation Specifics

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

Related Information

The rmfree kernel service.


[ Previous | Next | Contents | Home | Search ]