mirror of
https://github.com/XunilGroup/XunilOS.git
synced 2026-04-25 19:59:02 +02:00
Formatted the code, made the arch code x86_64 only for now, fixed the
serial writer always centering and assuming, added a margin for correct displaying. Added the IDT and GDT tables, and the TSS so double faults cant happen. Handled all of these interrupts using functions. Serial console is now topleft and panic messages are formatted correctly from there. core PI constant is now used instead of our own.
This commit is contained in:
23
kernel/src/arch/x86_64/idt.rs
Normal file
23
kernel/src/arch/x86_64/idt.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
use crate::arch::x86_64::{
|
||||
gdt,
|
||||
interrupts::{breakpoint_handler, double_fault_handler},
|
||||
};
|
||||
use lazy_static::lazy_static;
|
||||
use x86_64::structures::idt::InterruptDescriptorTable;
|
||||
|
||||
lazy_static! {
|
||||
static ref IDT: InterruptDescriptorTable = {
|
||||
let mut idt = InterruptDescriptorTable::new();
|
||||
idt.breakpoint.set_handler_fn(breakpoint_handler);
|
||||
unsafe {
|
||||
idt.double_fault
|
||||
.set_handler_fn(double_fault_handler)
|
||||
.set_stack_index(gdt::DOUBLE_FAULT_IST_INDEX);
|
||||
}
|
||||
idt
|
||||
};
|
||||
}
|
||||
|
||||
pub fn init_idt_x86_64() {
|
||||
IDT.load();
|
||||
}
|
||||
Reference in New Issue
Block a user