diff --git a/framework/aster-frame/src/task/processor.rs b/framework/aster-frame/src/task/processor.rs index 9781ed60e..2b9a6fb7a 100644 --- a/framework/aster-frame/src/task/processor.rs +++ b/framework/aster-frame/src/task/processor.rs @@ -99,14 +99,14 @@ fn switch_to_task(next_task: Arc) { Some(current_task) => { let cx_ptr = current_task.ctx().get(); - let mut task = current_task.inner_exclusive_access(); + let mut task_inner = current_task.inner_exclusive_access(); - debug_assert_ne!(task.task_status, TaskStatus::Sleeping); - if task.task_status == TaskStatus::Runnable { - drop(task); + debug_assert_ne!(task_inner.task_status, TaskStatus::Sleeping); + if task_inner.task_status == TaskStatus::Runnable { + drop(task_inner); GLOBAL_SCHEDULER.lock_irq_disabled().enqueue(current_task); - } else if task.task_status == TaskStatus::Sleepy { - task.task_status = TaskStatus::Sleeping; + } else if task_inner.task_status == TaskStatus::Sleepy { + task_inner.task_status = TaskStatus::Sleeping; } cx_ptr diff --git a/framework/aster-frame/src/task/task.rs b/framework/aster-frame/src/task/task.rs index 37f21819c..9aff9b8e3 100644 --- a/framework/aster-frame/src/task/task.rs +++ b/framework/aster-frame/src/task/task.rs @@ -278,7 +278,7 @@ impl TaskOptions { current_task.exit(); } - let mut result = Task { + let mut new_task = Task { func: self.func.unwrap(), data: self.data.unwrap(), user_space: self.user_space, @@ -292,7 +292,7 @@ impl TaskOptions { cpu_affinity: self.cpu_affinity, }; - let ctx = result.ctx.get_mut(); + let ctx = new_task.ctx.get_mut(); ctx.rip = kernel_task_entry as usize; // We should reserve space for the return address in the stack, otherwise // we will write across the page boundary due to the implementation of @@ -302,9 +302,9 @@ impl TaskOptions { // to at least 16 bytes. And a larger alignment is needed if larger arguments // are passed to the function. The `kernel_task_entry` function does not // have any arguments, so we only need to align the stack pointer to 16 bytes. - ctx.regs.rsp = (crate::vm::paddr_to_vaddr(result.kstack.end_paddr() - 16)) as u64; + ctx.regs.rsp = (crate::vm::paddr_to_vaddr(new_task.kstack.end_paddr() - 16)) as u64; - Ok(Arc::new(result)) + Ok(Arc::new(new_task)) } /// Build a new task and run it immediately.