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