diff --git a/src/acpi/gtdt.rs b/src/acpi/gtdt.rs index 7c11973384..1c5743c299 100644 --- a/src/acpi/gtdt.rs +++ b/src/acpi/gtdt.rs @@ -2,7 +2,7 @@ use alloc::boxed::Box; use super::{find_sdt, sdt::Sdt}; use crate::{ - device::generic_timer::GenericTimer, + arch::device::generic_timer::GenericTimer, dtb::irqchip::{register_irq, IRQ_CHIP}, }; diff --git a/src/acpi/madt/arch/aarch64.rs b/src/acpi/madt/arch/aarch64.rs index 4222cc9f26..2fa4968327 100644 --- a/src/acpi/madt/arch/aarch64.rs +++ b/src/acpi/madt/arch/aarch64.rs @@ -2,7 +2,7 @@ use alloc::{boxed::Box, vec::Vec}; use super::{Madt, MadtEntry}; use crate::{ - device::irqchip::{ + arch::device::irqchip::{ gic::{GenericInterruptController, GicCpuIf, GicDistIf}, gicv3::{GicV3, GicV3CpuIf}, }, diff --git a/src/acpi/madt/arch/x86.rs b/src/acpi/madt/arch/x86.rs index 2cf7763131..bcc3ce23bc 100644 --- a/src/acpi/madt/arch/x86.rs +++ b/src/acpi/madt/arch/x86.rs @@ -4,14 +4,15 @@ use core::{ }; use crate::{ - arch::start::KernelArgsAp, + arch::{ + device::local_apic::the_local_apic, + start::{kstart_ap, KernelArgsAp}, + }, cpu_set::LogicalCpuId, - device::local_apic::the_local_apic, memory::{ allocate_p2frame, Frame, KernelMapper, Page, PageFlags, PhysicalAddress, RmmA, RmmArch, VirtualAddress, PAGE_SIZE, }, - start::kstart_ap, AP_READY, }; diff --git a/src/acpi/spcr.rs b/src/acpi/spcr.rs index a478d3aa4e..5f55f1edb5 100644 --- a/src/acpi/spcr.rs +++ b/src/acpi/spcr.rs @@ -1,6 +1,6 @@ use super::{find_sdt, sdt::Sdt, GenericAddressStructure}; use crate::{ - device::serial::COM1, + arch::device::serial::COM1, devices::{serial::SerialKind, uart_pl011}, log::LOG, memory::{map_device_memory, PhysicalAddress, PAGE_SIZE}, @@ -87,7 +87,7 @@ impl Spcr { if (spcr.interrupt_type & INTERRUPT_TYPE_GIC) == INTERRUPT_TYPE_GIC { #[cfg(target_arch = "aarch64")] unsafe { - crate::device::serial::init_acpi(spcr.gsiv); + crate::arch::device::serial::init_acpi(spcr.gsiv); } } } else { diff --git a/src/arch/aarch64/debug.rs b/src/arch/aarch64/debug.rs index 163be713df..b66a081c2e 100644 --- a/src/arch/aarch64/debug.rs +++ b/src/arch/aarch64/debug.rs @@ -1,6 +1,6 @@ use spin::MutexGuard; -use crate::{device::serial::COM1, devices::serial::SerialKind}; +use crate::{arch::device::serial::COM1, devices::serial::SerialKind}; pub struct Writer<'a> { serial: MutexGuard<'a, SerialKind>, diff --git a/src/arch/aarch64/device/cpu/mod.rs b/src/arch/aarch64/device/cpu/mod.rs index d717760c04..1b59edfd87 100644 --- a/src/arch/aarch64/device/cpu/mod.rs +++ b/src/arch/aarch64/device/cpu/mod.rs @@ -1,6 +1,6 @@ use core::fmt::{Result, Write}; -use crate::device::cpu::registers::{control_regs, id_regs}; +use crate::arch::device::cpu::registers::{control_regs, id_regs}; pub mod registers; diff --git a/src/arch/aarch64/device/generic_timer.rs b/src/arch/aarch64/device/generic_timer.rs index 0eec6dbc9c..b3c29c92f5 100644 --- a/src/arch/aarch64/device/generic_timer.rs +++ b/src/arch/aarch64/device/generic_timer.rs @@ -2,9 +2,8 @@ use alloc::boxed::Box; use super::ic_for_chip; use crate::{ - context, - context::timeout, - device::cpu::registers::control_regs, + arch::device::cpu::registers::control_regs, + context::{self, timeout}, dtb::{ get_interrupt, irqchip::{register_irq, InterruptHandler, IRQ_CHIP}, diff --git a/src/arch/aarch64/misc.rs b/src/arch/aarch64/misc.rs index 2c21f3bc8f..ac54d767f2 100644 --- a/src/arch/aarch64/misc.rs +++ b/src/arch/aarch64/misc.rs @@ -6,7 +6,7 @@ use crate::{ impl PercpuBlock { pub fn current() -> &'static Self { - unsafe { &*(crate::device::cpu::registers::control_regs::tpidr_el1() as *const Self) } + unsafe { &*(crate::arch::device::cpu::registers::control_regs::tpidr_el1() as *const Self) } } } @@ -18,6 +18,6 @@ pub unsafe fn init(cpu_id: LogicalCpuId) { virt.write(PercpuBlock::init(cpu_id)); - crate::device::cpu::registers::control_regs::tpidr_el1_write(virt as u64); + crate::arch::device::cpu::registers::control_regs::tpidr_el1_write(virt as u64); } } diff --git a/src/arch/aarch64/start.rs b/src/arch/aarch64/start.rs index 5cdccaeae8..d57368ea2c 100644 --- a/src/arch/aarch64/start.rs +++ b/src/arch/aarch64/start.rs @@ -6,7 +6,13 @@ use core::{arch::naked_asm, cell::SyncUnsafeCell, slice}; use fdt::Fdt; -use crate::{allocator, device, devices::graphical_debug, dtb, paging, startup::KernelArgs}; +use crate::{ + allocator, + arch::{device, paging}, + devices::graphical_debug, + dtb, + startup::KernelArgs, +}; /// Test of zero values in BSS. static mut BSS_TEST_ZERO: usize = 0; @@ -94,7 +100,7 @@ unsafe extern "C" fn start(args_ptr: *const KernelArgs) -> ! { // Initialize paging paging::init(); - crate::misc::init(crate::cpu_set::LogicalCpuId::new(0)); + crate::arch::misc::init(crate::cpu_set::LogicalCpuId::new(0)); // Setup kernel heap allocator::init(); diff --git a/src/arch/riscv64/debug.rs b/src/arch/riscv64/debug.rs index 163be713df..b66a081c2e 100644 --- a/src/arch/riscv64/debug.rs +++ b/src/arch/riscv64/debug.rs @@ -1,6 +1,6 @@ use spin::MutexGuard; -use crate::{device::serial::COM1, devices::serial::SerialKind}; +use crate::{arch::device::serial::COM1, devices::serial::SerialKind}; pub struct Writer<'a> { serial: MutexGuard<'a, SerialKind>, diff --git a/src/arch/riscv64/start.rs b/src/arch/riscv64/start.rs index c09a71a5cc..66590877ae 100644 --- a/src/arch/riscv64/start.rs +++ b/src/arch/riscv64/start.rs @@ -5,8 +5,12 @@ use core::{ }; use crate::{ - allocator, arch::paging, device, devices::graphical_debug, dtb::serial::init_early, - interrupt::exception_handler, startup::KernelArgs, + allocator, + arch::{device, paging}, + devices::graphical_debug, + dtb::serial::init_early, + interrupt::exception_handler, + startup::KernelArgs, }; /// Test of zero values in BSS. @@ -111,7 +115,7 @@ unsafe extern "C" fn start(args_ptr: *const KernelArgs) -> ! { paging::init(); - crate::misc::init(crate::cpu_set::LogicalCpuId::new(0)); + crate::arch::misc::init(crate::cpu_set::LogicalCpuId::new(0)); // Setup kernel heap allocator::init(); diff --git a/src/arch/x86/interrupt/handler.rs b/src/arch/x86/interrupt/handler.rs index aa7353d9f9..40c347d028 100644 --- a/src/arch/x86/interrupt/handler.rs +++ b/src/arch/x86/interrupt/handler.rs @@ -75,9 +75,9 @@ impl InterruptStack { pub fn init(&mut self) { // Always enable interrupts! self.iret.eflags = x86::bits32::eflags::EFlags::FLAGS_IF.bits() as usize; - self.iret.ss = (crate::gdt::GDT_USER_DATA << 3) | 3; - self.iret.cs = (crate::gdt::GDT_USER_CODE << 3) | 3; - self.gs = (crate::gdt::GDT_USER_GS << 3) | 3; + self.iret.ss = (crate::arch::gdt::GDT_USER_DATA << 3) | 3; + self.iret.cs = (crate::arch::gdt::GDT_USER_CODE << 3) | 3; + self.gs = (crate::arch::gdt::GDT_USER_GS << 3) | 3; } pub fn dump(&self) { self.iret.dump(); diff --git a/src/arch/x86_64/alternative.rs b/src/arch/x86_64/alternative.rs index 6198c8e3b3..b10177d79d 100644 --- a/src/arch/x86_64/alternative.rs +++ b/src/arch/x86_64/alternative.rs @@ -4,8 +4,8 @@ use spin::Once; use x86::controlregs::{Cr4, Xcr0}; use crate::{ + arch::cpuid::{cpuid, feature_info, has_ext_feat}, context::memory::PageSpan, - cpuid::{cpuid, feature_info, has_ext_feat}, memory::{KernelMapper, Page, PageFlags, VirtualAddress, PAGE_SIZE}, }; diff --git a/src/arch/x86_64/interrupt/handler.rs b/src/arch/x86_64/interrupt/handler.rs index d3b9aa8986..676747ed16 100644 --- a/src/arch/x86_64/interrupt/handler.rs +++ b/src/arch/x86_64/interrupt/handler.rs @@ -97,8 +97,8 @@ impl InterruptStack { pub fn init(&mut self) { // Always enable interrupts! self.iret.rflags = x86::bits64::rflags::RFlags::FLAGS_IF.bits() as usize; - self.iret.cs = (crate::gdt::GDT_USER_CODE << 3) | 3; - self.iret.ss = (crate::gdt::GDT_USER_DATA << 3) | 3; + self.iret.cs = (crate::arch::gdt::GDT_USER_CODE << 3) | 3; + self.iret.ss = (crate::arch::gdt::GDT_USER_DATA << 3) | 3; } pub fn frame_pointer(&self) -> usize { self.preserved.rbp @@ -417,7 +417,7 @@ macro_rules! interrupt_stack { inner = sym inner, IA32_GS_BASE = const(x86::msr::IA32_GS_BASE), - PCR_GDT_OFFSET = const(core::mem::offset_of!($crate::gdt::ProcessorControlRegion, gdt)), + PCR_GDT_OFFSET = const(core::mem::offset_of!($crate::arch::gdt::ProcessorControlRegion, gdt)), ); } }; @@ -510,7 +510,7 @@ macro_rules! interrupt_error { "iretq;", inner = sym inner, - rax_offset = const(size_of::<$crate::interrupt::handler::PreservedRegisters>() + size_of::<$crate::interrupt::handler::ScratchRegisters>() - 8), + rax_offset = const(size_of::<$crate::arch::interrupt::handler::PreservedRegisters>() + size_of::<$crate::arch::interrupt::handler::ScratchRegisters>() - 8), ); } }; diff --git a/src/arch/x86_64/misc.rs b/src/arch/x86_64/misc.rs index 62e23e6fca..91a9b71c73 100644 --- a/src/arch/x86_64/misc.rs +++ b/src/arch/x86_64/misc.rs @@ -1,8 +1,8 @@ use x86::controlregs::Cr4; use crate::{ + arch::cpuid::{cpuid, has_ext_feat}, cpu_set::LogicalCpuId, - cpuid::{cpuid, has_ext_feat}, }; pub unsafe fn init(cpu_id: LogicalCpuId) { diff --git a/src/arch/x86_shared/device/local_apic.rs b/src/arch/x86_shared/device/local_apic.rs index e17c4eeb82..b6afe02afe 100644 --- a/src/arch/x86_shared/device/local_apic.rs +++ b/src/arch/x86_shared/device/local_apic.rs @@ -5,8 +5,7 @@ use core::{ use x86::msr::*; use crate::{ - arch::cpuid::cpuid, - ipi::IpiKind, + arch::{cpuid::cpuid, ipi::IpiKind}, memory::{map_device_memory, PhysicalAddress}, percpu::PercpuBlock, }; diff --git a/src/arch/x86_shared/device/tsc.rs b/src/arch/x86_shared/device/tsc.rs index 5900285200..bfcf7a68ae 100644 --- a/src/arch/x86_shared/device/tsc.rs +++ b/src/arch/x86_shared/device/tsc.rs @@ -122,7 +122,7 @@ pub fn get_kvm_support() -> &'static Option { pub unsafe fn init() -> bool { unsafe { - let cpuid = crate::cpuid::cpuid(); + let cpuid = crate::arch::cpuid::cpuid(); if !cpuid.get_feature_info().is_some_and(|f| f.has_tsc()) { return false; } diff --git a/src/arch/x86_shared/idt.rs b/src/arch/x86_shared/idt.rs index 2260cf7ecb..500645855d 100644 --- a/src/arch/x86_shared/idt.rs +++ b/src/arch/x86_shared/idt.rs @@ -13,12 +13,14 @@ use x86::{ }; use crate::{ - cpu_set::LogicalCpuId, - interrupt::{ - irq::{__generic_interrupts_end, __generic_interrupts_start}, - *, + arch::{ + interrupt::{ + irq::{__generic_interrupts_end, __generic_interrupts_start}, + *, + }, + ipi::IpiKind, }, - ipi::IpiKind, + cpu_set::LogicalCpuId, memory::PAGE_SIZE, }; @@ -269,7 +271,8 @@ pub unsafe fn install_idt(idt_ptr: *mut Idt) { #[cfg(target_arch = "x86_64")] // TODO: x86 { - (*crate::gdt::pcr()).tss.ist[usize::from(BACKUP_IST - 1)] = idt.backup_stack_end as u64; + (*crate::arch::gdt::pcr()).tss.ist[usize::from(BACKUP_IST - 1)] = + idt.backup_stack_end as u64; } let idtr: DescriptorTablePointer = DescriptorTablePointer { @@ -350,6 +353,9 @@ impl IdtEntry { // A function to set the offset more easily pub fn set_func(&mut self, func: unsafe extern "C" fn()) { self.set_flags(IdtFlags::PRESENT | IdtFlags::RING_0 | IdtFlags::INTERRUPT); - self.set_offset((crate::gdt::GDT_KERNEL_CODE as u16) << 3, func as usize); + self.set_offset( + (crate::arch::gdt::GDT_KERNEL_CODE as u16) << 3, + func as usize, + ); } } diff --git a/src/arch/x86_shared/interrupt/ipi.rs b/src/arch/x86_shared/interrupt/ipi.rs index 74cd40d798..20e9d436a1 100644 --- a/src/arch/x86_shared/interrupt/ipi.rs +++ b/src/arch/x86_shared/interrupt/ipi.rs @@ -1,5 +1,5 @@ use crate::{ - context, device::local_apic::the_local_apic, percpu::PercpuBlock, sync::CleanLockToken, + arch::device::local_apic::the_local_apic, context, percpu::PercpuBlock, sync::CleanLockToken, }; interrupt!(wakeup, || { diff --git a/src/arch/x86_shared/interrupt/irq.rs b/src/arch/x86_shared/interrupt/irq.rs index 1b3f455d30..a0b376bc0d 100644 --- a/src/arch/x86_shared/interrupt/irq.rs +++ b/src/arch/x86_shared/interrupt/irq.rs @@ -3,12 +3,14 @@ use core::sync::atomic::{AtomicUsize, Ordering}; use alloc::vec::Vec; use crate::{ - context::{self, timeout}, - device::{ - ioapic, local_apic, pic, pit, - serial::{COM1, COM2}, + arch::{ + device::{ + ioapic, local_apic, pic, pit, + serial::{COM1, COM2}, + }, + ipi::{ipi, IpiKind, IpiTarget}, }, - ipi::{ipi, IpiKind, IpiTarget}, + context::{self, timeout}, percpu::PercpuBlock, scheme::{irq::irq_trigger, serio::serio_input}, sync::CleanLockToken, diff --git a/src/arch/x86_shared/ipi.rs b/src/arch/x86_shared/ipi.rs index 8065825cf2..f38db763c4 100644 --- a/src/arch/x86_shared/ipi.rs +++ b/src/arch/x86_shared/ipi.rs @@ -20,7 +20,7 @@ pub enum IpiTarget { #[inline(always)] pub fn ipi(kind: IpiKind, target: IpiTarget) { - use crate::device::local_apic::the_local_apic; + use crate::arch::device::local_apic::the_local_apic; if cfg!(not(feature = "multi_core")) { return; @@ -39,7 +39,7 @@ pub fn ipi(kind: IpiKind, target: IpiTarget) { #[inline(always)] pub fn ipi_single(kind: IpiKind, target: &crate::percpu::PercpuBlock) { - use crate::device::local_apic::the_local_apic; + use crate::arch::device::local_apic::the_local_apic; if cfg!(not(feature = "multi_core")) { return; diff --git a/src/arch/x86_shared/start.rs b/src/arch/x86_shared/start.rs index c4972fbd07..7f9dc88bb3 100644 --- a/src/arch/x86_shared/start.rs +++ b/src/arch/x86_shared/start.rs @@ -5,8 +5,11 @@ use core::{arch::naked_asm, cell::SyncUnsafeCell, mem::offset_of}; use crate::{ - allocator, cpu_set::LogicalCpuId, device, devices::graphical_debug, gdt, idt, interrupt, - paging, startup::KernelArgs, + allocator, + arch::{device, gdt, idt, interrupt, paging}, + cpu_set::LogicalCpuId, + devices::graphical_debug, + startup::KernelArgs, }; /// Test of zero values in BSS. @@ -107,7 +110,7 @@ unsafe extern "C" fn start(args_ptr: *const KernelArgs, stack_end: usize) -> ! { paging::init(); #[cfg(target_arch = "x86_64")] - crate::alternative::early_init(true); + crate::arch::alternative::early_init(true); // Set up syscall instruction interrupt::syscall::init(); @@ -122,7 +125,7 @@ unsafe extern "C" fn start(args_ptr: *const KernelArgs, stack_end: usize) -> ! { // Initialize miscellaneous processor features #[cfg(target_arch = "x86_64")] - crate::misc::init(LogicalCpuId::BSP); + crate::arch::misc::init(LogicalCpuId::BSP); // Initialize devices device::init(); @@ -199,14 +202,14 @@ unsafe extern "C" fn start_ap(args_ptr: *const KernelArgsAp) -> ! { crate::profiling::init(); #[cfg(target_arch = "x86_64")] - crate::alternative::early_init(false); + crate::arch::alternative::early_init(false); // Set up syscall instruction interrupt::syscall::init(); // Initialize miscellaneous processor features #[cfg(target_arch = "x86_64")] - crate::misc::init(args.cpu_id); + crate::arch::misc::init(args.cpu_id); // Initialize devices (for AP) device::init_ap(); diff --git a/src/context/arch/x86.rs b/src/context/arch/x86.rs index 79a1bde6d1..4222b86bcb 100644 --- a/src/context/arch/x86.rs +++ b/src/context/arch/x86.rs @@ -1,7 +1,7 @@ use core::sync::atomic::AtomicBool; use crate::{ - gdt::{pcr, GDT_USER_FS, GDT_USER_GS}, + arch::gdt::{pcr, GDT_USER_FS, GDT_USER_GS}, percpu::PercpuBlock, syscall::FloatRegisters, }; @@ -137,7 +137,7 @@ impl super::Context { if self.is_current_context() { unsafe { - crate::gdt::set_userspace_io_allowed(crate::gdt::pcr(), allowed); + crate::arch::gdt::set_userspace_io_allowed(crate::arch::gdt::pcr(), allowed); } } } @@ -215,12 +215,12 @@ pub unsafe fn empty_cr3() -> rmm::PhysicalAddress { /// Switch to the next context by restoring its stack and registers pub unsafe fn switch_to(prev: &mut super::Context, next: &mut super::Context) { unsafe { - let pcr = crate::gdt::pcr(); + let pcr = crate::arch::gdt::pcr(); if let Some(ref stack) = next.kstack { - crate::gdt::set_tss_stack(pcr, stack.initial_top() as usize); + crate::arch::gdt::set_tss_stack(pcr, stack.initial_top() as usize); } - crate::gdt::set_userspace_io_allowed(pcr, next.arch.userspace_io_allowed); + crate::arch::gdt::set_userspace_io_allowed(pcr, next.arch.userspace_io_allowed); core::arch::asm!(" fxsave [{prev_fx}] diff --git a/src/context/arch/x86_64.rs b/src/context/arch/x86_64.rs index fcb3e1b0ec..6758c9fca5 100644 --- a/src/context/arch/x86_64.rs +++ b/src/context/arch/x86_64.rs @@ -107,7 +107,7 @@ impl Context { stack_top = stack_top.sub(size_of::()); stack_top .cast::() - .write(crate::interrupt::syscall::enter_usermode as usize); + .write(crate::arch::interrupt::syscall::enter_usermode as usize); } stack_top = stack_top.sub(size_of::()); @@ -155,7 +155,7 @@ impl super::Context { if self.is_current_context() { unsafe { - crate::gdt::set_userspace_io_allowed(crate::gdt::pcr(), allowed); + crate::arch::gdt::set_userspace_io_allowed(crate::arch::gdt::pcr(), allowed); } } } @@ -239,12 +239,12 @@ pub unsafe fn empty_cr3() -> rmm::PhysicalAddress { /// Switch to the next context by restoring its stack and registers pub unsafe fn switch_to(prev: &mut super::Context, next: &mut super::Context) { unsafe { - let pcr = crate::gdt::pcr(); + let pcr = crate::arch::gdt::pcr(); if let Some(ref stack) = next.kstack { - crate::gdt::set_tss_stack(pcr, stack.initial_top() as usize); + crate::arch::gdt::set_tss_stack(pcr, stack.initial_top() as usize); } - crate::gdt::set_userspace_io_allowed(pcr, next.arch.userspace_io_allowed); + crate::arch::gdt::set_userspace_io_allowed(pcr, next.arch.userspace_io_allowed); core::arch::asm!( alternative2!( diff --git a/src/main.rs b/src/main.rs index 85dd84f899..6d5a70d33f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -26,8 +26,6 @@ use core::{ use crate::context::switch::SwitchResult; -use crate::consts::*; - #[macro_use] /// Shared data structures mod common; @@ -39,7 +37,7 @@ mod macros; #[macro_use] #[allow(dead_code)] // TODO mod arch; -use crate::arch::*; +use crate::arch::{consts::*, interrupt, ipi, stop, CurrentRmmArch}; /// Offset of physmap #[cfg_attr(any(target_arch = "x86", target_arch = "x86_64"), expect(dead_code))] const PHYS_OFFSET: usize = ::PHYS_OFFSET; diff --git a/src/panic.rs b/src/panic.rs index cddbd9a993..50c05dcaa6 100644 --- a/src/panic.rs +++ b/src/panic.rs @@ -15,9 +15,11 @@ use rmm::VirtualAddress; use rustc_demangle::demangle; use crate::{ - arch::{consts::USER_END_OFFSET, interrupt::trace::StackTrace}, + arch::{ + consts::USER_END_OFFSET, + interrupt::{self, trace::StackTrace, InterruptStack}, + }, context, cpu_id, - interrupt::{self, InterruptStack}, memory::KernelMapper, sync::CleanLockToken, syscall::{self, usercopy::UserSliceRo}, diff --git a/src/percpu.rs b/src/percpu.rs index 4837f5c043..7838fd212b 100644 --- a/src/percpu.rs +++ b/src/percpu.rs @@ -45,7 +45,7 @@ pub struct PercpuBlock { pub syscall_debug_info: Cell, - pub misc_arch_info: crate::device::ArchPercpuMisc, + pub misc_arch_info: crate::arch::device::ArchPercpuMisc, pub stats: CpuStats, pub contexts: RwLock>, diff --git a/src/profiling.rs b/src/profiling.rs index bbd14f630d..88db842d4a 100644 --- a/src/profiling.rs +++ b/src/profiling.rs @@ -7,16 +7,16 @@ use core::{ use alloc::boxed::Box; +#[cfg(feature = "profiling")] +use crate::{ + arch::idt::Idt, + interrupt::{self, irq::aux_timer, InterruptStack}, +}; use crate::{ cpu_set::LogicalCpuId, percpu::PercpuBlock, syscall::{error::*, usercopy::UserSliceWo}, }; -#[cfg(feature = "profiling")] -use crate::{ - idt::Idt, - interrupt::{self, irq::aux_timer, InterruptStack}, -}; const N: usize = 16 * 1024 * 1024; @@ -237,11 +237,15 @@ pub fn maybe_run_profiling_helper_forever(cpu_id: LogicalCpuId) { } unsafe { for i in 33..255 { - crate::idt::IDTS.write().get_mut(&cpu_id).unwrap().entries[i] + crate::arch::idt::IDTS + .write() + .get_mut(&cpu_id) + .unwrap() + .entries[i] .set_func(crate::interrupt::ipi::wakeup); } - let apic = &mut crate::device::local_apic::the_local_apic(); + let apic = &mut crate::arch::device::local_apic::the_local_apic(); apic.set_lvt_timer((0b01 << 17) | 32); apic.set_div_conf(0b1011); apic.set_init_count(0xffff_f); diff --git a/src/scheme/sys/cpu.rs b/src/scheme/sys/cpu.rs index 878b0a64a7..7c8bf983af 100644 --- a/src/scheme/sys/cpu.rs +++ b/src/scheme/sys/cpu.rs @@ -1,7 +1,7 @@ use alloc::vec::Vec; use crate::{ - device::cpu::cpu_info, + arch::device::cpu::cpu_info, sync::CleanLockToken, syscall::error::{Error, Result, EIO}, };