Desktop/xinu_mips-1.0.2.tar/xinu_mips-1.0.2/include/memory.h File Reference

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

Go to the source code of this file.

Data Structures

struct  memblock

Defines

#define roundew(x)   (void *)( (3 + (ulong)(x)) & ~0x03 )
#define truncew(x)   (void *)( ((ulong)(x)) & ~0x03 )
#define roundmb(x)   (void *)( (7 + (ulong)(x)) & ~0x07 )
#define truncmb(x)   (void *)( ((ulong)(x)) & ~0x07 )

Functions

syscall freemem (void *pmem)
void * getmem (ulong nbytes)

Variables

struct memblock freelist
void * minheap
void * end


Detailed Description

roundew, truncew , roundmb, truncmb

Id
memory.h 235 2007-07-12 22:52:09Z agember

Definition in file memory.h.


Define Documentation

#define roundew (  )     (void *)( (3 + (ulong)(x)) & ~0x03 )

roundew - round address to next even word (add 3 to round up) truncew - trunctate address to next even word Binary & with ~0x03 to knock off the last 2 bits

Parameters:
x address to round/truncate

Definition at line 18 of file memory.h.

Referenced by create().

#define roundmb (  )     (void *)( (7 + (ulong)(x)) & ~0x07 )

roundmb - round address up to size of memblock (add sizeof(memblock)-1 to round up) truncmb - truncate address up to size of memblock Binary & with ~0x07 to knock off the last 3 bits

Parameters:
x address to round/truncate

Definition at line 28 of file memory.h.

Referenced by getmem(), and sysinit().

#define truncew (  )     (void *)( ((ulong)(x)) & ~0x03 )

Definition at line 19 of file memory.h.

Referenced by sysinit().

#define truncmb (  )     (void *)( ((ulong)(x)) & ~0x07 )

Definition at line 29 of file memory.h.


Function Documentation

syscall freemem ( void *  pmem  ) 

Free a memory block, returning it to free list.

Parameters:
*pmem pointer to memory block
Returns:
OK on success, SYSERR on failure

Definition at line 20 of file freemem.c.

References ASSERT, disable(), freelist, memblock::length, minheap, memblock::next, NULL, OK, restore(), and SYSERR.

Referenced by kill().

void* getmem ( ulong  nbytes  ) 

Allocate heap storage, returning pointer to assigned memory region.

Parameters:
nbytes number of bytes requested
Returns:
pointer to region on success, SYSERR on failure

Definition at line 17 of file getmem.c.

References disable(), freelist, memblock::length, memblock::next, NULL, restore(), roundmb, and SYSERR.

Referenced by create().


Variable Documentation

void* end

linker provides end of image

Referenced by getstk(), nulluser(), sysinit(), and xsh_memstat().

head of free memory list

Definition at line 42 of file initialize.c.

Referenced by freemem(), getmem(), sysinit(), and xsh_memstat().

void* minheap

bottom of heap

Definition at line 49 of file initialize.c.

Referenced by freemem(), nulluser(), and sysinit().


Generated on Thu Oct 9 22:34:34 2008 for xinu by  doxygen 1.5.5