diff options
author | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2025-07-27 15:33:22 +0200 |
---|---|---|
committer | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2025-07-27 15:33:22 +0200 |
commit | efb1cf0895d6c5019f5a88fa14b59afd030fefca (patch) | |
tree | 24fe5d99faad9eeed625d0ef1a6edea65482e246 /src/interrupt.c | |
parent | b5a24778844f41e38168d97761d72cf0d5b400b3 (diff) |
Setup descriptor tables, and enable interrupts
Diffstat (limited to 'src/interrupt.c')
-rw-r--r-- | src/interrupt.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/interrupt.c b/src/interrupt.c new file mode 100644 index 0000000..97bc921 --- /dev/null +++ b/src/interrupt.c @@ -0,0 +1,41 @@ +#include "aplos.h" + +static char8_t *descriptions[256] = { + [0] = u8"divide-by-zero-error", + [1] = u8"debug", + [2] = u8"non-maskable-interrupt", + [3] = u8"breakpoint", + [4] = u8"overflow", + [5] = u8"bound-range", + [6] = u8"invalid-opcode", + [7] = u8"device-not-available", + [8] = u8"double-fault", + [9] = u8"coprocessor-segment-overrun", + [10] = u8"invalid-tss", + [11] = u8"segment-not-present", + [12] = u8"stack", + [13] = u8"general-protection", + [14] = u8"page-fault", + [16] = u8"x87 floating-point exception-pending", + [17] = u8"alignment-check", + [18] = u8"machine-check", + [19] = u8"simd floating-point", + [21] = u8"control protection", + [28] = u8"hypervisor injection exception", + [29] = u8"vmm communication exception", + [30] = u8"security exception", +}; + +void +interrupt_handler(uint8_t n) +{ + char8_t *desc = descriptions[n]; + + print(u8"Got interrupt: %u8", n); + if(desc) + print(u8" (%s)", desc); + print(u8"\n"); + panic(); +} + + |