mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 17:03:23 +00:00
Avoid poorly chosen variable names
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
a215cb54d9
commit
47fe10f17b
@ -99,14 +99,14 @@ fn switch_to_task(next_task: Arc<Task>) {
|
|||||||
Some(current_task) => {
|
Some(current_task) => {
|
||||||
let cx_ptr = current_task.ctx().get();
|
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);
|
debug_assert_ne!(task_inner.task_status, TaskStatus::Sleeping);
|
||||||
if task.task_status == TaskStatus::Runnable {
|
if task_inner.task_status == TaskStatus::Runnable {
|
||||||
drop(task);
|
drop(task_inner);
|
||||||
GLOBAL_SCHEDULER.lock_irq_disabled().enqueue(current_task);
|
GLOBAL_SCHEDULER.lock_irq_disabled().enqueue(current_task);
|
||||||
} else if task.task_status == TaskStatus::Sleepy {
|
} else if task_inner.task_status == TaskStatus::Sleepy {
|
||||||
task.task_status = TaskStatus::Sleeping;
|
task_inner.task_status = TaskStatus::Sleeping;
|
||||||
}
|
}
|
||||||
|
|
||||||
cx_ptr
|
cx_ptr
|
||||||
|
@ -278,7 +278,7 @@ impl TaskOptions {
|
|||||||
current_task.exit();
|
current_task.exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut result = Task {
|
let mut new_task = Task {
|
||||||
func: self.func.unwrap(),
|
func: self.func.unwrap(),
|
||||||
data: self.data.unwrap(),
|
data: self.data.unwrap(),
|
||||||
user_space: self.user_space,
|
user_space: self.user_space,
|
||||||
@ -292,7 +292,7 @@ impl TaskOptions {
|
|||||||
cpu_affinity: self.cpu_affinity,
|
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;
|
ctx.rip = kernel_task_entry as usize;
|
||||||
// We should reserve space for the return address in the stack, otherwise
|
// We should reserve space for the return address in the stack, otherwise
|
||||||
// we will write across the page boundary due to the implementation of
|
// 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
|
// 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
|
// 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.
|
// 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.
|
/// Build a new task and run it immediately.
|
||||||
|
Reference in New Issue
Block a user