OurOS 0.1
Operating System built by McGill Students
 
Loading...
Searching...
No Matches
kalloc.c File Reference
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <stdbool.h>
#include "kernel/mm/frame.h"
#include "kernel/mm/vmalloc.h"
#include "kernel/limine_responses.h"
#include "kernel/panic.h"
#include "kernel/mm/kalloc.h"

Functions

size_t page_align_up (size_t addr)
 Rounds up the given address to the nearest page boundary.
 
size_t page_align_down (size_t addr)
 Rounds down the given address to the nearest page boundary.
 
void * hhdm_physical_to_virtual (size_t phys)
 Converts a physical address to a virtual address according to the Higher Half Direct Mapping (HHDM) scheme.
 
size_t hhdm_virtual_to_physical (void *virt)
 Converts a virtual address to a physical address according to the Higher Half Direct Mapping (HHDM) scheme.
 
void kalloc_init ()
 Initializes the kernel memory allocator.
 

Variables

static size_t hhdm_offset
 The offset used for Higher Half Direct Mapping (HHDM).
 

Function Documentation

◆ hhdm_physical_to_virtual()

void * hhdm_physical_to_virtual ( size_t  phys)

Converts a physical address to a virtual address according to the Higher Half Direct Mapping (HHDM) scheme.

Parameters
physThe physical address to convert.
Returns
The virtual address.

◆ hhdm_virtual_to_physical()

size_t hhdm_virtual_to_physical ( void *  virt)

Converts a virtual address to a physical address according to the Higher Half Direct Mapping (HHDM) scheme.

Parameters
virtThe virtual address to convert.
Returns
The physical address.

◆ kalloc_init()

void kalloc_init ( void  )

Initializes the kernel memory allocator.

◆ page_align_down()

size_t page_align_down ( size_t  addr)

Rounds down the given address to the nearest page boundary.

Parameters
addrThe address to align.
Returns
The aligned address.

◆ page_align_up()

size_t page_align_up ( size_t  addr)

Rounds up the given address to the nearest page boundary.

Parameters
addrThe address to align.
Returns
The aligned address.

Variable Documentation

◆ hhdm_offset

size_t hhdm_offset
static

The offset used for Higher Half Direct Mapping (HHDM).