mirror of
https://git.stationery.faith/corn/corn.git
synced 2024-11-21 19:02:17 +00:00
panic
This commit is contained in:
parent
00bc8cdb97
commit
e57c64c0e9
2 changed files with 26 additions and 0 deletions
8
include/panic.h
Normal file
8
include/panic.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#define _PANIC_STR(x) _PANIC_STR2(x)
|
||||
#define _PANIC_STR2(x) #x
|
||||
|
||||
#define panic(msg) _panic_impl(_PANIC_STR(__LINE__), __FILE__, msg)
|
||||
|
||||
_Noreturn void _panic_impl(char *line, char *file, char *msg);
|
18
src/arch/amd64/panic.c
Normal file
18
src/arch/amd64/panic.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include <panic.h>
|
||||
|
||||
#include "serial.h"
|
||||
#include "bindings.h"
|
||||
|
||||
_Noreturn void _panic_impl(char *line, char *file, char *msg) {
|
||||
cli();
|
||||
serial_out_str("\n\n!!! PANIC !!!\n");
|
||||
serial_out_str(msg);
|
||||
serial_out_str("\nin file ");
|
||||
serial_out_str(file);
|
||||
serial_out_str(" at line ");
|
||||
serial_out_str(line);
|
||||
serial_out('\n');
|
||||
while (1) {
|
||||
halt();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue