2023-10-13 14:11:23 +03:00
|
|
|
#include <BAN/Array.h>
|
2023-01-25 19:05:47 +02:00
|
|
|
#include <BAN/Errors.h>
|
|
|
|
#include <kernel/IDT.h>
|
|
|
|
#include <kernel/InterruptController.h>
|
2023-07-23 18:33:10 +03:00
|
|
|
#include <kernel/InterruptStack.h>
|
2023-04-14 13:30:21 +03:00
|
|
|
#include <kernel/Memory/kmalloc.h>
|
2023-01-25 19:05:47 +02:00
|
|
|
#include <kernel/Panic.h>
|
2023-05-06 00:10:15 +03:00
|
|
|
#include <kernel/Process.h>
|
2023-04-03 01:51:05 +03:00
|
|
|
#include <kernel/Scheduler.h>
|
2023-08-04 10:22:20 +03:00
|
|
|
#include <kernel/Timer/PIT.h>
|
2023-01-25 19:05:47 +02:00
|
|
|
|
2023-10-13 14:11:23 +03:00
|
|
|
#define ISR_LIST_X X(0) X(1) X(2) X(3) X(4) X(5) X(6) X(7) X(8) X(9) X(10) X(11) X(12) X(13) X(14) X(15) X(16) X(17) X(18) X(19) X(20) X(21) X(22) X(23) X(24) X(25) X(26) X(27) X(28) X(29) X(30) X(31)
|
2024-03-09 23:53:38 +02:00
|
|
|
#define IRQ_LIST_X X(0) X(1) X(2) X(3) X(4) X(5) X(6) X(7) X(8) X(9) X(10) X(11) X(12) X(13) X(14) X(15) X(16) X(17) X(18) X(19) X(20) X(21) X(22) X(23) X(24) X(25) X(26) X(27) X(28) X(29) X(30) X(31) X(32)
|
2023-01-25 19:05:47 +02:00
|
|
|
|
2024-03-06 00:45:54 +02:00
|
|
|
namespace Kernel
|
2023-01-25 19:05:47 +02:00
|
|
|
{
|
|
|
|
|
2023-01-30 18:52:38 +02:00
|
|
|
struct Registers
|
|
|
|
{
|
|
|
|
uint64_t rsp;
|
|
|
|
uint64_t rip;
|
|
|
|
uint64_t rflags;
|
|
|
|
uint64_t cr4;
|
|
|
|
uint64_t cr3;
|
|
|
|
uint64_t cr2;
|
|
|
|
uint64_t cr0;
|
|
|
|
|
|
|
|
uint64_t r15;
|
|
|
|
uint64_t r14;
|
|
|
|
uint64_t r13;
|
|
|
|
uint64_t r12;
|
|
|
|
uint64_t r11;
|
|
|
|
uint64_t r10;
|
|
|
|
uint64_t r9;
|
|
|
|
uint64_t r8;
|
|
|
|
uint64_t rsi;
|
|
|
|
uint64_t rdi;
|
|
|
|
uint64_t rbp;
|
|
|
|
uint64_t rdx;
|
|
|
|
uint64_t rcx;
|
|
|
|
uint64_t rbx;
|
|
|
|
uint64_t rax;
|
|
|
|
};
|
|
|
|
|
2023-10-13 14:11:23 +03:00
|
|
|
#define X(num) 1 +
|
|
|
|
static BAN::Array<Interruptable*, IRQ_LIST_X 0> s_interruptables;
|
|
|
|
#undef X
|
2023-01-25 19:05:47 +02:00
|
|
|
|
2023-06-18 23:24:27 +03:00
|
|
|
enum ISR
|
|
|
|
{
|
|
|
|
DivisionError,
|
|
|
|
Debug,
|
|
|
|
NonMaskableInterrupt,
|
|
|
|
Breakpoint,
|
|
|
|
Overflow,
|
|
|
|
BoundRangeException,
|
|
|
|
InvalidOpcode,
|
|
|
|
DeviceNotAvailable,
|
|
|
|
DoubleFault,
|
|
|
|
CoprocessorSegmentOverrun,
|
|
|
|
InvalidTSS,
|
|
|
|
SegmentNotPresent,
|
|
|
|
StackSegmentFault,
|
|
|
|
GeneralProtectionFault,
|
|
|
|
PageFault,
|
|
|
|
UnknownException0x0F,
|
|
|
|
x87FloatingPointException,
|
|
|
|
AlignmentCheck,
|
|
|
|
MachineCheck,
|
|
|
|
SIMDFloatingPointException,
|
|
|
|
VirtualizationException,
|
|
|
|
ControlProtectionException,
|
|
|
|
UnknownException0x16,
|
|
|
|
UnknownException0x17,
|
|
|
|
UnknownException0x18,
|
|
|
|
UnknownException0x19,
|
|
|
|
UnknownException0x1A,
|
|
|
|
UnknownException0x1B,
|
|
|
|
HypervisorInjectionException,
|
|
|
|
VMMCommunicationException,
|
|
|
|
SecurityException,
|
|
|
|
UnkownException0x1F,
|
|
|
|
};
|
|
|
|
|
2023-09-28 21:07:14 +03:00
|
|
|
struct PageFaultError
|
|
|
|
{
|
|
|
|
union
|
|
|
|
{
|
|
|
|
uint32_t raw;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
uint32_t present : 1;
|
|
|
|
uint32_t write : 1;
|
|
|
|
uint32_t userspace : 1;
|
|
|
|
uint32_t reserved_write : 1;
|
|
|
|
uint32_t instruction : 1;
|
|
|
|
uint32_t protection_key : 1;
|
|
|
|
uint32_t shadow_stack : 1;
|
|
|
|
uint32_t reserved1 : 8;
|
|
|
|
uint32_t sgx_violation : 1;
|
|
|
|
uint32_t reserved2 : 16;
|
|
|
|
};
|
|
|
|
};
|
2024-01-24 14:43:46 +02:00
|
|
|
|
2023-09-28 21:07:14 +03:00
|
|
|
};
|
|
|
|
static_assert(sizeof(PageFaultError) == 4);
|
|
|
|
|
2023-01-25 19:05:47 +02:00
|
|
|
static const char* isr_exceptions[] =
|
|
|
|
{
|
|
|
|
"Division Error",
|
|
|
|
"Debug",
|
|
|
|
"Non-maskable Interrupt",
|
|
|
|
"Breakpoint",
|
|
|
|
"Overflow",
|
|
|
|
"Bound Range Exception",
|
|
|
|
"Invalid Opcode",
|
|
|
|
"Device Not Available",
|
|
|
|
"Double Fault",
|
|
|
|
"Coprocessor Segment Overrun",
|
|
|
|
"Invalid TSS",
|
|
|
|
"Segment Not Present",
|
|
|
|
"Stack-Segment Fault",
|
|
|
|
"General Protection Fault",
|
|
|
|
"Page Fault",
|
|
|
|
"Unknown Exception 0x0F",
|
|
|
|
"x87 Floating-Point Exception",
|
|
|
|
"Alignment Check",
|
|
|
|
"Machine Check",
|
|
|
|
"SIMD Floating-Point Exception",
|
|
|
|
"Virtualization Exception",
|
|
|
|
"Control Protection Exception",
|
|
|
|
"Unknown Exception 0x16",
|
|
|
|
"Unknown Exception 0x17",
|
|
|
|
"Unknown Exception 0x18",
|
|
|
|
"Unknown Exception 0x19",
|
|
|
|
"Unknown Exception 0x1A",
|
|
|
|
"Unknown Exception 0x1B",
|
|
|
|
"Hypervisor Injection Exception",
|
|
|
|
"VMM Communication Exception",
|
|
|
|
"Security Exception",
|
|
|
|
"Unkown Exception 0x1F",
|
|
|
|
};
|
|
|
|
|
2023-10-05 18:53:45 +03:00
|
|
|
extern "C" void cpp_isr_handler(uint64_t isr, uint64_t error, InterruptStack& interrupt_stack, const Registers* regs)
|
2023-01-25 19:05:47 +02:00
|
|
|
{
|
2024-03-04 11:41:54 +02:00
|
|
|
if (g_paniced)
|
|
|
|
{
|
|
|
|
dprintln("Processor {} halted", Processor::current_id());
|
2024-03-15 13:45:01 +02:00
|
|
|
InterruptController::get().broadcast_ipi();
|
2024-03-04 11:41:54 +02:00
|
|
|
asm volatile("cli; 1: hlt; jmp 1b");
|
|
|
|
}
|
|
|
|
|
2023-09-23 02:28:25 +03:00
|
|
|
#if __enable_sse
|
2023-08-01 14:23:50 +03:00
|
|
|
bool from_userspace = (interrupt_stack.cs & 0b11) == 0b11;
|
|
|
|
if (from_userspace)
|
2023-10-05 18:53:45 +03:00
|
|
|
Thread::current().save_sse();
|
2023-09-23 02:28:25 +03:00
|
|
|
#endif
|
2023-07-31 22:28:57 +03:00
|
|
|
|
2023-10-05 18:53:45 +03:00
|
|
|
pid_t tid = Scheduler::current_tid();
|
|
|
|
pid_t pid = tid ? Process::current().pid() : 0;
|
2023-05-30 08:00:17 +03:00
|
|
|
|
2023-10-05 18:53:45 +03:00
|
|
|
if (tid)
|
2023-09-28 21:07:14 +03:00
|
|
|
{
|
2023-10-05 18:53:45 +03:00
|
|
|
Thread::current().set_return_rsp(interrupt_stack.rsp);
|
|
|
|
Thread::current().set_return_rip(interrupt_stack.rip);
|
2023-09-28 21:07:14 +03:00
|
|
|
|
2023-10-05 18:53:45 +03:00
|
|
|
if (isr == ISR::PageFault)
|
2023-09-28 21:07:14 +03:00
|
|
|
{
|
2023-10-05 18:53:45 +03:00
|
|
|
// Check if stack is OOB
|
|
|
|
auto& stack = Thread::current().stack();
|
2023-10-30 12:17:08 +02:00
|
|
|
auto& istack = Thread::current().interrupt_stack();
|
|
|
|
if (stack.vaddr() < interrupt_stack.rsp && interrupt_stack.rsp <= stack.vaddr() + stack.size())
|
|
|
|
; // using normal stack
|
|
|
|
else if (istack.vaddr() < interrupt_stack.rsp && interrupt_stack.rsp <= istack.vaddr() + istack.size())
|
|
|
|
; // using interrupt stack
|
|
|
|
else
|
2023-10-05 18:53:45 +03:00
|
|
|
{
|
2023-10-30 12:17:08 +02:00
|
|
|
derrorln("Stack pointer out of bounds!");
|
2024-01-03 02:08:01 +02:00
|
|
|
derrorln("rip {H}", interrupt_stack.rip);
|
2023-10-30 12:17:08 +02:00
|
|
|
derrorln("rsp {H}, stack {H}->{H}, istack {H}->{H}",
|
|
|
|
interrupt_stack.rsp,
|
|
|
|
stack.vaddr(), stack.vaddr() + stack.size(),
|
|
|
|
istack.vaddr(), istack.vaddr() + istack.size()
|
|
|
|
);
|
|
|
|
Thread::current().handle_signal(SIGKILL);
|
2023-10-05 18:53:45 +03:00
|
|
|
goto done;
|
|
|
|
}
|
2023-09-28 21:07:14 +03:00
|
|
|
|
2023-10-05 18:53:45 +03:00
|
|
|
// Try demand paging on non present pages
|
|
|
|
PageFaultError page_fault_error;
|
|
|
|
page_fault_error.raw = error;
|
|
|
|
if (!page_fault_error.present)
|
2023-09-28 21:07:14 +03:00
|
|
|
{
|
2023-10-05 18:53:45 +03:00
|
|
|
asm volatile("sti");
|
|
|
|
auto result = Process::current().allocate_page_for_demand_paging(regs->cr2);
|
|
|
|
asm volatile("cli");
|
|
|
|
|
|
|
|
if (!result.is_error() && result.value())
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
if (result.is_error())
|
|
|
|
{
|
|
|
|
dwarnln("Demand paging: {}", result.error());
|
2023-10-30 12:17:08 +02:00
|
|
|
Thread::current().handle_signal(SIGKILL);
|
2023-10-05 18:53:45 +03:00
|
|
|
goto done;
|
|
|
|
}
|
2023-09-28 21:07:14 +03:00
|
|
|
}
|
|
|
|
}
|
2024-01-03 02:06:49 +02:00
|
|
|
#if __enable_sse
|
|
|
|
else if (isr == ISR::DeviceNotAvailable)
|
|
|
|
{
|
|
|
|
asm volatile(
|
|
|
|
"movq %cr0, %rax;"
|
|
|
|
"andq $~(1 << 3), %rax;"
|
|
|
|
"movq %rax, %cr0;"
|
|
|
|
);
|
|
|
|
if (auto* current = &Thread::current(); current != Thread::sse_thread())
|
|
|
|
{
|
|
|
|
if (auto* sse = Thread::sse_thread())
|
|
|
|
sse->save_sse();
|
|
|
|
current->load_sse();
|
|
|
|
}
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
#endif
|
2023-09-28 21:07:14 +03:00
|
|
|
}
|
|
|
|
|
2023-10-05 18:53:45 +03:00
|
|
|
if (PageTable::current().get_page_flags(interrupt_stack.rip & PAGE_ADDR_MASK) & PageTable::Flags::Present)
|
2023-09-25 20:33:07 +03:00
|
|
|
{
|
2023-10-05 18:53:45 +03:00
|
|
|
auto* machine_code = (const uint8_t*)interrupt_stack.rip;
|
2023-09-25 20:33:07 +03:00
|
|
|
dwarnln("While executing: {2H}{2H}{2H}{2H}{2H}{2H}{2H}{2H}",
|
|
|
|
machine_code[0],
|
|
|
|
machine_code[1],
|
|
|
|
machine_code[2],
|
|
|
|
machine_code[3],
|
|
|
|
machine_code[4],
|
|
|
|
machine_code[5],
|
|
|
|
machine_code[6],
|
|
|
|
machine_code[7]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-05-28 20:53:10 +03:00
|
|
|
dwarnln(
|
2023-05-06 00:10:15 +03:00
|
|
|
"{} (error code: 0x{16H}), pid {}, tid {}\r\n"
|
2023-01-25 19:05:47 +02:00
|
|
|
"Register dump\r\n"
|
|
|
|
"rax=0x{16H}, rbx=0x{16H}, rcx=0x{16H}, rdx=0x{16H}\r\n"
|
2023-01-30 18:52:38 +02:00
|
|
|
"rsp=0x{16H}, rbp=0x{16H}, rdi=0x{16H}, rsi=0x{16H}\r\n"
|
|
|
|
"rip=0x{16H}, rflags=0x{16H}\r\n"
|
2023-05-28 20:53:10 +03:00
|
|
|
"cr0=0x{16H}, cr2=0x{16H}, cr3=0x{16H}, cr4=0x{16H}",
|
2023-05-30 08:00:17 +03:00
|
|
|
isr_exceptions[isr], error, pid, tid,
|
2023-01-30 18:52:38 +02:00
|
|
|
regs->rax, regs->rbx, regs->rcx, regs->rdx,
|
|
|
|
regs->rsp, regs->rbp, regs->rdi, regs->rsi,
|
|
|
|
regs->rip, regs->rflags,
|
|
|
|
regs->cr0, regs->cr2, regs->cr3, regs->cr4
|
2023-01-25 19:05:47 +02:00
|
|
|
);
|
2023-09-25 20:33:07 +03:00
|
|
|
if (isr == ISR::PageFault)
|
2023-10-05 18:53:45 +03:00
|
|
|
PageTable::current().debug_dump();
|
2023-09-11 01:20:55 +03:00
|
|
|
Debug::dump_stack_trace();
|
2023-05-28 20:53:10 +03:00
|
|
|
|
2023-10-05 18:53:45 +03:00
|
|
|
if (tid && Thread::current().is_userspace())
|
2023-05-28 20:53:10 +03:00
|
|
|
{
|
2023-07-30 14:17:39 +03:00
|
|
|
// TODO: Confirm and fix the exception to signal mappings
|
|
|
|
|
|
|
|
int signal = 0;
|
|
|
|
switch (isr)
|
|
|
|
{
|
|
|
|
case ISR::DivisionError:
|
|
|
|
case ISR::SIMDFloatingPointException:
|
|
|
|
case ISR::x87FloatingPointException:
|
|
|
|
signal = SIGFPE;
|
|
|
|
break;
|
|
|
|
case ISR::AlignmentCheck:
|
|
|
|
signal = SIGBUS;
|
|
|
|
break;
|
|
|
|
case ISR::InvalidOpcode:
|
|
|
|
signal = SIGILL;
|
|
|
|
break;
|
|
|
|
case ISR::PageFault:
|
|
|
|
signal = SIGSEGV;
|
2024-01-24 14:43:46 +02:00
|
|
|
break;
|
2023-07-30 14:17:39 +03:00
|
|
|
default:
|
|
|
|
dwarnln("Unhandled exception");
|
|
|
|
signal = SIGABRT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2023-10-05 18:53:45 +03:00
|
|
|
Thread::current().handle_signal(signal);
|
2023-05-28 20:53:10 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2023-10-05 18:53:45 +03:00
|
|
|
panic("Unhandled exception");
|
2023-05-28 20:53:10 +03:00
|
|
|
}
|
2023-07-31 22:28:18 +03:00
|
|
|
|
2023-10-05 18:53:45 +03:00
|
|
|
ASSERT(Thread::current().state() != Thread::State::Terminated);
|
2024-01-24 14:43:46 +02:00
|
|
|
|
2023-10-05 18:53:45 +03:00
|
|
|
done:
|
|
|
|
return;
|
2023-01-25 19:05:47 +02:00
|
|
|
}
|
|
|
|
|
2023-10-05 18:53:45 +03:00
|
|
|
extern "C" void cpp_irq_handler(uint64_t irq, InterruptStack& interrupt_stack)
|
2023-01-25 19:05:47 +02:00
|
|
|
{
|
2024-03-15 13:45:01 +02:00
|
|
|
if (g_paniced)
|
|
|
|
{
|
|
|
|
dprintln("Processor {} halted", Processor::current_id());
|
|
|
|
InterruptController::get().broadcast_ipi();
|
|
|
|
asm volatile("cli; 1: hlt; jmp 1b");
|
|
|
|
}
|
|
|
|
|
2023-10-05 18:53:45 +03:00
|
|
|
if (Scheduler::current_tid())
|
2023-07-23 18:33:10 +03:00
|
|
|
{
|
2023-10-05 18:53:45 +03:00
|
|
|
Thread::current().set_return_rsp(interrupt_stack.rsp);
|
|
|
|
Thread::current().set_return_rip(interrupt_stack.rip);
|
2023-07-23 18:33:10 +03:00
|
|
|
}
|
|
|
|
|
2023-08-09 09:57:02 +03:00
|
|
|
if (!InterruptController::get().is_in_service(irq))
|
|
|
|
dprintln("spurious irq 0x{2H}", irq);
|
2023-01-25 19:05:47 +02:00
|
|
|
else
|
2023-01-25 22:15:32 +02:00
|
|
|
{
|
2023-02-19 17:53:29 +02:00
|
|
|
InterruptController::get().eoi(irq);
|
2024-03-09 23:53:50 +02:00
|
|
|
if (irq == IRQ_IPI)
|
|
|
|
Scheduler::get().reschedule();
|
|
|
|
else if (auto* handler = s_interruptables[irq])
|
|
|
|
handler->handle_irq();
|
2023-08-09 09:57:02 +03:00
|
|
|
else
|
2024-03-09 23:53:50 +02:00
|
|
|
dprintln("no handler for irq 0x{2H}", irq);
|
2023-08-09 09:57:02 +03:00
|
|
|
}
|
2023-04-03 01:51:05 +03:00
|
|
|
|
2023-10-05 18:53:45 +03:00
|
|
|
Scheduler::get().reschedule_if_idling();
|
2023-07-31 22:28:18 +03:00
|
|
|
|
2023-10-05 18:53:45 +03:00
|
|
|
ASSERT(Thread::current().state() != Thread::State::Terminated);
|
2023-01-25 19:05:47 +02:00
|
|
|
}
|
|
|
|
|
2024-03-06 00:45:54 +02:00
|
|
|
void IDT::register_interrupt_handler(uint8_t index, void (*handler)())
|
2023-01-25 19:05:47 +02:00
|
|
|
{
|
2024-03-06 00:45:54 +02:00
|
|
|
auto& descriptor = m_idt[index];
|
2023-01-30 18:52:38 +02:00
|
|
|
descriptor.offset1 = (uint16_t)((uint64_t)handler >> 0);
|
|
|
|
descriptor.offset2 = (uint16_t)((uint64_t)handler >> 16);
|
|
|
|
descriptor.offset3 = (uint32_t)((uint64_t)handler >> 32);
|
2023-01-25 19:05:47 +02:00
|
|
|
|
|
|
|
descriptor.selector = 0x08;
|
|
|
|
descriptor.IST = 0;
|
|
|
|
descriptor.flags = 0x8E;
|
|
|
|
}
|
|
|
|
|
2024-03-06 00:45:54 +02:00
|
|
|
void IDT::register_syscall_handler(uint8_t index, void (*handler)())
|
2023-03-13 15:32:46 +02:00
|
|
|
{
|
|
|
|
register_interrupt_handler(index, handler);
|
2024-03-06 00:45:54 +02:00
|
|
|
m_idt[index].flags = 0xEE;
|
2023-03-13 15:32:46 +02:00
|
|
|
}
|
|
|
|
|
2024-03-06 00:45:54 +02:00
|
|
|
void IDT::register_irq_handler(uint8_t irq, Interruptable* interruptable)
|
2023-01-25 19:05:47 +02:00
|
|
|
{
|
2023-10-13 14:11:23 +03:00
|
|
|
if (irq > s_interruptables.size())
|
|
|
|
Kernel::panic("Trying to assign handler for irq {} while only {} are supported", irq, s_interruptables.size());
|
2023-10-05 18:53:45 +03:00
|
|
|
s_interruptables[irq] = interruptable;
|
2023-01-25 19:05:47 +02:00
|
|
|
}
|
|
|
|
|
2023-10-13 14:11:23 +03:00
|
|
|
#define X(num) extern "C" void isr ## num();
|
|
|
|
ISR_LIST_X
|
|
|
|
#undef X
|
|
|
|
|
|
|
|
#define X(num) extern "C" void irq ## num();
|
|
|
|
IRQ_LIST_X
|
|
|
|
#undef X
|
2023-01-25 19:05:47 +02:00
|
|
|
|
2023-03-13 15:32:46 +02:00
|
|
|
extern "C" void syscall_asm();
|
|
|
|
|
2024-03-09 23:49:31 +02:00
|
|
|
IDT* IDT::create()
|
2023-01-25 19:05:47 +02:00
|
|
|
{
|
2024-03-06 00:45:54 +02:00
|
|
|
auto* idt = new IDT();
|
|
|
|
ASSERT(idt);
|
2023-01-25 19:05:47 +02:00
|
|
|
|
2024-03-06 00:45:54 +02:00
|
|
|
memset(idt->m_idt.data(), 0x00, 0x100 * sizeof(GateDescriptor));
|
2023-01-25 19:05:47 +02:00
|
|
|
|
2024-03-06 00:45:54 +02:00
|
|
|
#define X(num) idt->register_interrupt_handler(num, isr ## num);
|
2023-10-13 14:11:23 +03:00
|
|
|
ISR_LIST_X
|
|
|
|
#undef X
|
|
|
|
|
2024-03-06 00:45:54 +02:00
|
|
|
#define X(num) idt->register_interrupt_handler(IRQ_VECTOR_BASE + num, irq ## num);
|
2024-03-09 23:49:31 +02:00
|
|
|
IRQ_LIST_X
|
2023-10-13 14:11:23 +03:00
|
|
|
#undef X
|
2023-01-25 19:05:47 +02:00
|
|
|
|
2024-03-06 00:45:54 +02:00
|
|
|
idt->register_syscall_handler(0x80, syscall_asm);
|
|
|
|
|
|
|
|
return idt;
|
2023-01-25 19:05:47 +02:00
|
|
|
}
|
|
|
|
|
2024-03-06 00:45:54 +02:00
|
|
|
[[noreturn]] void IDT::force_triple_fault()
|
2023-09-28 12:48:52 +03:00
|
|
|
{
|
|
|
|
// load 0 sized IDT and trigger an interrupt to force triple fault
|
2024-03-07 16:05:29 +02:00
|
|
|
Processor::set_interrupt_state(InterruptState::Disabled);
|
|
|
|
Processor::idt().m_idtr.size = 0;
|
|
|
|
Processor::idt().load();
|
2023-09-28 12:48:52 +03:00
|
|
|
asm volatile("int $0x00");
|
|
|
|
ASSERT_NOT_REACHED();
|
|
|
|
}
|
|
|
|
|
2023-10-05 18:53:45 +03:00
|
|
|
}
|