mirror of
https://github.com/rcore-os/rCore-Tutorial-v3.git
synced 2024-11-22 01:16:26 +04:00
fix: backtrace
This commit is contained in:
parent
6edaa3a952
commit
bebd225de8
@ -4,6 +4,7 @@ use super::{ProcessControlBlock, TaskContext, TaskControlBlock};
|
|||||||
use crate::sync::UPIntrFreeCell;
|
use crate::sync::UPIntrFreeCell;
|
||||||
use crate::trap::TrapContext;
|
use crate::trap::TrapContext;
|
||||||
use alloc::sync::Arc;
|
use alloc::sync::Arc;
|
||||||
|
use core::arch::asm;
|
||||||
use lazy_static::*;
|
use lazy_static::*;
|
||||||
|
|
||||||
pub struct Processor {
|
pub struct Processor {
|
||||||
@ -91,7 +92,14 @@ pub fn current_trap_cx_user_va() -> usize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn current_kstack_top() -> usize {
|
pub fn current_kstack_top() -> usize {
|
||||||
current_task().unwrap().kstack.get_top()
|
if let Some(task) = current_task() {
|
||||||
|
task.kstack.get_top()
|
||||||
|
} else {
|
||||||
|
let mut boot_stack_top;
|
||||||
|
unsafe { asm!("la {},boot_stack_top",out(reg) boot_stack_top) };
|
||||||
|
boot_stack_top
|
||||||
|
}
|
||||||
|
// current_task().unwrap().kstack.get_top()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn schedule(switched_task_cx_ptr: *mut TaskContext) {
|
pub fn schedule(switched_task_cx_ptr: *mut TaskContext) {
|
||||||
|
Loading…
Reference in New Issue
Block a user