hos/mm.h

32 lines
583 B
C

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);
#define MM_PB_FLAGMASK 0x03 //00000011
#define MM_PB_NP 0x00 //00000000
#define MM_PB_AVAIL 0x01 //00000001
#define MM_PB_USED 0x02 //00000010