wip: memory change
This commit is contained in:
@ -8,12 +8,10 @@
|
||||
|
||||
// Remove this and replace it with <assert.h> header
|
||||
// for debugging purposes
|
||||
/* #include <assert.h> */
|
||||
#define assert(bool)
|
||||
|
||||
// BPZ = Blocks Per Zone, which is the max
|
||||
// number of blocks for a new zone
|
||||
enum { BPZ = 128, PAGES_TINY = 16, PAGES_SMALL = 64, MEM_ALIGN = 8 };
|
||||
enum { BPZ = 128, PAGES_TINY = 16, PAGES_SMALL = 64, MEM_ALIGN = 4 };
|
||||
|
||||
typedef enum { TINY, SMALL, LARGE } block_type_t;
|
||||
|
||||
@ -34,7 +32,6 @@ typedef enum { TINY, SMALL, LARGE } block_type_t;
|
||||
* available blocks (Block *free in struct Zone)
|
||||
*/
|
||||
typedef struct Block {
|
||||
|
||||
void *ptr;
|
||||
size_t size;
|
||||
size_t sub_size;
|
||||
@ -54,12 +51,12 @@ typedef struct Block {
|
||||
* in_use
|
||||
*/
|
||||
typedef struct Zone {
|
||||
Block *free;
|
||||
Block *used;
|
||||
size_t size;
|
||||
struct Zone *prev;
|
||||
struct Zone *next;
|
||||
block_type_t type;
|
||||
Block *free;
|
||||
Block *used;
|
||||
} Zone;
|
||||
|
||||
/* Linked list to store all the zones (pages) mapped.
|
||||
@ -89,5 +86,5 @@ void vfree(void *ptr);
|
||||
void *vrealloc(void *ptr, size_t size);
|
||||
void show_kalloc_mem(void);
|
||||
void show_valloc_mem(void);
|
||||
size_t ksize(void* virt_addr);
|
||||
size_t vsize(void* virt_addr);
|
||||
size_t ksize(void *virt_addr);
|
||||
size_t vsize(void *virt_addr);
|
||||
|
||||
Reference in New Issue
Block a user