adds an idt
This commit is contained in:
26
kernel/include/kernel/x86/idt.h
Normal file
26
kernel/include/kernel/x86/idt.h
Normal file
@ -0,0 +1,26 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef ARCH_IDT_H
|
||||
#define ARCH_IDT_H
|
||||
|
||||
#define IDT_MAX_DESCRIPTORS 32 // number of entries in the idt table, 32 i believe
|
||||
|
||||
void exception_handler(void);
|
||||
|
||||
typedef struct {
|
||||
uint16_t isr_low; // The lower 16 bits of the ISR's address
|
||||
uint16_t kernel_cs; // The GDT segment selector that the CPU will load into CS before calling the ISR
|
||||
uint8_t reserved; // set to zero
|
||||
uint8_t attributes; // Type and attributes
|
||||
uint16_t isr_high; // The higher 16 bits of the ISR's address
|
||||
} __attribute__((packed)) idt_entry_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t limit;
|
||||
uint32_t base;
|
||||
} __attribute__((packed)) idtr_t;
|
||||
|
||||
void idt_set_descriptor(uint8_t vector, void* isr, uint8_t flags);
|
||||
void idt_init(void);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user