Kernelite 0.1.0
Kernelite is a minimalist, educational operating system kernel built from scratch. The project aims to recreate core components of the Linux architecture to explore the fundamentals of operating system design and hardware-software interaction.
Loading...
Searching...
No Matches
Functions | Variables
mem_layout.c File Reference

Implementation of memory layout utilities. More...

#include "mem_layout/mem_layout.h"
Include dependency graph for mem_layout.c:

Functions

void update_kernel_base_va (void)
 Update the kernel base virtual address.
 
phy_addr va_to_pa (virt_addr v_addr)
 Convert a virtual address to a physical address.
 
virt_addr pa_to_va (phy_addr p_addr)
 Convert a physical address to a virtual address.
 

Variables

static virt_addr kernel_base_va = 0
 Base virtual address for the kernel. initially set to 0 until we map the kernel to high memory.
 

Detailed Description

Implementation of memory layout utilities.

Provides functions for managing the kernel's memory layout.

Author
Abhin Parekadan Jose
Date
2026-05-25

Function Documentation

◆ pa_to_va()

virt_addr pa_to_va ( phy_addr  p_addr)

Convert a physical address to a virtual address.

Parameters
p_addrThe physical address to convert.
Returns
The corresponding virtual address.

◆ va_to_pa()

phy_addr va_to_pa ( virt_addr  v_addr)

Convert a virtual address to a physical address.

Parameters
v_addrThe virtual address to convert.
Returns
The corresponding physical address.