Kintsugi OS 0.5.0
x86 Monolithic OS
Loading...
Searching...
No Matches
memory.c File Reference
#include "memory.h"
#include "../kernel/log.h"
#include "../kklibc/kklibc.h"

Macros

#define FRAMES   (PMM_LIMIT / PAGE_SIZE)
 

Functions

static u32 directory[1024] __attribute__ ((aligned(4096)))
 
static int bit (u32 *map, u32 n)
 
static void set (u32 *map, u32 n)
 
static void clear (u32 *map, u32 n)
 
u32 pmm_alloc_page (void)
 
int pmm_free_page (u32 address)
 
int vmm_map_page (u32 va, u32 pa, u32 flags)
 
int vmm_unmap_page (u32 va)
 
u32 vmm_translate (u32 va)
 
void memory_init (void)
 
memory_stats_t memory_stats (void)
 
u32 vmm_space_create (void)
 
void vmm_space_switch (u32 space)
 
u32 vmm_user_physical (u32 space, u32 address, int write)
 
int vmm_user_page (u32 space, u32 address, int writable)
 
void vmm_space_destroy (u32 space)
 
void memory_print_info (void)
 
void memory_print_map (void)
 

Variables

static u32 used [FRAMES/32]
 
static u32 owned [FRAMES/32]
 
static memory_region_t regions [64]
 
static memory_stats_t stats
 
static u32 cursor = 256
 

Macro Definition Documentation

◆ FRAMES

#define FRAMES   (PMM_LIMIT / PAGE_SIZE)

Function Documentation

◆ __attribute__()

static u32 directory[1024] __attribute__ ( (aligned(4096))  )
static

◆ bit()

static int bit ( u32 *  map,
u32  n 
)
static

◆ clear()

static void clear ( u32 *  map,
u32  n 
)
static

◆ memory_init()

void memory_init ( void  )

◆ memory_print_info()

void memory_print_info ( void  )

◆ memory_print_map()

void memory_print_map ( void  )

◆ memory_stats()

memory_stats_t memory_stats ( void  )

◆ pmm_alloc_page()

u32 pmm_alloc_page ( void  )

◆ pmm_free_page()

int pmm_free_page ( u32  address)

◆ set()

static void set ( u32 *  map,
u32  n 
)
static

◆ vmm_map_page()

int vmm_map_page ( u32  va,
u32  pa,
u32  flags 
)

◆ vmm_space_create()

u32 vmm_space_create ( void  )

◆ vmm_space_destroy()

void vmm_space_destroy ( u32  space)

◆ vmm_space_switch()

void vmm_space_switch ( u32  space)

◆ vmm_translate()

u32 vmm_translate ( u32  va)

◆ vmm_unmap_page()

int vmm_unmap_page ( u32  va)

◆ vmm_user_page()

int vmm_user_page ( u32  space,
u32  address,
int  writable 
)

◆ vmm_user_physical()

u32 vmm_user_physical ( u32  space,
u32  address,
int  write 
)

Variable Documentation

◆ cursor

u32 cursor = 256
static

◆ owned

u32 owned[FRAMES/32]
static

◆ regions

memory_region_t regions[64]
static

◆ stats

memory_stats_t stats
static

◆ used

u32 used[FRAMES/32]
static