|
|
@ -8,6 +8,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
extern TextOutput& term;
|
|
|
|
extern TextOutput& term;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static constexpr unsigned InterruptCount = 49;
|
|
|
|
|
|
|
|
|
|
|
|
static constexpr std::uint8_t TaskGate = 0x5;
|
|
|
|
static constexpr std::uint8_t TaskGate = 0x5;
|
|
|
|
static constexpr std::uint8_t IntrGate16 = 0x6;
|
|
|
|
static constexpr std::uint8_t IntrGate16 = 0x6;
|
|
|
|
static constexpr std::uint8_t TrapGate16 = 0x7;
|
|
|
|
static constexpr std::uint8_t TrapGate16 = 0x7;
|
|
|
@ -25,7 +27,7 @@ struct idt_entry_bits {
|
|
|
|
std::uint32_t offset_high : 16;
|
|
|
|
std::uint32_t offset_high : 16;
|
|
|
|
} __attribute__((packed));
|
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
|
|
|
|
static std::array<Callback, 48> callbacks;
|
|
|
|
static std::array<Callback, InterruptCount> callbacks;
|
|
|
|
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
extern "C"
|
|
|
|
void interruptGeneralHandler(Registers regs)
|
|
|
|
void interruptGeneralHandler(Registers regs)
|
|
|
@ -91,10 +93,12 @@ struct StubEntry
|
|
|
|
static auto idt =
|
|
|
|
static auto idt =
|
|
|
|
[]<std::size_t... ints>(std::index_sequence<ints...>) {
|
|
|
|
[]<std::size_t... ints>(std::index_sequence<ints...>) {
|
|
|
|
return std::array<idt_entry_bits, 256> { StubEntry<ints>()... };
|
|
|
|
return std::array<idt_entry_bits, 256> { StubEntry<ints>()... };
|
|
|
|
}(std::make_index_sequence<48>{});
|
|
|
|
}(std::make_index_sequence<InterruptCount>{});
|
|
|
|
|
|
|
|
|
|
|
|
void idt_initialize()
|
|
|
|
void idt_initialize()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
idt[0x28].dpl = 3;
|
|
|
|
|
|
|
|
|
|
|
|
auto idtr = reinterpret_cast<std::uint64_t>(idt.data());
|
|
|
|
auto idtr = reinterpret_cast<std::uint64_t>(idt.data());
|
|
|
|
idtr <<= 16;
|
|
|
|
idtr <<= 16;
|
|
|
|
idtr |= idt.size() * sizeof(idt[0]);
|
|
|
|
idtr |= idt.size() * sizeof(idt[0]);
|
|
|
|