SPARC is one of the CPUs which has a funny syscall ABI for the
pipe syscall; add it to the set of special cases in do_pipe().

Signed-off-by: Peter Maydell <peter.mayd...@linaro.org>
---
bash is much more useful with this patch -- without it, it will
close() stdin instead of one end of its pipe to a child process,
so after the first time you run a program bash will exit...

It's this kind of "basic stuff doesn't work" that makes me
happier about being a bit cavalier with code cleanups,
enabling NPTL, etc for some of the minor target archs in
linux-user -- it's clear that some of them have simply never
been tested for anything more serious than "run some trivial
binary"...

 linux-user/syscall.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index cdd0c28..aea9be4 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1030,6 +1030,9 @@ static abi_long do_pipe(void *cpu_env, abi_ulong pipedes,
 #elif defined(TARGET_SH4)
         ((CPUSH4State*)cpu_env)->gregs[1] = host_pipe[1];
         return host_pipe[0];
+#elif defined(TARGET_SPARC)
+        ((CPUSPARCState*)cpu_env)->regwptr[1] = host_pipe[1];
+        return host_pipe[0];
 #endif
     }
 
-- 
1.7.9.5


Reply via email to