kernel panic and trapping :)

This commit is contained in:
Liam Kerr 2026-02-08 22:41:38 +00:00
parent fae2e42f8f
commit da95a4acfa
5 changed files with 70 additions and 1 deletions

16
src/kernel/panic.h Normal file
View file

@ -0,0 +1,16 @@
#ifndef PANIC_H
#define PANIC_H
void kpanic(const char *reason);
void kpanic_force();
#define KASSERT(cond, msg) \
if (!(cond)) { \
kprint("ASSERTION FAILED: "); \
kprint(__FILE__); \
kprint(":"); \
/* Note: Printing line numbers requires a custom itoa/printf */ \
kpanic(msg); \
}
#endif