X86: return -return_value.value() on failure.
authorGabe Black <gblack@eecs.umich.edu>
Sun, 29 Jul 2007 08:27:34 +0000 (01:27 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Sun, 29 Jul 2007 08:27:34 +0000 (01:27 -0700)
--HG--
extra : convert_revision : d8e1486ff075b2917be62a0008f83fd6c9e4c09a

src/arch/x86/syscallreturn.hh

index 6a7fdba58285a112ac792264501aa7f8751c26d7..be9715d2124738a57bf778d772193c4a7b43ebc3 100644 (file)
@@ -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());
+        }
     }
 };