summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/x86/syscallreturn.hh6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/arch/x86/syscallreturn.hh b/src/arch/x86/syscallreturn.hh
index 6a7fdba58..be9715d21 100644
--- a/src/arch/x86/syscallreturn.hh
+++ b/src/arch/x86/syscallreturn.hh
@@ -67,7 +67,11 @@ namespace X86ISA
static inline void setSyscallReturn(SyscallReturn return_value,
ThreadContext * tc)
{
- tc->setIntReg(INTREG_RAX, return_value.value());
+ if (return_value.successful()) {
+ tc->setIntReg(INTREG_RAX, return_value.value());
+ } else {
+ tc->setIntReg(INTREG_RAX, -return_value.value());
+ }
}
};