summaryrefslogtreecommitdiff
path: root/src/include/panic.h
diff options
context:
space:
mode:
authorBrett Weiland <brett_weiland@bpcspace.com>2021-08-24 14:09:29 -0500
committerBrett Weiland <brett_weiland@bpcspace.com>2021-08-24 14:09:29 -0500
commit9b22a6965579ea1867aea291d910c96f386b518b (patch)
treed06dbb9c4708f1cc713bcb115b32ff9bce4cf9b9 /src/include/panic.h
parentbad4b0e9bdfee336bfc1c23761408279eaec1558 (diff)
major backup 8.24.21
Diffstat (limited to 'src/include/panic.h')
-rw-r--r--src/include/panic.h60
1 files changed, 46 insertions, 14 deletions
diff --git a/src/include/panic.h b/src/include/panic.h
index 1386348..6a987f4 100644
--- a/src/include/panic.h
+++ b/src/include/panic.h
@@ -1,27 +1,59 @@
#ifndef PANIC_INCLUDED
#define PANIC_INCLUDED
-#define EASTEREGG_BLOATWARE
-
#include <stdint.h>
-void panic(int reason, int type);
+#define EASTEREGG_BLOATWARE
+
+//TODO this needs to be moved once we find somehwere better
struct stack_frame {
- struct stack_frame *next;
- uint64_t function_base;
+ struct stack_frame *next; //rbp
+ void *function_base; //rip
+} __attribute__((packed));
+
+struct registers {
+ uint64_t rax, rbx, rcx, rdx, rsi, rdi;
} __attribute__((packed));
-//kernel panic reasons, likely to grow at an extremely fast rate
-#define KERNEL_PANIC_PMAPSIZE 0
-#define KERNEL_PANIC_RSDP_UNFOUND 1
-#define KERNEL_PANIC_KERNEL_RETURNED 2
+void panic(int reason, void *frame_p, struct registers *regs);
+
+
+#define PANIC(reason) panic(reason, 0, 0)
+
+//hardware exceptions/faults
+//kernel panic reasons 0-31 reserved for these
+//later on, we can make an ugly function to find our vector.
+//I did a lot of work assuming it was pushed onto the stack,
+//so if I choose not to impliment that these defs will be deleted.
+/**
+#define KERNEL_PANIC_HWE_DE 0
+#define KERNEL_PANIC_HWE_BR 5
+#define KERNEL_PANIC_HWE_UD 6
+#define KERNEL_PANIC_HWE_NM 7
+#define KERNEL_PANIC_HWE_DF 8
+#define KERNEL_PANIC_HWE_TS 10
+#define KERNEL_PANIC_HWE_NP 11
+#define KERNEL_PANIC_HWE_SS 12
+#define KERNEL_PANIC_HWE_GP 13
+#define KERNEL_PANIC_HWE_PF 14
+#define KERNEL_PANIC_HWE_MF 16
+#define KERNEL_PANIC_HWE_AC 17
+#define KERNEL_PANIC_HWE_MC 18
+#define KERNEL_PANIC_HWE_XM 19
+#define KERNEL_PANIC_HWE_VE 20
+#define KERNEL_PANIC_HWE_SE 30
+**/
+#define KERNEL_PANIC_HW_EXCEPTION 0
+#define KERNEL_PANIC_HW_EXCEPTION_ERR 1 //exception with error code
+//kernel generated exceptions
+#define KERNEL_PANIC_RSDP_UNFOUND 32
+#define KERNEL_PANIC_KERNEL_RETURNED 33
+#define KERNEL_PANIC_INVALID_PFREE 34
+#define KERNEL_PANIC_INVALID_RSDT 35
+#define KERNEL_PANIC_INVALID_IOAPIC_VEC 36
+#define KERNEL_PANIC_HPET_REQUIRED 37
-//kernel panic types, may or may not expand once I get further in development
-#define KERNEL_PANIC_INVOKED 0
-#define KERNEL_PANIC_ERROR 1 //i'll change this once I see what happends
-//TODO move this to some kind of global more accesable header
-#define DEV_EMAIL "brett_weiland@bpcspace.com"
#endif