Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

include/sys/mm.h File Reference

Internal Interface: memory management. More...

#include <config.h>
#include <mem.h>
#include <stdlib.h>

Include dependency graph for mm.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define MM_FREE   0x0000
 marker: block free

#define MM_RESERVED   0xffff
 marker: block reserved

#define MM_HEADER_SIZE   2
 2 words header: pid, size

#define MM_SPLIT_THRESH   (MM_HEADER_SIZE+8)
 split off if 8+ data bytes

#define MM_BLOCK_FREE(addr)
 memory from addr on can be allocated

#define MM_BLOCK_RESERVED(addr)
 memory from addr on is reserved


Functions

void mm_init ()
 initialize memory management

void mm_reaper ()
 free all blocks allocated by the current process

int mm_free_mem (void)
 how many bytes of memory are free?


Variables

size_t mm_start
 end of kernel code + data

size_tmm_first_free
 ptr to first free block.


Detailed Description

Internal Interface: memory management.

Author:
Markus L. Noga <markus@noga.de>

Definition in file mm.h.


Define Documentation

#define MM_BLOCK_FREE addr   ) 
 

Value:

next=(size_t*)(addr);                                   \
        *current=((((size_t)next)-(size_t)current)-2)>>1;       \
        *(next++)=MM_FREE;                                      \
        current=next;
memory from addr on can be allocated

Macro for mm_init(). Always alternate MM_BLOCK_FREE and MM_BLOCK_RESERVED.

Definition at line 68 of file mm.h.

#define MM_BLOCK_RESERVED addr   ) 
 

Value:

next=(size_t*)(((size_t)addr)-4);                       \
        *current=((((size_t)next)-(size_t)current)-2)>>1;       \
        *(next++)=MM_RESERVED;                                  \
        current=next;
memory from addr on is reserved

Macro for mm_init(). Always alternate MM_BLOCK_FREE and MM_BLOCK_RESERVED.

Definition at line 79 of file mm.h.

#define MM_FREE   0x0000
 

marker: block free

Definition at line 47 of file mm.h.

#define MM_HEADER_SIZE   2
 

2 words header: pid, size

Definition at line 53 of file mm.h.

#define MM_RESERVED   0xffff
 

marker: block reserved

Definition at line 48 of file mm.h.

#define MM_SPLIT_THRESH   (MM_HEADER_SIZE+8)
 

split off if 8+ data bytes

Definition at line 54 of file mm.h.


Function Documentation

int mm_free_mem void   ) 
 

how many bytes of memory are free?

void mm_init  ) 
 

initialize memory management

void mm_reaper  ) 
 

free all blocks allocated by the current process


Variable Documentation

size_t* mm_first_free
 

ptr to first free block.

Definition at line 58 of file mm.h.

size_t mm_start
 

end of kernel code + data

Definition at line 56 of file mm.h.


brickOS is released under the Mozilla Public License.
Original code copyright 1998-2002 by the authors.

Generated on Mon Feb 16 21:02:24 2004 for brickOS Kernel Developer by doxygen 1.3.5