panic improvements

This commit is contained in:
Liam Kerr 2026-02-09 00:37:28 +00:00
parent 1a3259b811
commit 6aca680609
2 changed files with 5 additions and 7 deletions

View file

@ -14,9 +14,6 @@ void kmain() {
kprint("Stress testing memory...\n");
while(1) {
void *p = page_alloc();
if (p == NULL) {
kpanic("Expected OOM reached!");
}
}
poweroff();

View file

@ -4,8 +4,9 @@
#include <syscon/syscon.h>
void kpanic(const char *reason){
kprint("\n!!! PANIC!!!\n");
kprint(reason);
kputs("\n!!! PANIC !!!\n");
kputs(reason);
kputs("\n!!! PANIC !!!\n");
poweroff();
}
@ -15,10 +16,10 @@ void kpanic_force() {
// 'ebreak' is the standard RISC-V way to trigger a debug trap.
__asm__ volatile("ebreak");
// 3. If no debugger is attached or we continue, kill the VM
kprint("Force panic falled. Power off. \n");
poweroff();
// 4. Final halt
kprint("Force panic falled. Power off failed. sleep until interupt. \n");
while(1) {
__asm__ volatile("wfi");
}