feature: both physical and virtual allocators should be done
This commit is contained in:
@ -18,7 +18,7 @@ enum { BPZ = 128, PAGES_TINY = 16, PAGES_SMALL = 64, MEM_ALIGN = 8 };
|
||||
typedef enum { TINY, SMALL, LARGE } block_type_t;
|
||||
|
||||
/* METADATA:
|
||||
* ptr: the ptr to return with kalloc (aligned)
|
||||
* ptr: the ptr to return with kmalloc (aligned)
|
||||
* size: the actual size
|
||||
* sub_size: the size asked by the user (different
|
||||
* from size only if krealloc and krealloc size < size)
|
||||
@ -67,7 +67,8 @@ typedef struct Zone {
|
||||
* For TINY and SMALL, the zone will be divided in blocks.
|
||||
* For LARGE, it will be entire page(s).
|
||||
*/
|
||||
extern Zone *zones[3];
|
||||
extern Zone *kzones[3];
|
||||
extern Zone *vzones[3];
|
||||
|
||||
/*----------- UTILS ----------*/
|
||||
block_type_t get_type(size_t size);
|
||||
@ -76,10 +77,15 @@ size_t align_mem(size_t addr);
|
||||
/*----------------------------*/
|
||||
|
||||
/*-------- ALLOCATOR ---------*/
|
||||
int new_zone(block_type_t type, size_t size);
|
||||
int new_kzone(block_type_t type, size_t size);
|
||||
int new_vzone(block_type_t type, size_t size);
|
||||
/*----------------------------*/
|
||||
|
||||
void *kalloc(size_t size);
|
||||
void *kmalloc(size_t size);
|
||||
void kfree(void *ptr);
|
||||
void *krealloc(void *ptr, size_t size);
|
||||
void show_alloc_mem(void);
|
||||
void *vmalloc(size_t size);
|
||||
void vfree(void *ptr);
|
||||
void *vrealloc(void *ptr, size_t size);
|
||||
void show_kalloc_mem(void);
|
||||
void show_valloc_mem(void);
|
||||
|
||||
Reference in New Issue
Block a user