From 0b33404aac070cf951c20b1bdc57cc715348da72 Mon Sep 17 00:00:00 2001 From: Yifan Wu Date: Mon, 4 Jan 2021 16:03:07 +0800 Subject: [PATCH] Move some variable name to task_cx to task_cx_ptr2 --- os/src/task/mod.rs | 12 ++++++------ os/src/task/switch.S | 5 ++++- os/src/task/switch.rs | 5 ++++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/os/src/task/mod.rs b/os/src/task/mod.rs index f1d0afaa..8d739ca9 100644 --- a/os/src/task/mod.rs +++ b/os/src/task/mod.rs @@ -47,11 +47,11 @@ lazy_static! { impl TaskManager { fn run_first_task(&self) { self.inner.borrow_mut().tasks[0].task_status = TaskStatus::Running; - let next_task_cx = self.inner.borrow().tasks[0].get_task_cx_ptr2(); + let next_task_cx_ptr2 = self.inner.borrow().tasks[0].get_task_cx_ptr2(); unsafe { __switch( &0usize as *const _, - next_task_cx, + next_task_cx_ptr2, ); } } @@ -84,13 +84,13 @@ impl TaskManager { let current = inner.current_task; inner.tasks[next].task_status = TaskStatus::Running; inner.current_task = next; - let current_task_cx = inner.tasks[current].get_task_cx_ptr2(); - let next_task_cx = inner.tasks[next].get_task_cx_ptr2(); + let current_task_cx_ptr2 = inner.tasks[current].get_task_cx_ptr2(); + let next_task_cx_ptr2 = inner.tasks[next].get_task_cx_ptr2(); core::mem::drop(inner); unsafe { __switch( - current_task_cx, - next_task_cx, + current_task_cx_ptr2, + next_task_cx_ptr2, ); } } else { diff --git a/os/src/task/switch.S b/os/src/task/switch.S index df668f35..262511fe 100644 --- a/os/src/task/switch.S +++ b/os/src/task/switch.S @@ -8,7 +8,10 @@ .section .text .globl __switch __switch: - # __switch(current_task_cx: &*const TaskContext, next_task_cx: &*const TaskContext) + # __switch( + # current_task_cx_ptr2: &*const TaskContext, + # next_task_cx_ptr2: &*const TaskContext + # ) # push TaskContext to current sp and save its address to where a0 points to addi sp, sp, -13*8 sd sp, 0(a0) diff --git a/os/src/task/switch.rs b/os/src/task/switch.rs index c5fe5f47..867fcb1e 100644 --- a/os/src/task/switch.rs +++ b/os/src/task/switch.rs @@ -1,5 +1,8 @@ global_asm!(include_str!("switch.S")); extern "C" { - pub fn __switch(current_task_cx: *const usize, next_task_cx: *const usize); + pub fn __switch( + current_task_cx_ptr2: *const usize, + next_task_cx_ptr2: *const usize + ); }