|
1 | 1 | #include <fuzzy/kernel/panic.h> |
| 2 | +#include <fuzzy/memmgr/tables/gdt.h> |
| 3 | +#include <fuzzy/kernel/process/process.h> |
| 4 | + |
| 5 | +extern struct GDTEntry gdt_table[]; |
2 | 6 |
|
3 | 7 | extern void _interrupt_handler_0x00_exception(); |
4 | 8 | extern void _interrupt_handler_0x01_exception(); |
@@ -33,7 +37,37 @@ extern void _interrupt_handler_0x1D_exception(); |
33 | 37 | extern void _interrupt_handler_0x1E_exception(); |
34 | 38 | extern void _interrupt_handler_0x1F_exception(); |
35 | 39 |
|
36 | | -void interrupt_handler_0x00_0x1F_exception(int id, int ip, int cs) { |
| 40 | +void interrupt_handler_0x00_0x1F_exception(int id, int err_code, int ds, int ss, int ip, int cs, int eflag) { |
| 41 | + panic_screen_init(); |
| 42 | + unsigned int abs_address = |
| 43 | + print_log("Hardware exception %d (0x%x) triggered", id, id); |
| 44 | + print_log(" Error Code: %x or %x", err_code); |
| 45 | + print_log(" CS : %x (GDT entry)", cs); |
| 46 | + print_log(" DS : %x (GDT entry)", ds); |
| 47 | + print_log(" SS : %x (GDT entry)", ss); |
| 48 | + print_log(" IP : %x", ip); |
| 49 | + print_log(" FLAG : %x", eflag); |
| 50 | + if(cs%sizeof(struct GDTEntry)==0) { |
| 51 | + print_log(" PID : %d", get_idt_reverse_pid_lookup_cs(cs)); |
| 52 | + unsigned int abs_cs = get_gdt_baseaddress(gdt_table, GDT_TABLE_SIZE, cs/sizeof(struct GDTEntry)); |
| 53 | + print_log(" abs IP: %x", abs_cs+ip); |
| 54 | + print_log(" abs CS: %x", abs_cs); |
| 55 | + } else { |
| 56 | + print_log(" PID : invalid"); |
| 57 | + print_log(" abs IP: invalid"); |
| 58 | + print_log(" abs CS: invalid"); |
| 59 | + } |
| 60 | + if(ds%sizeof(struct GDTEntry)==0) { |
| 61 | + print_log(" abs DS: %x", get_gdt_baseaddress(gdt_table, GDT_TABLE_SIZE, ds/sizeof(struct GDTEntry))); |
| 62 | + } else { |
| 63 | + print_log(" abs DS: invalid"); |
| 64 | + } |
| 65 | + if(ss%sizeof(struct GDTEntry)==0) { |
| 66 | + print_log(" abs SS: %x", get_gdt_baseaddress(gdt_table, GDT_TABLE_SIZE, ss/sizeof(struct GDTEntry))); |
| 67 | + } else { |
| 68 | + print_log(" abs SS: invalid"); |
| 69 | + } |
| 70 | + |
37 | 71 | switch (id) { |
38 | 72 | case 0x0D: |
39 | 73 | PANIC(id, "[hw_exception] general_protection_fault"); |
|
0 commit comments