| 1 | /* @title: Interrupt Descriptor Table */ |
|---|---|
| 2 | #pragma once |
| 3 | #include <compiler.h> |
| 4 | #include <stdbool.h> |
| 5 | #include <stdint.h> |
| 6 | |
| 7 | #define IDT_ENTRIES 256 |
| 8 | |
| 9 | struct idt_entry { |
| 10 | uint16_t base_low; |
| 11 | uint16_t selector; |
| 12 | uint8_t ist; |
| 13 | uint8_t flags; |
| 14 | uint16_t base_mid; |
| 15 | uint32_t base_high; |
| 16 | uint32_t reserved; |
| 17 | } __packed; |
| 18 | |
| 19 | struct idt_table { |
| 20 | struct idt_entry entries[IDT_ENTRIES]; |
| 21 | }; |
| 22 | |
| 23 | struct idt_ptr { |
| 24 | uint16_t limit; |
| 25 | uint64_t base; |
| 26 | } __packed; |
| 27 | |
| 28 | void irq_init(); |
| 29 | void irq_load(); |
| 30 | void idt_set_gate(uint8_t num, uint16_t sel, uint8_t flags); |
| 31 |