We should disable sie before trapping back to user.

This commit is contained in:
Yifan Wu 2022-03-10 16:27:05 -08:00
parent 26f44233f6
commit ba611a1458
8 changed files with 43 additions and 33 deletions

View file

@ -36,9 +36,14 @@ impl Condvar {
}
pub fn wait_no_sched(&self) -> *mut TaskContext {
/*
self.inner.exclusive_session(|inner| {
inner.wait_queue.push_back(current_task().unwrap());
});
*/
let mut inner = self.inner.exclusive_access();
inner.wait_queue.push_back(current_task().unwrap());
drop(inner);
block_current_task()
}

View file

@ -3,6 +3,7 @@ use core::ops::{Deref, DerefMut};
use riscv::register::sstatus;
use lazy_static::*;
/*
/// Wrap a static data structure inside it so that we are
/// able to access it without any `unsafe`.
///
@ -30,6 +31,7 @@ impl<T> UPSafeCell<T> {
self.inner.borrow_mut()
}
}
*/
pub struct UPSafeCellRaw<T> {
inner: UnsafeCell<T>,
@ -105,10 +107,12 @@ impl<T> UPIntrFreeCell<T> {
UPIntrRefMut(Some(self.inner.borrow_mut()))
}
/*
pub fn exclusive_session<F, V>(&self, f: F) -> V where F: FnOnce(&mut T) -> V {
let mut inner = self.exclusive_access();
f(inner.deref_mut())
}
*/
}
impl<'a, T> Drop for UPIntrRefMut<'a, T> {