next up previous contents
Next: close: close an open Up: MOSS system calls Previous: alloc_dma: allocate DMA memory

alloc_dos: allocate low DOS memory

SYNOPSIS

unsigned alloc_dos(size_t size, int align_bits, unsigned align_ofs);

DESCRIPTION

This function can be used to allocate memory from the low 1MB of physical memory directly accessible to DOS.

This function only allocates the requested physical memory; in order to gain access to it within the application you must map it into the application's address space using mmap.

PARAMETERS

size
The minimum number of bytes of memory required.
align_bits
If greater than zero, the lowest align_bits bits of the physical start address of the returned memory will be equal to the specified align_ofs.
align_ofs
The low-order bits of the required alignment. If align_ofs is zero, the returned block will be naturally aligned according to align_bits. Must be less than 2align_bits.

RETURN VALUE

Returns the physical address of the memory allocated if successful, or 0 on error, in which case errno indicates the error.



Bryan Ford