matos/core/mem.h

24 lines
555 B
C
Raw Normal View History

2018-08-06 18:41:45 +02:00
#pragma once
#include "stdarg.h"
#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;
2021-01-22 22:59:45 +01:00
struct memDesc {
paddr_t phy_addr;
long ref;
2021-01-22 22:59:45 +01:00
struct memDesc *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);
2021-01-23 00:42:09 +01:00
int memAddBank(paddr_t bottomMem, paddr_t topMem, int isFree);
2020-08-28 22:38:05 +02:00
paddr_t allocPhyPage(uint nbPage);
int unrefPhyPage(paddr_t addr);
int refPhyPage(paddr_t addr);
unsigned long getNbAllocatedPage(void);