riscv: fixed syscall return value
authorTuan Ta <qtt2@cornell.edu>
Mon, 2 Apr 2018 20:22:30 +0000 (16:22 -0400)
committerTuan Ta <qtt2@cornell.edu>
Fri, 8 Feb 2019 15:25:30 +0000 (15:25 +0000)
In case of failure, a syscall returns a negative value encoding the
error code. This patch makes the risc-v implementation returns the
encoded value instead of its absolute value upon a failure of a syscall.

Change-Id: I6032b0337fe1cff5b326dbc6bb3b87a415f03300
Reviewed-on: https://gem5-review.googlesource.com/c/9627
Reviewed-by: Alec Roelke <ar4jc@virginia.edu>
Maintainer: Alec Roelke <ar4jc@virginia.edu>

src/arch/riscv/process.cc

index ed6de1546136b9ad4dfac4018992e93edb1e5176..16d0dc7ff1d825ea4b96588dd5d93c8b7de2edd9 100644 (file)
@@ -279,6 +279,6 @@ RiscvProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
         tc->setIntReg(SyscallPseudoReturnReg, sysret.returnValue());
     } else {
         // got an error, return details
-        tc->setIntReg(SyscallPseudoReturnReg, sysret.errnoValue());
+        tc->setIntReg(SyscallPseudoReturnReg, sysret.encodedValue());
     }
 }