LumaOS
v0.1.116
An experimental x86-64 OS
Theme:
Default
Round
Robot
Loading...
Searching...
No Matches
idt.h
Go to the documentation of this file.
1
9
10
#ifndef KERNEL_ARCH_X86_64_IDT_H
11
#define KERNEL_ARCH_X86_64_IDT_H
12
13
#include <stdint.h>
14
16
struct
interrupt_frame
{
17
uint64_t r15, r14, r13, r12, r11, r10, r9, r8, rbp, rdi, rsi, rdx, rcx, rbx, rax;
18
uint64_t vector, error_code;
19
uint64_t rip, cs, rflags, rsp, ss;
// pushed by the CPU
20
};
21
22
_Static_assert
(
sizeof
(
struct
interrupt_frame
) == 176,
"Interrupt Frame must be 176 bytes"
);
23
25
struct
__attribute__((packed)) idt_entry {
26
uint16_t offset_low;
27
uint16_t selector;
28
uint8_t ist;
29
uint8_t type_attr;
30
uint16_t offset_mid;
31
uint32_t offset_high;
32
uint32_t reserved;
33
};
34
_Static_assert
(
sizeof
(
struct
idt_entry) == 16,
"IDT entry must be 16 bytes"
);
35
37
struct
__attribute__((packed)) idtr {
39
uint16_t limit;
41
uint64_t base;
42
};
43
44
_Static_assert
(
sizeof
(
struct
idtr) == 10,
"IDTR must be 10 bytes"
);
45
46
extern
const
char
*
idt_exception_table
[];
47
extern
uint64_t isr_stub_table[48];
48
53
void
exception_handler
(
struct
interrupt_frame
*frame);
54
58
void
init_idt
(
void
);
59
68
void
idt_set_gate
(
int
vector, uint64_t handler, uint16_t selector, uint8_t ist, uint8_t type_attr);
69
70
#endif
idt_exception_table
const char * idt_exception_table[]
List of exceptions as strings.
Definition
idt.c:24
init_idt
void init_idt(void)
Initializes the IDT and loads it.
Definition
idt.c:172
exception_handler
void exception_handler(struct interrupt_frame *frame)
Prints information about an exception.
Definition
idt.c:63
idt_set_gate
void idt_set_gate(int vector, uint64_t handler, uint16_t selector, uint8_t ist, uint8_t type_attr)
Sets a gate (entry) for the idt.
Definition
idt.c:188
interrupt_frame
The frame holding the registers when an interrupt happens.
Definition
idt.h:16
kernel
src
include
arch
x86_64
idt.h
Generated by
1.15.0