diff mbox

linux-user: Fix pipe syscall return for SPARC

Message ID 1373128788-16756-1-git-send-email-peter.maydell@linaro.org
State Accepted
Headers show

Commit Message

Peter Maydell July 6, 2013, 4:39 p.m. UTC
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.maydell@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(+)

Comments

Peter Maydell July 18, 2013, 10:17 a.m. UTC | #1
Ping?

thanks
-- PMM

On 6 July 2013 17:39, Peter Maydell <peter.maydell@linaro.org> wrote:
> 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.maydell@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
>
>
diff mbox

Patch

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
     }