PatchworkOS
Loading...
Searching...
No Matches
idt.h
Go to the documentation of this file.
1#pragma once
2
4#include <kernel/defs.h>
5
6#include <stdint.h>
7
22typedef enum
23{
25 IDT_ATTR_TRAP = 0b1111,
26
31
32 IDT_ATTR_PRESENT = 1 << 7
34
46
63
74
80void idt_init(void);
81
89void idt_cpu_load(void);
90
void idt_init(void)
Initialize the IDT structure in memory.
Definition idt.c:26
idt_attributes_t
IDT gate attributes.
Definition idt.h:23
void idt_cpu_load(void)
Load the IDT on the current CPU.
Definition idt.c:47
@ IDT_ATTR_PRESENT
Must be set for the entry to be valid.
Definition idt.h:32
@ IDT_ATTR_RING3
Can be invoked from ring 3 or lower.
Definition idt.h:30
@ IDT_ATTR_RING1
Can be invoked from ring 1 or lower.
Definition idt.h:28
@ IDT_ATTR_RING0
Can be invoked from ring 0 or hardware only.
Definition idt.h:27
@ IDT_ATTR_INTERRUPT
Interrupt gate, will disable interrupts when invoked.
Definition idt.h:24
@ IDT_ATTR_TRAP
Trap gate, will NOT disable interrupts when invoked.
Definition idt.h:25
@ IDT_ATTR_RING2
Can be invoked from ring 2 or lower.
Definition idt.h:29
@ INTERRUPT_AMOUNT
Definition interrupt.h:139
#define PACKED
GCC packed attribute.
Definition defs.h:32
static start_entry_t entries[START_ENTRY_MAX]
Definition start_menu.c:21
__UINT32_TYPE__ uint32_t
Definition stdint.h:15
__UINT64_TYPE__ uint64_t
Definition stdint.h:17
__UINT8_TYPE__ uint8_t
Definition stdint.h:11
__UINT16_TYPE__ uint16_t
Definition stdint.h:13
IDT descriptor structure.
Definition idt.h:42
uint16_t size
Size of the IDT in bytes - 1.
Definition idt.h:43
uint64_t offset
Address of the IDT.
Definition idt.h:44
IDT gate structure.
Definition idt.h:54
uint8_t attributes
Type and attributes, see idt_attributes_t.
Definition idt.h:58
uint32_t reserved
Definition idt.h:61
uint8_t ist
Interrupt Stack Table offset, 0 = dont use IST, see tss_t.
Definition idt.h:57
uint16_t offsetLow
Lower 16 bits of handler function address.
Definition idt.h:55
uint32_t offsetHigh
Upper 32 bits of handler function address.
Definition idt.h:60
uint16_t codeSegment
Code segment selector in the GDT.
Definition idt.h:56
uint16_t offsetMid
Middle 16 bits of handler function address.
Definition idt.h:59
IDT structure.
Definition idt.h:71