Files
KatauOS/include/idt.h
T
2025-03-14 17:22:59 +03:00

31 lines
904 B
C

#ifndef IDT_H
#define IDT_H
#include "../include/types.h"
#include <stdint.h>
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; see the IDT page
uint16_t isr_high; // The higher 16 bits of the ISR's address
} __attribute__((packed)) idt_entry_t;
__attribute__((aligned(0x10)))
static idt_entry_t idt[256]; // Create an array of IDT entries; aligned for performance
typedef struct {
uint16_t limit;
uint32_t base;
} __attribute__((packed)) idtr_t;
static idtr_t idtr;
//void idt_init(void);
//void idt_set_descriptor(uint8_t vector, void* isr, uint8_t flags);
void idt_set_descriptor(uint8 vector, uint32 isr, uint8_t flags);
void idt_set();
#endif