typedef struct { qword base; qword limit; dword attributes; } __attribute__((packed)) memmap_entry; typedef struct { dword base; dword length; //in pages dword flags; dword link; } __attribute__ ((packed)) pageblock; //16 byte pageblock entry - 512 entries = 1 page void mm_init(); void mm_init_pageblockpage(pageblock *pbp); void *mm_palloc(dword numpages); int mm_pfree(void *ptr); dword mm_freeentries(); pageblock *mm_new_pageblock_page(); pageblock *mm_lastpageblockentry(); pageblock *mm_nextpageblockentry(); dword mm_freemem(); #define MM_PB_FLAGMASK 0x03 //00000011 #define MM_PB_NP 0x00 //00000000 #define MM_PB_AVAIL 0x01 //00000001 #define MM_PB_USED 0x02 //00000010