Skip to contentSkip to conversation

linux-user: Fix pipe syscall return for SPARC

PATCH In review Peter Maydell 1 participant 2 messages Jul 6, 2013 – Jul 18, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user: Fix pipe syscall return for SPARC

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().

---
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(+)
linux-user/syscall.c +3 -0
index cdd0c28..aea9be4 100644
@@ -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
     }
 
Signature · 1 line
1.7.9.5
#1 lore raw

Ping?

thanks
-- PMM

Quoted 37 lines · Peter Maydell

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().

---
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(+)
linux-user/syscall.c +3 -1
index cdd0c28..aea9be4 100644
@@ -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