Skip to contentSkip to conversation

sh4 linux-user: Fix syscall pipe2() retval

PATCH New [email protected] 1 participant 1 message Feb 17, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh4 linux-user: Fix syscall pipe2() retval

On linux/sh4
pipe() return values by r0:r1 as SH C calling convention. pipe2() return values on memory as traditional unix way.

---
 linux-user/syscall.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
linux-user/syscall.c +6 -3
index 9fb493f..034a2b0 100644
@@ -969,10 +969,13 @@ static abi_long do_pipe(void *cpu_env, abi_ulong pipedes, int flags)
 #if defined(TARGET_MIPS)
     ((CPUMIPSState*)cpu_env)->active_tc.gpr[3] = host_pipe[1];
     ret = host_pipe[0];
-#elif defined(TARGET_SH4)
-    ((CPUSH4State*)cpu_env)->gregs[1] = host_pipe[1];
-    ret = host_pipe[0];
 #else
+#if defined(TARGET_SH4)
+    if (!flags) {
+        ((CPUSH4State*)cpu_env)->gregs[1] = host_pipe[1];
+        ret = host_pipe[0];
+    } else
+#endif
     if (put_user_s32(host_pipe[0], pipedes)
         || put_user_s32(host_pipe[1], pipedes + sizeof(host_pipe[0])))
         return -TARGET_EFAULT;
Signature · 1 line
1.6.5