mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-19 04:26:39 +00:00
Remove the preempt guard from the IRQ guard
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
491e4325fa
commit
be54a39592
@ -71,6 +71,11 @@ pub fn preempt(task: &Arc<Task>) {
|
||||
///
|
||||
/// If the current task's status not [`TaskStatus::Runnable`], it will not be
|
||||
/// added to the scheduler.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// This function will panic if called while holding preemption locks or with
|
||||
/// local IRQ disabled.
|
||||
fn switch_to_task(next_task: Arc<Task>) {
|
||||
let preemt_lock_count = PREEMPT_LOCK_COUNT.load();
|
||||
if preemt_lock_count != 0 {
|
||||
@ -80,6 +85,11 @@ fn switch_to_task(next_task: Arc<Task>) {
|
||||
);
|
||||
}
|
||||
|
||||
assert!(
|
||||
crate::arch::irq::is_local_enabled(),
|
||||
"Switching task with local IRQ disabled"
|
||||
);
|
||||
|
||||
let irq_guard = crate::trap::disable_local();
|
||||
|
||||
let current_task_ptr = CURRENT_TASK_PTR.load();
|
||||
|
Reference in New Issue
Block a user