diff --git a/src/arch/x86/idt.rs b/src/arch/x86/idt.rs index 45a5e9e84e3c74d49dc46ee2f56a5aad57bb64fd..b97897043fae68df76dd0bb7a4af208bfcf9dc20 100644 --- a/src/arch/x86/idt.rs +++ b/src/arch/x86/idt.rs @@ -18,12 +18,6 @@ pub static mut INIT_IDTR: DescriptorTablePointer<X86IdtEntry> = DescriptorTableP base: 0 as *const X86IdtEntry }; -#[thread_local] -pub static mut IDTR: DescriptorTablePointer<X86IdtEntry> = DescriptorTablePointer { - limit: 0, - base: 0 as *const X86IdtEntry -}; - pub type IdtEntries = [IdtEntry; 256]; pub type IdtReservations = [AtomicU32; 8]; @@ -154,8 +148,10 @@ pub unsafe fn init_paging_bsp() { pub unsafe fn init_generic(is_bsp: bool, idt: &mut Idt) { let (current_idt, current_reservations) = (&mut idt.entries, &mut idt.reservations); - IDTR.limit = (current_idt.len() * mem::size_of::<IdtEntry>() - 1) as u16; - IDTR.base = current_idt.as_ptr() as *const X86IdtEntry; + let idtr: DescriptorTablePointer<X86IdtEntry> = DescriptorTablePointer { + limit: (current_idt.len() * mem::size_of::<IdtEntry>() - 1) as u16, + base: current_idt.as_ptr() as *const X86IdtEntry, + }; let backup_ist = { // We give Non-Maskable Interrupts, Double Fault, and Machine Check exceptions separate @@ -271,7 +267,7 @@ pub unsafe fn init_generic(is_bsp: bool, idt: &mut Idt) { current_idt[0x80].set_flags(IdtFlags::PRESENT | IdtFlags::RING_3 | IdtFlags::INTERRUPT); idt.set_reserved_mut(0x80, true); - dtables::lidt(&IDTR); + dtables::lidt(&idtr); } bitflags! { diff --git a/src/arch/x86_64/idt.rs b/src/arch/x86_64/idt.rs index 6063f7d2be20ad5bbafe07fe8553f4e46cf4b810..f9d3ddef78f88cf69fb4177597f613cb293d0223 100644 --- a/src/arch/x86_64/idt.rs +++ b/src/arch/x86_64/idt.rs @@ -18,12 +18,6 @@ pub static mut INIT_IDTR: DescriptorTablePointer<X86IdtEntry> = DescriptorTableP base: 0 as *const X86IdtEntry }; -#[thread_local] -pub static mut IDTR: DescriptorTablePointer<X86IdtEntry> = DescriptorTablePointer { - limit: 0, - base: 0 as *const X86IdtEntry -}; - pub type IdtEntries = [IdtEntry; 256]; pub type IdtReservations = [AtomicU64; 4]; @@ -151,8 +145,10 @@ pub unsafe fn init_paging_bsp() { pub unsafe fn init_generic(is_bsp: bool, idt: &mut Idt) { let (current_idt, current_reservations) = (&mut idt.entries, &mut idt.reservations); - IDTR.limit = (current_idt.len() * mem::size_of::<IdtEntry>() - 1) as u16; - IDTR.base = current_idt.as_ptr() as *const X86IdtEntry; + let idtr: DescriptorTablePointer<X86IdtEntry> = DescriptorTablePointer { + limit: (current_idt.len() * mem::size_of::<IdtEntry>() - 1) as u16, + base: current_idt.as_ptr() as *const X86IdtEntry, + }; let backup_ist = { // We give Non-Maskable Interrupts, Double Fault, and Machine Check exceptions separate @@ -268,7 +264,7 @@ pub unsafe fn init_generic(is_bsp: bool, idt: &mut Idt) { current_idt[0x80].set_flags(IdtFlags::PRESENT | IdtFlags::RING_3 | IdtFlags::INTERRUPT); idt.set_reserved_mut(0x80, true); - dtables::lidt(&IDTR); + dtables::lidt(&idtr); } bitflags! {