Main Page | Modules | Class List | File List | Class Members | File Members | Related Pages

Memory Management
[Linux DDE Common]

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


Modules

group Address Conversion
 Linux' __va()/%__pa() macro replacements.

group Page Allocation/Deallocation
 Page allocation just triggers mapping and deallocation triggers unmapping.

group 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.

Requirements: (additionally to Global Requirements)

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 223 of file mm.c.

References DEBUG_MALLOC_EACH, klock, and kpool.

Referenced by pci_pool_destroy().

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 183 of file mm.c.

References __more_kcore(), DEBUG_MALLOC_EACH, DEBUG_MSG, klock, and kpool.

Referenced by pci_pool_create().

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 398 of file mm.c.

References __setup_kmem(), __setup_vmem(), _initialized, DEBUG_ERRORS, and MM_KREGIONS.

void vfree void *  addr  ) 
 

vmem Deallocation

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

Definition at line 286 of file mm.c.

References DEBUG_MALLOC_EACH, vlock, and vpool.

Referenced by __sound_remove_unit(), __start_kernel_thread(), kmem_cache_destroy(), and sound_insert_unit().

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 249 of file mm.c.

References __more_vcore(), DEBUG_MALLOC_EACH, vlock, and vpool.

Referenced by dde_add_region(), kernel_thread(), kmem_cache_create(), l4dde_process_add_worker(), l4dde_process_init(), and sound_insert_unit().


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