diff options
author | Danny Holman <dholman@gymli.xyz> | 2021-10-09 15:26:32 -0500 |
---|---|---|
committer | Danny Holman <dholman@gymli.xyz> | 2021-10-09 15:39:59 -0500 |
commit | 376ec895110deb142a9162984e50ad6f0616758e (patch) | |
tree | aada41ecfa65615e2aaf8264b51eda53c4f7c6aa /arch/i386/include | |
parent | c4845de1e4ba49ba066e5729814fdb5bcd7e46f8 (diff) |
arch: i386: include more information in IDT
Include information about the current stack frame in the IDT handler(s).
Signed-off-by: Danny Holman <dholman@gymli.xyz>
Diffstat (limited to 'arch/i386/include')
-rw-r--r-- | arch/i386/include/kernel/idt.h | 19 | ||||
-rw-r--r-- | arch/i386/include/kernel/isr.h | 27 |
2 files changed, 35 insertions, 11 deletions
diff --git a/arch/i386/include/kernel/idt.h b/arch/i386/include/kernel/idt.h index 7ccad30..699eb96 100644 --- a/arch/i386/include/kernel/idt.h +++ b/arch/i386/include/kernel/idt.h @@ -4,14 +4,14 @@ #include <stdint.h> // IDT Flags -#define SEGMENT_PRESENT 0x8 -#define SEGMENT_RING0 0x0 -#define SEGMENT_STORAGE 0x0 -#define SEGMENT_GATE 0xE -#define SEGMENT_DPL 0x8 +#define SEGMENT_PRESENT 0x80 +#define SEGMENT_RING0 0x00 +#define SEGMENT_RING3 0x60 +#define SEGMENT_STORAGE 0x00 +#define SEGMENT_INTERRUPT 0x0E +#define IDT_EXCEPTION (SEGMENT_PRESENT | SEGMENT_INTERRUPT) -#define SEGMENT_FLAG SEGMENT_PRESENT | SEGMENT_RING0 | SEGMENT_STORAGE |\ - SEGMENT_GATE | SEGMENT_DPL; +#define IDT_MAX_DESCRIPTORS 256 struct idt_entry { uint16_t isr_low; @@ -26,10 +26,9 @@ struct idt_ptr { uint32_t base; } __attribute__((packed)); -extern struct idt_entry idt[256]; +extern struct idt_entry idt[IDT_MAX_DESCRIPTORS]; extern struct idt_ptr idtr; extern void idt_set_gate(uint8_t num, void(*handler)(void), uint16_t cs, uint8_t flags); -extern void exception_handler(int num); -#endif
\ No newline at end of file +#endif diff --git a/arch/i386/include/kernel/isr.h b/arch/i386/include/kernel/isr.h index a924cd6..61fe22f 100644 --- a/arch/i386/include/kernel/isr.h +++ b/arch/i386/include/kernel/isr.h @@ -1,6 +1,31 @@ #ifndef I386_ISR_H #define I386_ISR_H +#include <stdint.h> + +struct isr_frame { + uint32_t cr4; + uint32_t cr3; + uint32_t cr2; + uint32_t cr0; + + uint32_t edi; + uint32_t esi; + uint32_t edx; + uint32_t ecx; + uint32_t ebx; + uint32_t eax; + + uint32_t ebp; + uint32_t vector; + uint32_t errno; + uint32_t eip; + uint32_t cs; + uint32_t eflags; + uint32_t esp; + uint32_t dss; +} __attribute__((packed)); + extern void isr_stub_0(void); extern void isr_stub_1(void); extern void isr_stub_2(void); @@ -34,4 +59,4 @@ extern void isr_stub_29(void); extern void isr_stub_30(void); extern void isr_stub_31(void); -#endif
\ No newline at end of file +#endif |