mirror of
https://github.com/subhobhai943/SUB-OS.git
synced 2026-10-26 00:52:50 +00:00
Initial commit: SUB-OS 64-Bit Production Monolithic Operating System with LazyBox userland suite
This commit is contained in:
commit
cd9c786d14
88 files changed
+7132
No files matched your search
@@ -0,0 +1,33 @@
|
||||
#include <kernel/panic.h>
|
||||
#include <kernel/printk.h>
|
||||
#include <drivers/tty.h>
|
||||
#include <arch/x86_64/io.h>
|
||||
|
||||
void panic_with_regs(const char* message, const registers_t* regs) {
|
||||
cli();
|
||||
|
||||
printk("\n" ANSI_BRIGHT_RED "================================================================================" ANSI_RESET "\n");
|
||||
printk(ANSI_BRIGHT_RED " *** KERNEL PANIC - SYSTEM HALTED *** " ANSI_RESET "\n");
|
||||
printk(ANSI_BRIGHT_RED "================================================================================" ANSI_RESET "\n\n");
|
||||
printk(ANSI_BRIGHT_WHITE "Reason: " ANSI_YELLOW "%s" ANSI_RESET "\n\n", message ? message : "Unknown Fault");
|
||||
|
||||
if (regs) {
|
||||
printk(ANSI_BRIGHT_CYAN "CPU Register State (x86_64 AMD64 ABI):" ANSI_RESET "\n");
|
||||
printk(" RIP: %016llx CS: %04llx RFLAGS: %016llx\n", regs->rip, regs->cs, regs->rflags);
|
||||
printk(" RSP: %016llx SS: %04llx RBP: %016llx\n", regs->rsp, regs->ss, regs->rbp);
|
||||
printk(" RAX: %016llx RBX: %016llx RCX: %016llx RDX: %016llx\n", regs->rax, regs->rbx, regs->rcx, regs->rdx);
|
||||
printk(" RSI: %016llx RDI: %016llx R8: %016llx R9: %016llx\n", regs->rsi, regs->rdi, regs->r8, regs->r9);
|
||||
printk(" R10: %016llx R11: %016llx R12: %016llx R13: %016llx\n", regs->r10, regs->r11, regs->r12, regs->r13);
|
||||
printk(" R14: %016llx R15: %016llx ERR: %016llx INT: %llu\n", regs->r14, regs->r15, regs->error_code, regs->int_no);
|
||||
}
|
||||
|
||||
printk("\n" ANSI_BRIGHT_YELLOW "Please power off or reset your system." ANSI_RESET "\n");
|
||||
|
||||
while (1) {
|
||||
hlt();
|
||||
}
|
||||
}
|
||||
|
||||
void panic(const char* message) {
|
||||
panic_with_regs(message, NULL);
|
||||
}
|
||||
Reference in new issue
Block a user