Iros
 
Loading...
Searching...
No Matches
idt.h
Go to the documentation of this file.
1#pragma once
2
3#include "di/bit/prelude.h"
4
5namespace iris::x86::amd64::idt {
6using namespace di::bit;
7
8// The format of the 64 bit Interrupt Descriptor Table is described
9// in the AMD64 Programmer's Manual; Volume 2; Figure 4-24, and on
10// the OSDEV wiki at the page:
11// https://wiki.osdev.org/Interrupt_Descriptor_Table#Structure_on_x86-64
12struct TargetLow : BitField<0, 16> {};
13struct SegmentSelector : BitField<16, 16> {};
14struct IST : BitField<32, 3> {};
15
16// Interrupt Gates automatically disable interrupts upon entry, while Trap Gates do not.
17// In practice, the system call vector should be made a Trap Gate, while hw IRQ handlers
18// and CPU exception handlers should be made Interrupt Gates.
19struct Type : BitField<40, 4> {
20 constexpr static u8 InterruptGate = 0b1110;
21 constexpr static u8 TrapGate = 0b1111;
22};
23
24struct DPL : BitField<45, 2> {};
25struct Present : BitFlag<47> {};
26struct TargetMid : BitField<48, 16> {};
27struct TargetHigh : BitField<64, 32> {};
28
30
31void init_idt();
32void load_idt();
33}
Definition bit_struct.h:11
__UINT8_TYPE__ u8
Definition integers.h:9
Definition idt.cpp:6
BitStruct< 16, TargetLow, SegmentSelector, IST, Type, DPL, Present, TargetMid, TargetHigh > Entry
Definition idt.h:29
void load_idt()
Definition idt.cpp:126
void init_idt()
Definition idt.cpp:111
constexpr BitField(Value value)
Definition bit_field.h:28
constexpr BitFlag(bool value)
Definition bit_flag.h:19
Definition idt.h:24
Definition idt.h:14
Definition idt.h:19
static constexpr u8 InterruptGate
Definition idt.h:20
static constexpr u8 TrapGate
Definition idt.h:21