24 lines
446 B
C
24 lines
446 B
C
#pragma once
|
|
#include "types.h"
|
|
#include "stdarg.h"
|
|
|
|
|
|
#define PAGE_SHIFT 12
|
|
#define PAGE_SIZE (1 << PAGE_SHIFT)
|
|
|
|
// Defined in linker.ld script
|
|
extern uint32_t __ld_kernel_begin;
|
|
extern uint32_t __ld_kernel_end;
|
|
|
|
struct mem_desc{
|
|
paddr_t phy_addr;
|
|
unsigned long ref;
|
|
struct mem_desc *next, *prev;
|
|
};
|
|
|
|
|
|
int memSetup(paddr_t upperMem, paddr_t *lastUsed);
|
|
paddr_t allocPhyPage(void);
|
|
int unrefPhyPage(paddr_t addr);
|
|
int refPhyPage(paddr_t addr);
|