Move some variable name to task_cx to task_cx_ptr2
This commit is contained in:
parent
6011a6a943
commit
3851c2d561
3 changed files with 14 additions and 8 deletions
|
@ -49,12 +49,12 @@ lazy_static! {
|
||||||
impl TaskManager {
|
impl TaskManager {
|
||||||
fn run_first_task(&self) {
|
fn run_first_task(&self) {
|
||||||
self.inner.borrow_mut().tasks[0].task_status = TaskStatus::Running;
|
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();
|
||||||
let _unused: usize = 0;
|
let _unused: usize = 0;
|
||||||
unsafe {
|
unsafe {
|
||||||
__switch(
|
__switch(
|
||||||
&_unused as *const _,
|
&_unused as *const _,
|
||||||
next_task_cx,
|
next_task_cx_ptr2,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,13 +99,13 @@ impl TaskManager {
|
||||||
let current = inner.current_task;
|
let current = inner.current_task;
|
||||||
inner.tasks[next].task_status = TaskStatus::Running;
|
inner.tasks[next].task_status = TaskStatus::Running;
|
||||||
inner.current_task = next;
|
inner.current_task = next;
|
||||||
let current_task_cx = inner.tasks[current].get_task_cx_ptr2();
|
let current_task_cx_ptr2 = inner.tasks[current].get_task_cx_ptr2();
|
||||||
let next_task_cx = inner.tasks[next].get_task_cx_ptr2();
|
let next_task_cx_ptr2 = inner.tasks[next].get_task_cx_ptr2();
|
||||||
core::mem::drop(inner);
|
core::mem::drop(inner);
|
||||||
unsafe {
|
unsafe {
|
||||||
__switch(
|
__switch(
|
||||||
current_task_cx,
|
current_task_cx_ptr2,
|
||||||
next_task_cx,
|
next_task_cx_ptr2,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -8,7 +8,10 @@
|
||||||
.section .text
|
.section .text
|
||||||
.globl __switch
|
.globl __switch
|
||||||
__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
|
# push TaskContext to current sp and save its address to where a0 points to
|
||||||
addi sp, sp, -13*8
|
addi sp, sp, -13*8
|
||||||
sd sp, 0(a0)
|
sd sp, 0(a0)
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
global_asm!(include_str!("switch.S"));
|
global_asm!(include_str!("switch.S"));
|
||||||
|
|
||||||
extern "C" {
|
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
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue