:: limine / common / sys / exceptions.s2.c 1.0 KB raw

1
#include <stdint.h>
2
#include <lib/misc.h>
3
#include <lib/trace.h>
4
#include <lib/print.h>
5
6
#if defined (BIOS)
7
8
static const char *exception_names[] = {
9
    "Division",
10
    "Debug",
11
    "NMI",
12
    "Breakpoint",
13
    "Overflow",
14
    "Bound range exceeded",
15
    "Invalid opcode",
16
    "Device not available",
17
    "Double fault",
18
    "???",
19
    "Invalid TSS",
20
    "Segment not present",
21
    "Stack-segment fault",
22
    "General protection fault",
23
    "Page fault",
24
    "???",
25
    "x87",
26
    "Alignment check",
27
    "Machine check",
28
    "SIMD",
29
    "Virtualisation",
30
    "???",
31
    "???",
32
    "???",
33
    "???",
34
    "???",
35
    "???",
36
    "???",
37
    "???",
38
    "???",
39
    "Security"
40
};
41
42
void except(uint32_t exception, uint32_t error_code, uint32_t ebp, uint32_t eip) {
43
    (void)ebp;
44
    const char *exception_name = exception < SIZEOF_ARRAY(exception_names)
45
                                 ? exception_names[exception]
46
                                 : "Unknown";
47
    panic(false, "%s exception at %x. Error code: %x", exception_name, eip, error_code);
48
}
49
50
#endif
tab: 248 wrap: offon