bugfix: 修复smp启动的时候,损坏0号核心的idle进程的内核栈的问题 (#711)

---------

Co-authored-by: longjin <longjin@DragonOS.org>
Co-authored-by: heyicong <heyicong@dragonos.org>
This commit is contained in:
曾俊
2024-04-10 19:00:32 +08:00
committed by GitHub
parent 9365e8017b
commit 3959e94df3
14 changed files with 69 additions and 36 deletions

View File

@ -259,7 +259,7 @@ pub fn schedule_timeout(mut timeout: i64) -> Result<i64, SystemError> {
let irq_guard = unsafe { CurrentIrqArch::save_and_disable_irq() };
ProcessManager::mark_sleep(true).ok();
drop(irq_guard);
schedule(SchedMode::SM_PREEMPT);
schedule(SchedMode::SM_NONE);
return Ok(MAX_TIMEOUT);
} else if timeout < 0 {
kerror!("timeout can't less than 0");
@ -278,7 +278,7 @@ pub fn schedule_timeout(mut timeout: i64) -> Result<i64, SystemError> {
drop(irq_guard);
schedule(SchedMode::SM_PREEMPT);
schedule(SchedMode::SM_NONE);
let time_remaining: i64 = timeout - TIMER_JIFFIES.load(Ordering::SeqCst) as i64;
if time_remaining >= 0 {
// 被提前唤醒,返回剩余时间