1
0
mirror of https://github.com/rcore-os/rCore.git synced 2024-11-22 16:16:16 +04:00

Fix syscall in thinpad.

This commit is contained in:
Yuhao Zhou 2019-05-25 20:05:27 +08:00
parent 2b96462da3
commit a708ee401d
2 changed files with 39 additions and 1 deletions

View File

@ -133,6 +133,37 @@ impl Debug for TrapFrame {
.field("epc", &self.epc)
.field("cause", &self.cause.bits)
.field("vaddr", &self.vaddr)
.field("at", &self.at)
.field("v0", &self.v0)
.field("v1", &self.v1)
.field("a0", &self.a0)
.field("a1", &self.a1)
.field("a2", &self.a2)
.field("a3", &self.a3)
.field("t0", &self.t0)
.field("t1", &self.t1)
.field("t2", &self.t2)
.field("t3", &self.t3)
.field("t4", &self.t4)
.field("t5", &self.t5)
.field("t6", &self.t6)
.field("t7", &self.t7)
.field("s0", &self.s0)
.field("s1", &self.s1)
.field("s2", &self.s2)
.field("s3", &self.s3)
.field("s4", &self.s4)
.field("s5", &self.s5)
.field("s6", &self.s6)
.field("s7", &self.s7)
.field("t8", &self.t8)
.field("t9", &self.t9)
.field("k0", &self.k0)
.field("k1", &self.k1)
.field("gp", &self.gp)
.field("sp", &self.sp)
.field("fp", &self.fp)
.field("ra", &self.ra)
.finish()
}
}

View File

@ -154,7 +154,14 @@ fn timer() {
fn syscall(tf: &mut TrapFrame) {
tf.epc += 4; // Must before syscall, because of fork.
let arguments = [tf.a0, tf.a1, tf.a2, tf.a3, tf.t0, tf.t1];
trace!("MIPS syscall {} invoked with {:?}", tf.v0, arguments);
trace!("MIPS syscall {} invoked with {:x?}, epc = {:x?}", tf.v0, arguments, tf.epc);
// temporary solution for ThinPad
if(tf.v0 == 0) {
warn!("Syscall ID = 0");
tf.v0 = unsafe { *((tf.sp + 28) as *const usize) };
}
let ret = crate::syscall::syscall(tf.v0, arguments, tf) as isize;
// comply with mips n32 abi, always return a positive value