matos/core/allocArea.h
2021-10-28 18:33:02 +02:00

23 lines
547 B
C

#pragma once
#include "paging.h"
#include "stdarg.h"
/* Pure Virtual Memory Allocation */
// areaAlloc map vmem to phy pages
#define AREA_PHY_MAP (1<<0)
#define AREA_MEM_TOP PAGING_MIRROR_VADDR
struct memArea {
vaddr_t startAddr;
uint nbPages;
struct memArea *next;
struct memArea *prev;
};
void areaInit(vaddr_t firstMemUsed, vaddr_t lastUsed, vaddr_t stack_bottom, vaddr_t stack_top);
vaddr_t areaAlloc(unsigned int nbPages, uint32_t flags);
int areaFree(vaddr_t addr);
int areaAdd(vaddr_t begin, vaddr_t end, int isFree);