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
Macros | Functions
handler.c File Reference

Exception and interrupt handler utilities used during early boot. More...

#include "icu/icu.h"
#include "utils/kprintf.h"
#include <stdint.h>
Include dependency graph for handler.c:

Macros

#define ESR_EC_SHIFT   26U
 
#define ESR_EC_MASK   0x3FU
 
#define ESR_EC_IABT_LOW   0x20U
 
#define ESR_EC_IABT_CUR   0x21U
 
#define ESR_EC_DABT_LOW   0x24U
 
#define ESR_EC_DABT_CUR   0x25U
 
#define ESR_ISS_WNR_BIT   (1U << 6)
 

Functions

void exit (uint32_t code)
 Exit the guest environment with a semihosting code.
 
void generic_handler (void)
 Generic exception handler used during early bring-up.
 
void el1_irq_handler (void)
 EL1 IRQ exception handler.
 

Detailed Description

Exception and interrupt handler utilities used during early boot.

This file contains a simple generic exception handler used during early bring-up to report the current exception level and stack pointer selection, then halt to avoid returning to the faulting context.

Author
Abhin Parekadan Jose
Date
2026-05-16

Macro Definition Documentation

◆ ESR_EC_DABT_CUR

#define ESR_EC_DABT_CUR   0x25U

Data Abort from current EL

◆ ESR_EC_DABT_LOW

#define ESR_EC_DABT_LOW   0x24U

Data Abort from lower EL

◆ ESR_EC_IABT_CUR

#define ESR_EC_IABT_CUR   0x21U

Instruction Abort from current EL

◆ ESR_EC_IABT_LOW

#define ESR_EC_IABT_LOW   0x20U

Instruction Abort from lower EL

◆ ESR_EC_MASK

#define ESR_EC_MASK   0x3FU

Mask for extracting exception class

◆ ESR_EC_SHIFT

#define ESR_EC_SHIFT   26U

Shift for extracting exception class

◆ ESR_ISS_WNR_BIT

#define ESR_ISS_WNR_BIT   (1U << 6)

ISS[6]: Write-not-Read

Function Documentation

◆ el1_irq_handler()

void el1_irq_handler ( void  )

EL1 IRQ exception handler.

Entry point invoked from the IRQ vector in the exception vector table. Delegates to the ICU dispatch layer to acknowledge, dispatch, and signal EOI for the pending interrupt.

◆ exit()

void exit ( uint32_t  code)
extern

Exit the guest environment with a semihosting code.

Uses the ARM semihosting SYS_EXIT operation to terminate execution under QEMU and report the provided status code to the host.

Parameters
codeHost-visible exit status.

◆ generic_handler()

void generic_handler ( void  )

Generic exception handler used during early bring-up.

Prints register context and fault information for a trapped exception, then halts the kernel by invoking the exit path.