Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

kmalloc.h File Reference

Headers for the kernel memory allocators. More...

Go to the source code of this file.

Data Structures

struct  MEM_BLOCK
 A memory block structure. More...


Defines

#define M_MAGIC   ((dword)"$MB$")
 Magic number to identify a memory block.

#define M_FREE   0
 Free block.

#define M_ALLOC   1
 Allocated block.


Typedefs

typedef MEM_BLOCK mem_block_t
 A memory block structure.


Functions

void kmalloc_init ()
 Initialize the kernel virtual memory area.

void * kmalloc (dword size)
void kfree (void *ptr)
 Frees the memory space pointed by ptr, which must have been returned by a previous call to kmalloc(size_t size).
Parameters:
ptr  The pointer you want to free.


int mem_sizeof (void *ptr)
 Return the size of the pointer ptr passed as argument.
Parameters:
ptr  The pointer you want to know the size.
Exceptions:
NULL  Invalid pointer ptr.
Returns:
The size of the pointer ptr passed as argument.


void * kmemalign (size_t alignment, size_t size)
 Allocate some memory aligned to a boundary.
Parameters:
alignment  The boundary.
size  The size you want to allocate.
Exceptions:
NULL  Out-of-memory.
Returns:
A pointer to a memory area aligned to the boundary. The pointer is a aligned_mem_block_t pointer, so if you want to access to the data area of this pointer you must specify the p->start filed.
Note:
Use kfree(void *ptr) to free the allocated block.


void dump_memory_map ()
 This is a routine for debug only. It prints all the memory block headers.
Note:
Prints the result to the current console.



Detailed Description

Headers for the kernel memory allocators.

Author:
Andrea Righi <drizzt@inwind.it>
Date:
2003-10-24
Note:
Copyright (C) 2003 Andrea Righi

Definition in file kmalloc.h.


Generated on Fri Feb 20 15:32:19 2004 for Minirighi by doxygen1.2.18