mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Make the load function safe
This commit is contained in:
@@ -12,7 +12,7 @@ impl Idt {
|
|||||||
&mut self.0[entry as usize].options
|
&mut self.0[entry as usize].options
|
||||||
}
|
}
|
||||||
|
|
||||||
pub unsafe fn load(&'static self) {
|
pub fn load(&'static self) {
|
||||||
use x86::dtables::{DescriptorTablePointer, lidt};
|
use x86::dtables::{DescriptorTablePointer, lidt};
|
||||||
use core::mem::size_of;
|
use core::mem::size_of;
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ impl Idt {
|
|||||||
limit: (size_of::<Self>() - 1) as u16,
|
limit: (size_of::<Self>() - 1) as u16,
|
||||||
};
|
};
|
||||||
|
|
||||||
lidt(&ptr);
|
unsafe { lidt(&ptr) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ pub fn init() {
|
|||||||
GDT.table.load();
|
GDT.table.load();
|
||||||
gdt::reload_segment_registers(GDT.selectors.code, GDT.selectors.data);
|
gdt::reload_segment_registers(GDT.selectors.code, GDT.selectors.data);
|
||||||
gdt::load_ltr(GDT.selectors.tss);
|
gdt::load_ltr(GDT.selectors.tss);
|
||||||
IDT.load();
|
|
||||||
}
|
}
|
||||||
|
IDT.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub extern "C" fn divide_by_zero_handler() -> ! {
|
pub extern "C" fn divide_by_zero_handler() -> ! {
|
||||||
|
|||||||
Reference in New Issue
Block a user