mirror of
https://github.com/subhobhai943/SUB-OS.git
synced 2026-10-25 16:52:29 +00:00
- Implement AArch64 HAL, vector table (16 aligned vectors), GICv2, Generic Timer, Stage-1 MMU (39-bit VA), PL011 UART - Build unified multi-architecture abstraction layer in include/arch/arch.h - Create interactive Linux-like Kconfig TUI menuconfig in scripts/kconfig/menuconfig.py - Support make menuconfig, defconfig, x86_64_defconfig, aarch64_defconfig - Update master Makefile for cross-compiling x86_64 (x86_64-elf-) and AArch64 (aarch64-linux-gnu-) - Dynamic architecture awareness across printk, uname, neofetch, and LazyBox
43 lines
1.3 KiB
C
43 lines
1.3 KiB
C
#include <arch/aarch64/arch.h>
|
|
#include <arch/aarch64/gic.h>
|
|
#include <kernel/printk.h>
|
|
|
|
void aarch64_sync_handler(aarch64_context_t* ctx) {
|
|
uint64_t esr, elr, far;
|
|
__asm__ volatile("mrs %0, esr_el1" : "=r"(esr));
|
|
__asm__ volatile("mrs %0, elr_el1" : "=r"(elr));
|
|
__asm__ volatile("mrs %0, far_el1" : "=r"(far));
|
|
|
|
uint32_t ec = (esr >> 26) & 0x3F;
|
|
printk(ANSI_BRIGHT_RED "\n[KERNEL PANIC] AArch64 Synchronous Exception!\n" ANSI_RESET);
|
|
printk("ESR_EL1: 0x%016llx (EC: 0x%02x, ISS: 0x%08x)\n", esr, ec, (uint32_t)(esr & 0x01FFFFFF));
|
|
printk("ELR_EL1 (PC): 0x%016llx FAR_EL1: 0x%016llx\n", elr, far);
|
|
printk("Registers:\n");
|
|
for (int i = 0; i < 30; i += 2) {
|
|
printk(" X%02d: 0x%016llx X%02d: 0x%016llx\n", i, ctx->r[i], i + 1, ctx->r[i + 1]);
|
|
}
|
|
printk(" X30 (LR): 0x%016llx SP: 0x%016llx\n", ctx->r[30], ctx->sp);
|
|
|
|
while (1) {
|
|
__asm__ volatile("wfe");
|
|
}
|
|
}
|
|
|
|
void aarch64_irq_handler(aarch64_context_t* ctx) {
|
|
(void)ctx;
|
|
gic_handle_irq();
|
|
}
|
|
|
|
void aarch64_fiq_handler(aarch64_context_t* ctx) {
|
|
(void)ctx;
|
|
printk(KERN_WARNING "AArch64: Unexpected FIQ caught\n");
|
|
}
|
|
|
|
void aarch64_serror_handler(aarch64_context_t* ctx) {
|
|
(void)ctx;
|
|
printk(ANSI_BRIGHT_RED "[KERNEL PANIC] AArch64 SError Interrupt caught!\n" ANSI_RESET);
|
|
while (1) {
|
|
__asm__ volatile("wfe");
|
|
}
|
|
}
|