Fix MIPS registers access in backtrace.rs.

master
Yuhao Zhou 6 years ago
parent 7c20ebf6e0
commit 610fd5b3db

@ -156,8 +156,7 @@ impl Context {
/// Push all callee-saved registers at the current kernel stack. /// Push all callee-saved registers at the current kernel stack.
/// Store current sp, switch to target. /// Store current sp, switch to target.
/// Pop all callee-saved registers, then return to the target. /// Pop all callee-saved registers, then return to the target.
#[naked] #[inline(always)]
#[inline(never)]
pub unsafe extern fn switch(&mut self, _target: &mut Self) { pub unsafe extern fn switch(&mut self, _target: &mut Self) {
extern { extern {
fn switch_context(src : &mut Context, dst : &mut Context); fn switch_context(src : &mut Context, dst : &mut Context);

@ -24,8 +24,8 @@ pub fn fp() -> usize {
} }
#[cfg(any(target_arch = "mips"))] #[cfg(any(target_arch = "mips"))]
unsafe { unsafe {
// fp = $30 // fp = s8 = $30
asm!("ori $0, $$$30, 0" : "=r"(ptr)); asm!("ori $0, $$$1, 0" : "=r"(ptr): "i"(30));
} }
ptr ptr
@ -51,7 +51,7 @@ pub fn lr() -> usize {
#[cfg(target_arch = "mips")] #[cfg(target_arch = "mips")]
unsafe { unsafe {
asm!("ori $0, $$$31, 0" : "=r"(ptr)); asm!("ori $0, $$$1, 0" : "=r"(ptr) : "i"(31));
} }
ptr ptr

Loading…
Cancel
Save