diff options
Diffstat (limited to 'arch/mips/isa_traits.hh')
-rw-r--r-- | arch/mips/isa_traits.hh | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/arch/mips/isa_traits.hh b/arch/mips/isa_traits.hh index 8363f42f3..a69d84842 100644 --- a/arch/mips/isa_traits.hh +++ b/arch/mips/isa_traits.hh @@ -589,7 +589,20 @@ extern const Addr PageOffset; static inline void setSyscallReturn(SyscallReturn return_value, RegFile *regs) { - regs->intRegFile[ReturnValueReg1] = 1; + // check for error condition. Alpha syscall convention is to + // indicate success/failure in reg a3 (r19) and put the + // return value itself in the standard return value reg (v0). + if (return_value.successful()) { + // no error + regs->intRegFile[ReturnValueReg1] = 0; + regs->intRegFile[ReturnValueReg2] = return_value.value(); + } else { + // got an error, return details + regs->intRegFile[ReturnValueReg1] = (IntReg) -1; + regs->intRegFile[ReturnValueReg2] = -return_value.value(); + } + + //regs->intRegFile[ReturnValueReg1] = (IntReg)return_value; //panic("Returning from syscall\n"); } |