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
Data Structures | Typedefs | Functions
utils.h File Reference

Utility functions for kernel development. More...

#include <stdbool.h>
#include <stdint.h>
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

union  mpidr_el1_t
 AArch64 Multiprocessor Affinity Register (MPIDR_EL1, read-only). More...
 

Typedefs

typedef union mpidr_el1_t mpidr_el1_t
 AArch64 Multiprocessor Affinity Register (MPIDR_EL1, read-only).
 

Functions

void print_kernelite_logo (void)
 Prints the Kernelite ASCII art logo and banner to the console.
 
uint32_t get_core_id (void)
 Gets the core id.
 
void print_current_el (void)
 Prints the current exeception level.
 
bool setup_page_allocator (const void *fdt_addr)
 Set up the global page allocator.
 

Detailed Description

Utility functions for kernel development.

This module contains utility functions for kernel development, including functions for reserving kernel image pages, setting up the global page allocator, and other helper functions used across the kernel.

Author
Abhin Parekadan Jose
Date
2026-05-25

Typedef Documentation

◆ mpidr_el1_t

typedef union mpidr_el1_t mpidr_el1_t

AArch64 Multiprocessor Affinity Register (MPIDR_EL1, read-only).

Identifies the PE within a multiprocessor system. In a simple single-cluster system (e.g. QEMU virt), Aff1/Aff2/Aff3 are 0 and Aff0 is the core number.

Compare AffinityValue (Aff3.Aff2.Aff1.Aff0) against GICR_TYPER.AffinityValue to find the Redistributor frame belonging to this PE.

Note:

  • This is a system register, not a memory-mapped register.
  • Read via mrs <Xn>, mpidr_el1.
  • Bits [63:40] are RES1 or implementation-defined; mask them before use.

Function Documentation

◆ get_core_id()

uint32_t get_core_id ( void  )

Gets the core id.

Returns
the core id.

◆ setup_page_allocator()

bool setup_page_allocator ( const void *  fdt_addr)

Set up the global page allocator.

This function initializes the global page allocator based on the memory map obtained from the Device Tree Blob (FDT).

Parameters
fdt_addrPointer to the FDT blob.
Returns
bool True if initialization was successful, false otherwise.