Make the load function safe

This commit is contained in:
Philipp Oppermann
2016-05-27 21:21:52 +02:00
parent 8540d3844b
commit 13e94de7b4
2 changed files with 3 additions and 3 deletions

View File

@@ -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) };
} }
} }

View File

@@ -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() -> ! {