kornos/kernel/src/arch/x86_64/idt.h

23 lines
672 B
C

#include <stdint.h>
struct IDTDescr {
uint16_t offset_1; // offset bits 0..15
uint16_t selector; // a code segment selector in GDT or LDT
uint8_t ist; // bits 0..2 holds Interrupt Stack Table offset, rest of bits zero.
uint8_t type_attr; // type and attributes
uint16_t offset_2; // offset bits 16..31
uint32_t offset_3; // offset bits 32..63
uint32_t zero; // reserved
};
enum GateType {
CALL64 = 0xC,
INT64 = 0xE,
TRAP64 = 0xF,
};
void init_idt();
void set_idt_ent(uint8_t index, uint64_t offset, uint8_t ist, uint8_t min_priv_level, enum GateType type);
void* get_idt_fn(uint8_t index);
void clear_idt_ent(uint8_t index);