Memory Management
[Linux DDE Common]

This module emulates the Memory Management subsystem inside the Linux kernel. More...


Modules

 Address Conversion
 Linux' __va()/__pa() macro replacements.
 Page Allocation/Deallocation
 Page allocation just triggers mapping and deallocation triggers unmapping.
 Slab Caches
 This simple slab cache emulation was introduced for the Linux USB drivers.

Functions

void * kmalloc (size_t size, int gfp)
 kmem Allocation
void kfree (const void *addr)
 kmem Deallocation
void * vmalloc (unsigned long size)
 vmem Allocation
void vfree (void *addr)
 vmem Deallocation
int l4dde_mm_init (unsigned int max_vsize, unsigned int max_ksize)
 Initalize LMM pools and initial regions.

Detailed Description

This module emulates the Memory Management subsystem inside the Linux kernel.

Linux DDE manages two OSKit LMM pools for memory allocations - one for kmalloc() (kmem) and one for vmalloc() (vmem) allocations. Each pool consists of one ore more LMM regions.

Malloc functions have to keep track of chunk sizes and store them in the first dword of the chunk.

Configuration:


Function Documentation

void kfree ( const void *  addr  ) 

kmem Deallocation

Parameters:
addr start address of memory chunk to free
This is Linux' kfree().

Definition at line 209 of file mm.c.

void* kmalloc ( size_t  size,
int  gfp 
)

kmem Allocation

Parameters:
size size of memory chunk
gfp flags
This is Linux' kmalloc().

Returns:
start address of allocated chunk; NULL on error

Definition at line 171 of file mm.c.

int l4dde_mm_init ( unsigned int  max_vsize,
unsigned int  max_ksize 
)

Initalize LMM pools and initial regions.

Parameters:
max_vsize max size of virtual memory allocations
max_ksize max size of kernel memory allocations
Returns:
0 on success, negative error code otherwise
Sizes are rounded up to multiples of page size.

kmem pool is divided into MM_KREGIONS regions of same size. The total size will be max_ksize (or greater because of rounding/page size). vmem pool has only one region of max_vsize.

Definition at line 377 of file mm.c.

void vfree ( void *  addr  ) 

vmem Deallocation

Parameters:
addr start address of memory chunk to release
This is Linux' vfree().

Definition at line 270 of file mm.c.

void* vmalloc ( unsigned long  size  ) 

vmem Allocation

Parameters:
size size of memory chunk
Returns:
start address of allocated chunk; NULL on error
This is Linux' vmalloc().

Definition at line 235 of file mm.c.


Linux DDE, written by Christian Helmuth  © 2003 Technische Universitaet Dresden