replaced spin::Mutex with sync::SpinLock, now spinlock works well.

master
maoyuchaxue 6 years ago
parent 6df13c57ca
commit f27fd37d82

@ -1,7 +1,7 @@
use consts::KERNEL_OFFSET; use consts::KERNEL_OFFSET;
use core::ptr::Unique; use core::ptr::Unique;
use core::fmt; use core::fmt;
use spin::Mutex; use sync::SpinLock as Mutex;
use volatile::Volatile; use volatile::Volatile;
use x86_64::instructions::port::Port; use x86_64::instructions::port::Port;
use logging::Color; use logging::Color;

@ -2,7 +2,7 @@ use simple_filesystem::*;
use alloc::boxed::Box; use alloc::boxed::Box;
#[cfg(target_arch = "x86_64")] #[cfg(target_arch = "x86_64")]
use arch::driver::ide; use arch::driver::ide;
use spin::Mutex; use sync::SpinLock as Mutex;
// Hard link user program // Hard link user program
#[cfg(target_arch = "riscv32")] #[cfg(target_arch = "riscv32")]

@ -1,7 +1,8 @@
pub use arch::paging::*; pub use arch::paging::*;
use bit_allocator::{BitAlloc, BitAlloc4K, BitAlloc64K}; use bit_allocator::{BitAlloc, BitAlloc4K, BitAlloc64K};
use consts::MEMORY_OFFSET; use consts::MEMORY_OFFSET;
use spin::{Mutex, MutexGuard}; use sync::{MutexGuard, Spin};
use sync::SpinLock as Mutex;
use super::HEAP_ALLOCATOR; use super::HEAP_ALLOCATOR;
use ucore_memory::{*, paging::PageTable}; use ucore_memory::{*, paging::PageTable};
use ucore_memory::cow::CowExt; use ucore_memory::cow::CowExt;
@ -48,7 +49,7 @@ lazy_static! {
} }
/// The only way to get active page table /// The only way to get active page table
pub fn active_table() -> MutexGuard<'static, CowExt<ActivePageTable>> { pub fn active_table() -> MutexGuard<'static, CowExt<ActivePageTable>, Spin> {
ACTIVE_TABLE.lock() ACTIVE_TABLE.lock()
} }

Loading…
Cancel
Save