2018-08-06 18:41:45 +02:00
|
|
|
#pragma once
|
2018-08-06 21:00:58 +02:00
|
|
|
#include "stdarg.h"
|
2020-04-27 00:14:37 +02:00
|
|
|
#include "types.h"
|
2018-08-06 18:41:45 +02:00
|
|
|
|
2019-04-11 22:34:20 +02:00
|
|
|
#define PAGE_SHIFT 12U
|
|
|
|
#define PAGE_SIZE (1U << PAGE_SHIFT)
|
2018-08-06 18:41:45 +02:00
|
|
|
|
|
|
|
// Defined in linker.ld script
|
|
|
|
extern uint32_t __ld_kernel_begin;
|
|
|
|
extern uint32_t __ld_kernel_end;
|
|
|
|
|
2020-04-27 00:14:37 +02:00
|
|
|
struct mem_desc {
|
|
|
|
paddr_t phy_addr;
|
|
|
|
long ref;
|
|
|
|
struct mem_desc *next, *prev;
|
2018-08-06 18:41:45 +02:00
|
|
|
};
|
|
|
|
|
2018-11-11 23:04:23 +01:00
|
|
|
int memSetup(paddr_t upperMem, paddr_t *lastUsed);
|
2018-11-09 21:49:23 +01:00
|
|
|
paddr_t allocPhyPage(void);
|
|
|
|
int unrefPhyPage(paddr_t addr);
|
|
|
|
int refPhyPage(paddr_t addr);
|
2018-11-14 14:28:06 +01:00
|
|
|
unsigned long getNbAllocatedPage(void);
|