IBNOS
Macros | Functions
physmem.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include <util/util.h>
#include <multiboot/multiboot.h>
Include dependency graph for physmem.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PAGE_SIZE   0x1000
 
#define PAGE_MASK   0xFFF
 
#define PAGE_BITS   12
 
#define PAGE_COUNT   0x100000
 
#define PHYSMEM_FREE   0
 
#define PHYSMEM_RESERVED   1
 

Functions

void physMemInit (multiboot_info_t *bootInfo)
 Initializes the physical memory management. More...
 
uint32_t physMemRAMSize ()
 Query RAM size. More...
 
uint32_t physMemUsableMemory ()
 Query usable RAM size. More...
 
void physMemProtectBootEntry (uint32_t addr, uint32_t length)
 Marks all pages within a memory range as reserved and adds them to the boot map. More...
 
void physMemClearMemoryBits (bool reserved)
 Marks the full memory range as reserved or free. More...
 
void physMemReserveMemory (uint32_t addr, uint32_t length)
 Marks all pages within a memory range as reserved. More...
 
void physMemFreeMemory (uint32_t addr, uint32_t length)
 Marks all pages fully contained within the memory range as free. More...
 
void physMemSetMemoryBits (uint32_t startIndex, uint32_t length, bool reserved)
 Marks a specific range of pages as reserved or free. More...
 
uint32_t physMemAllocPage (bool lowmem)
 Allocates a page of physical memory. More...
 
uint32_t physMemReleasePage (uint32_t index)
 Releases a page of physical memory. More...
 
uint32_t physMemAddRefPage (uint32_t index)
 Increment the refcounter of a physical page. More...
 
uint32_t physMemMarkUnpageable (uint32_t index)
 Marks a physical page as unpageable. More...
 
bool physMemIsLastRef (uint32_t index)
 Checks if a physical page is only referenced exactly one time. More...
 
void physMemPageOut (UNUSED uint32_t length)
 Pages out some memory to the hard drive. More...
 
uint32_t physMemPageIn (UNUSED uint32_t hdd_index)
 Pages in some data from the hard drive. More...
 
void physMemDumpMemInfo ()
 Dumps information about the physical memory usage. More...