matos/core/allocArea.h

38 lines
889 B
C
Raw Permalink Normal View History

2021-02-10 23:22:57 +01:00
#pragma once
#include "paging.h"
2021-08-09 09:26:10 +02:00
#include "stdarg.h"
2024-01-29 23:27:10 +01:00
#include "stdint.h"
2021-02-10 23:22:57 +01:00
2021-10-26 22:29:51 +02:00
/* Pure Virtual Memory Allocation */
// areaAlloc map vmem to phy pages
#define AREA_PHY_MAP (1<<0)
2021-10-28 00:58:24 +02:00
#define AREA_MEM_TOP PAGING_MIRROR_VADDR
2021-10-26 22:29:51 +02:00
2023-05-01 17:58:35 +02:00
/**
* Initialize the Area subsystem
**/
2021-10-28 00:32:35 +02:00
void areaInit(vaddr_t firstMemUsed, vaddr_t lastUsed, vaddr_t stack_bottom, vaddr_t stack_top);
2023-05-01 17:58:35 +02:00
/**
* Request a virtual memory area of @param nbPages
**/
2021-10-26 22:29:51 +02:00
vaddr_t areaAlloc(unsigned int nbPages, uint32_t flags);
2023-05-01 17:58:35 +02:00
/**
2024-01-31 23:47:42 +01:00
* Free a virtual area
2023-05-01 17:58:35 +02:00
**/
2021-04-10 00:24:02 +02:00
int areaFree(vaddr_t addr);
2023-05-01 17:58:35 +02:00
/**
* Remove an area from the "free" ones but do not add it into used ones.
* This area should be latter added with areaAdd.
* Used by malloc to avoid recursivity issue
**/
vaddr_t areaBook(unsigned int nbPages, uint32_t flags);
/**
* Declare a virtual region to be managed by the subsytem
*/
int areaAdd(vaddr_t begin, vaddr_t end, int isFree);