adds an idt

This commit is contained in:
2025-05-29 11:33:40 -04:00
parent df4a508066
commit e87e6e3871
4 changed files with 125 additions and 0 deletions

View 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