27 lines
769 B
C
27 lines
769 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);
|
|
// Remove an area from the free ones but do not add it into used ones.
|
|
// This area should be latter added woth areaAdd.
|
|
// Used by malloc to avoid recursivity issue
|
|
vaddr_t areaBook(unsigned int nbPages, uint32_t flags);
|
|
int areaFree(vaddr_t addr);
|
|
int areaAdd(vaddr_t begin, vaddr_t end, int isFree);
|