From 9566dac198f685ef947d82facee0be182a77495e Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 9 Jul 2021 18:27:47 +0200 Subject: implement basic kernel panics --- platform/asm.h | 9 +++++++++ platform/boot.s | 5 ++++- platform/sysenter.h | 4 ---- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 platform/asm.h delete mode 100644 platform/sysenter.h (limited to 'platform') diff --git a/platform/asm.h b/platform/asm.h new file mode 100644 index 0000000..6f72617 --- /dev/null +++ b/platform/asm.h @@ -0,0 +1,9 @@ +#pragma once + +// boot.s +__attribute__((noreturn)) +void halt_cpu(); + +// sysenter.c +void sysexit(void (*fun)(), void *stack_top); +void sysenter_setup(); diff --git a/platform/boot.s b/platform/boot.s index 6052347..c2a06c3 100644 --- a/platform/boot.s +++ b/platform/boot.s @@ -27,7 +27,10 @@ _start: mov $stack_top, %esp call kmain - cli /* disable interrupts */ +.global halt_cpu +.type halt_cpu, @function +halt_cpu: + cli 1: hlt jmp 1b diff --git a/platform/sysenter.h b/platform/sysenter.h deleted file mode 100644 index b0495cc..0000000 --- a/platform/sysenter.h +++ /dev/null @@ -1,4 +0,0 @@ -#pragma once - -void sysexit(void (*fun)(), void *stack_top); -void sysenter_setup(); -- cgit v1.2.3