Lab2
Data Structures | Functions | Variables

lmlib

Data Structures

struct  mmap_t

Functions

int lm_init (void)
 Initializes the low memory area, the region up to the 1 MByte physical address, by mapping it on the process' physical memory address.
void * lm_alloc (unsigned long size, mmap_t *map)
 Allocates a memory block in low memory area with the specified size.
void lm_free (mmap_t *map)
 Frees a memory block in the low memory area, previously allocated using lm_alloc()

Variables

void * mmap_t::virtual
 virtual address
unsigned long mmap_t::size
 size of memory region

Detailed Description

Functions related to low memory (first 1 MB of physical memory), required for BIOS


Function Documentation

int lm_init ( void  )

Initializes the low memory area, the region up to the 1 MByte physical address, by mapping it on the process' physical memory address.

Returns:
0 on success, non-zero otherwise
void* lm_alloc ( unsigned long  size,
mmap_t map 
)

Allocates a memory block in low memory area with the specified size.

Allocates a memory block in the region up to the 1 MByte physical address with the input size. Initializes the input mmap_t struct with the maping information, which can be read but must not be modified.

Parameters:
sizesize of the memory block to allocate
mappointer to mmap_t data structure, which represents the memory map
Returns:
the virtual address of the memory block on success, NULL otherwise
void lm_free ( mmap_t map)

Frees a memory block in the low memory area, previously allocated using lm_alloc()

Frees a memory block in the region up to the 1 MByte physical addess, previously allocated using lm_alloc(). Takes as input the address of the mmap_t structure that was passed to lm_alloc(), and that must have not been modified since.

Parameters:
mappointer to mmap_t data structure of the block being freed
 All Data Structures Variables