00001 /*! \file include/kernel/umalloc.h 00002 * \brief Header of Virtual Memory Allocator for the User Space. 00003 * \author Andrea Righi <drizzt@inwind.it> 00004 * \date Last update: 2004-01-01 00005 * \note Copyright (©) 2003 Andrea Righi 00006 */ 00007 00008 #ifndef UMALLOC_H 00009 #define UMALLOC_H 00010 00011 //! Magic number to identify a memory block. 00012 #define UM_MAGIC ((uint32_t)"$UM$") 00013 //! Free block. 00014 #define UM_FREE 0 00015 //! Allocated block. 00016 #define UM_ALLOC 1 00017 00018 //! A memory block structure. 00019 typedef struct UMEM_BLOCK 00020 { 00021 uint32_t magic, 00022 flags, 00023 size, 00024 owner; 00025 } umem_block_t; 00026 00027 // --- Prototypes ----------------------------------------------------- // 00028 00029 void umalloc_init(size_t heap_start, size_t heap_size); 00030 void *umalloc(size_t size); 00031 void ufree(void *ptr); 00032 00033 #endif