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

mm.c File Reference

Memory Management. More...

#include <l4/env/errno.h>
#include <l4/lock/lock.h>
#include <l4/names/libnames.h>
#include <l4/l4rm/l4rm.h>
#include <l4/dm_mem/dm_mem.h>
#include <l4/dm_phys/dm_phys.h>
#include <l4/dde_linux/dde.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <oskit/lmm.h>
#include "__config.h"
#include "internal.h"

Go to the source code of this file.

Module Variables

int _initialized = 0
 initialization flag

lmm_t kpool = LMM_INITIALIZER
 kmem pool

lmm_region_t kregion [MM_KREGIONS]
 kmem regions in pool

unsigned int kregion_size
 kmem region size

unsigned int kcount = MM_KREGIONS - 1
 kmem region counter

l4lock_t klock = L4LOCK_UNLOCKED_INITIALIZER
 protect access to kmem pool

lmm_t vpool = LMM_INITIALIZER
 vmem pool

lmm_region_t vregion
 vmem region in pool

l4lock_t vlock = L4LOCK_UNLOCKED_INITIALIZER
 protect access to vmem pool


Functions

__inline__ int __more_kcore (l4_size_t size, l4_uint32_t flags)
 Simulated LMM Callback on Memory Shortage (kmem).

__inline__ int __more_vcore (l4_size_t size)
 Simulated LMM Callback on Memory Shortage (vmem).

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 __setup_kmem (unsigned int *max, l4_addr_t *addr)
 Setup kmem pool.

int __setup_vmem (unsigned int *max, l4_addr_t *addr)
 Setup vmem pool.

int l4dde_mm_init (unsigned int max_vsize, unsigned int max_ksize)
 Initalize LMM pools and initial regions.

int l4dde_mm_kmem_avail (void)
 Return amount of free kernel memory.


Detailed Description

Memory Management.

Date:
08/28/2003
Author:
Christian Helmuth <ch12@os.inf.tu-dresden.de>

Definition in file mm.c.


Function Documentation

__inline__ int __more_kcore l4_size_t  size,
l4_uint32_t  flags
[static]
 

Simulated LMM Callback on Memory Shortage (kmem).

Parameters:
size size of memory chunk needed
flags memory type
Returns:
0 on success, negative error code otherwise
As long as maximum region number is not exceeded new physical contiguous dataspaces are requested from a dataspace manager and attached to appropriate regions in address space by the L4 Region Mapper. The region is then added as new LMM region to the kmem LMM pool.

size is rounded up to multiples of KMEM_RSIZE.

I removed the unlock/lock around page requesting that was in the original OSKit implementation's MORECORE() macro (clientos/mem.c). Hope it's still fully functioning.

Todo:
consider flags

Definition at line 107 of file mm.c.

References address_add_region(), DEBUG_ERRORS, DEBUG_MALLOC, kcount, kpool, kregion, and kregion_size.

Referenced by kmalloc().

__inline__ int __more_vcore l4_size_t  size  )  [static]
 

Simulated LMM Callback on Memory Shortage (vmem).

Parameters:
size size of memory chunk needed
Returns:
-L4_ENOMEM
This always returns "Out of memory" as we leave mappings in vmem region to l4rm and dataspace managers.

Definition at line 167 of file mm.c.

References DEBUG_ERRORS.

Referenced by vmalloc().


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