42 lines
1.1 KiB
Rust
42 lines
1.1 KiB
Rust
// Copyright (c) 2025 shibedrill
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
use lazy_static::lazy_static;
|
|
use x86_64::structures::idt::*;
|
|
|
|
lazy_static! {
|
|
pub static ref IDT: InterruptDescriptorTable = {
|
|
let idt = InterruptDescriptorTable::new();
|
|
// TODO: Re-implement this once the x86-interrupt ABI is fixed.
|
|
// Alternatively: Write our own interrupt handler wrappers.
|
|
idt
|
|
};
|
|
}
|
|
|
|
// For all these handlers, they will be called from a purely naked ASM
|
|
// function. That function will first push all registers to the stack.
|
|
// It is the responsibility of these functions to recover this info.
|
|
|
|
// Recoverable exception: Occurs on division failure.
|
|
#[unsafe(no_mangle)]
|
|
pub extern "C" fn x86_divide_error() {
|
|
|
|
}
|
|
|
|
// Recoverable exception: Occurs on failure in BOUND instruction.
|
|
#[unsafe(no_mangle)]
|
|
pub extern "C" fn x86_bound_range() {
|
|
|
|
}
|
|
|
|
// Recoverable exception: Invalid opcode.
|
|
#[unsafe(no_mangle)]
|
|
pub extern "C" fn x86_invalid_opcode() {
|
|
|
|
}
|
|
|
|
// Recoverable exception: FPU not available or enabled.
|
|
#[unsafe(no_mangle)]
|
|
pub extern "C" fn x86_device_unavailable() {
|
|
|
|
} |