]>
git.dujemihanovic.xyz Git - nameless-os.git/blob - include/arch/x86/irq/idt.h
5 #include <irq/interrupt.h>
7 #define IDT_VECTOR_COUNT 256 /* our IDT will have 256 vectors */
8 #define IDT_DESCRIPTOR_SIZE 8 /* each IDT descriptor is 8 bytes long */
10 #define IDT_TRAP_GATE 0xF
11 #define IDT_INTERRUPT_GATE 0xE
13 struct idt_descriptor
{
14 uint16_t offset_1
; /* bits 0-15 of offset */
15 uint16_t segsel
; /* segment selector */
16 unsigned unused
: 8, type
: 5, dpl
: 2, present
: 1;
17 uint16_t offset_2
; /* bits 16-31 of offset */
18 } __attribute__((packed
));
21 uint16_t limit
; /* size of IDT minus 1 */
22 uint32_t base
; /* starting address of IDT */
23 } __attribute__((packed
));
25 extern void idt_set_descriptor(struct idt_descriptor
*idt
, uint8_t vector
, uint16_t segment
, void (*offset
)(void), uint8_t type
, uint8_t dpl
);
26 extern inline void load_idt(struct idtr idtr
);
27 extern inline void populate_idtr(struct idtr
*idtr
, struct idt_descriptor
*idt
);