diff --git a/crate/bit-allocator/src/lib.rs b/crate/bit-allocator/src/lib.rs index 28f1d5d..325e74e 100644 --- a/crate/bit-allocator/src/lib.rs +++ b/crate/bit-allocator/src/lib.rs @@ -134,6 +134,12 @@ fn log2(x: u16) -> usize { #[inline(always)] #[cfg(not(target_arch = "x86_64"))] fn log2(x: u16) -> usize { + log2_naive(x) +} + +#[cfg(not(target_arch = "x86_64"))] +#[inline(always)] +fn log2_naive(mut x: u16) -> usize { //a naive implement assert_ne!(x, 0); let mut pos = -1; @@ -148,6 +154,7 @@ fn log2(x: u16) -> usize { mod tests { use super::*; + #[cfg(not(target_arch = "x86_64"))] #[test] fn log2_() { for x in 1..=0xffff { diff --git a/kernel/src/arch/aarch64/board/raspi3/irq.rs b/kernel/src/arch/aarch64/board/raspi3/irq.rs index d8730dc..9575e29 100644 --- a/kernel/src/arch/aarch64/board/raspi3/irq.rs +++ b/kernel/src/arch/aarch64/board/raspi3/irq.rs @@ -1,6 +1,5 @@ use crate::arch::interrupt::TrapFrame; use bcm2837::interrupt::Controller; -use log::*; pub use bcm2837::interrupt::Interrupt; diff --git a/kernel/src/arch/aarch64/memory.rs b/kernel/src/arch/aarch64/memory.rs index 1ba7a67..13996fe 100644 --- a/kernel/src/arch/aarch64/memory.rs +++ b/kernel/src/arch/aarch64/memory.rs @@ -5,7 +5,7 @@ use ucore_memory::PAGE_SIZE; use atags::atags::Atags; use aarch64::{barrier, regs::*, addr::*}; use aarch64::paging::{PhysFrame as Frame, memory_attribute::*}; -use crate::memory::{FRAME_ALLOCATOR, init_heap, MemoryArea, MemoryAttr, MemorySet, Linear}; +use crate::memory::{FRAME_ALLOCATOR, init_heap, MemoryAttr, MemorySet, Linear}; /// Memory initialization. pub fn init() { diff --git a/kernel/src/arch/aarch64/paging.rs b/kernel/src/arch/aarch64/paging.rs index 8173681..8bfee47 100644 --- a/kernel/src/arch/aarch64/paging.rs +++ b/kernel/src/arch/aarch64/paging.rs @@ -1,8 +1,6 @@ //! Page table implementations for aarch64. -use ucore_memory::memory_set::*; -use ucore_memory::PAGE_SIZE; use ucore_memory::paging::*; -use aarch64::asm::{tlb_invalidate, tlb_invalidate_all, flush_icache_all, ttbr_el1_read, ttbr_el1_write}; +use aarch64::asm::{tlb_invalidate, tlb_invalidate_all, ttbr_el1_read, ttbr_el1_write}; use aarch64::{PhysAddr, VirtAddr}; use aarch64::paging::{Mapper, PageTable as Aarch64PageTable, PageTableEntry, PageTableFlags as EF, RecursivePageTable}; use aarch64::paging::{FrameAllocator, FrameDeallocator, Page, PhysFrame as Frame, Size4KiB, Size2MiB, Size1GiB};