|
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.
|
Main kernel entry point and primitive UART driver. More...
#include "allocator/kalloc.h"#include "allocator/page_allocator.h"#include "asm/asm_helper.h"#include "drivers/uart.h"#include "fdt/fdt.h"#include "icu/icu.h"#include "linker/symbols.h"#include "mem_layout/mem_layout.h"#include "mmu/mmu.h"#include "page_table/page_table.h"#include "timer/timer.h"#include "utils/kprintf.h"#include "utils/string.h"#include "utils/utils.h"#include <libfdt.h>#include <stdbool.h>#include <stdint.h>#include <stdio.h>
Functions | |
| void | switch_to_high_va (void) |
| Switch to high virtual addresses. | |
| static void | uart0_putchar (char chr) |
| UART0 Character Output Function. | |
| static void | timer_tick_handler (void *priv) |
| Test handler invoked on every system timer tick. | |
| static void | setup_system_timer (const void *fdt) |
| Configure the system timer to tick once per second. | |
| static void | high_half_main (phy_addr fdt_addr) |
| High-half kernel entry, executed AFTER the switch to high VAs. | |
| int | main (const uint64_t *boot_args_ptr) |
| Kernel Main Entry Point. | |
Variables | |
| static uart_device_t | uart0 |
| uint64_t | boot_args [4] |
| Captured bootloader arguments. | |
Main kernel entry point and primitive UART driver.
Handles early kernel initialization, UART setup, FDT parsing, page allocator bootstrapping, and the transition into the kernel runtime loop.
|
static |
High-half kernel entry, executed AFTER the switch to high VAs.
Must be a separate, non-inlined function so that all PC-relative address materialisation (e.g. &uart0_putchar) happens while the PC is already in the high VA range. It must never return into the low-VA boot/exit path once TTBR0 is disabled.
Never returns: after initialization it parks the core in an infinite wfi loop. The trailing exit(0) is unreachable and exists only to satisfy the compiler/static analysis that every path terminates.
| fdt_addr | Physical address of the Device Tree Blob, passed through from main(). |
| int main | ( | const uint64_t * | boot_args_ptr | ) |
Kernel Main Entry Point.
Called from primary_entry (boot.s) after the stack has been initialized and the BSS section has been cleared.
| boot_args_ptr | Pointer to an array containing the bootloader arguments passed in registers x0-x3. |
|
static |
Configure the system timer to tick once per second.
| fdt | Pointer to the Flattened Device Tree (FDT) blob, which may be used to discover timer properties and configuration. |
|
static |
Test handler invoked on every system timer tick.
Registered as the tick handler via setup_sys_timer() to verify that the timer driver correctly fires once per configured period.
| priv | Unused; registered with NULL private data. |
|
static |
UART0 Character Output Function.
This function is designed to be used as the 'putc' function in the serial_t structure for kprintf. It abstracts the hardware-specific details of writing a character to the UART0 data register.
| chr | The character to be transmitted over UART0. |
| uint64_t boot_args[4] |
Captured bootloader arguments.
boot.s only ever saves x0 into boot_args[0]; boot_args[1..3] are never written and simply read as 0 because the array lives in zeroed BSS.
|
static |
Global UART0 device instance