| 1 | #ifndef SYS__IDT_H__ |
| 2 | #define SYS__IDT_H__ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | #if defined (__i386__) |
| 7 | |
| 8 | struct idtr { |
| 9 | uint16_t limit; |
| 10 | uint32_t ptr; |
| 11 | } __attribute__((packed)); |
| 12 | |
| 13 | struct idt_entry { |
| 14 | uint16_t offset_lo; |
| 15 | uint16_t selector; |
| 16 | uint8_t unused; |
| 17 | uint8_t type_attr; |
| 18 | uint16_t offset_hi; |
| 19 | } __attribute__((packed)); |
| 20 | |
| 21 | #elif defined (__x86_64__) |
| 22 | |
| 23 | struct idtr { |
| 24 | uint16_t limit; |
| 25 | uint64_t ptr; |
| 26 | } __attribute__((packed)); |
| 27 | |
| 28 | struct idt_entry { |
| 29 | uint16_t offset_lo; |
| 30 | uint16_t selector; |
| 31 | uint8_t ist; |
| 32 | uint8_t type_attr; |
| 33 | uint16_t offset_mid; |
| 34 | uint32_t offset_hi; |
| 35 | uint32_t reserved; |
| 36 | } __attribute__((packed)); |
| 37 | |
| 38 | #endif |
| 39 | |
| 40 | #if defined (BIOS) |
| 41 | |
| 42 | extern struct idtr idt; |
| 43 | |
| 44 | void init_idt(void); |
| 45 | |
| 46 | #endif |
| 47 | |
| 48 | enum { |
| 49 | IRQ_NO_FLUSH, |
| 50 | IRQ_PIC_ONLY_FLUSH, |
| 51 | IRQ_PIC_APIC_FLUSH |
| 52 | }; |
| 53 | |
| 54 | extern int irq_flush_type; |
| 55 | |
| 56 | void init_flush_irqs(void); |
| 57 | void flush_irqs(void); |
| 58 | |
| 59 | #endif |