#include <config.h>
#include <mem.h>
#include <stdlib.h>
Include dependency graph for mm.h:
This graph shows which files directly or indirectly include this file:
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_t * | mm_first_free |
ptr to first free block. |
Definition in file mm.h.
|
Value: next=(size_t*)(addr); \ *current=((((size_t)next)-(size_t)current)-2)>>1; \ *(next++)=MM_FREE; \ current=next; Macro for mm_init(). Always alternate MM_BLOCK_FREE and MM_BLOCK_RESERVED. |
|
Value: next=(size_t*)(((size_t)addr)-4); \ *current=((((size_t)next)-(size_t)current)-2)>>1; \ *(next++)=MM_RESERVED; \ current=next; Macro for mm_init(). Always alternate MM_BLOCK_FREE and MM_BLOCK_RESERVED. |
|
marker: block free
|
|
2 words header: pid, size
|
|
marker: block reserved
|
|
split off if 8+ data bytes
|
|
how many bytes of memory are free?
|
|
initialize memory management
|
|
free all blocks allocated by the current process
|
|
ptr to first free block.
|
|
end of kernel code + data
|
brickOS is released under the
Mozilla Public License.
Original code copyright 1998-2002 by the authors. |