Re: [Qemu-devel] [RFC PATCH] linux-user: Add signal handling for x86_64

2017-02-03 Thread Wirth, Allan
Pranith,

Thanks for doing this. I totally forgot about this (my work has moved 
elsewhere) so thank you for picking it back up.

Please don’t worry about the attribution.

The patch LGTM. :)

Cheers,
Allan

On 2/3/17, 10:55 AM, "Pranith Kumar"  wrote:


Peter Maydell writes:

> On 25 January 2017 at 00:10, Pranith Kumar  wrote:
>> Adopted from a previous patch posting:
>> https://lists.gnu.org/archive/html/qemu-devel/2016-07/msg02079.html
>>
>> CC: Allan Wirth 
>> CC: Peter Maydell 
>> Signed-off-by: Pranith Kumar 
>
> Thanks for picking this patch up. A nit about commit message format:
> because this  is mostly Allan's work you need to add his signed-off-by:
> line (which he provided on his original patch posting), and make
> a brief not of what was changed, so it looks like:
>
>   Signed-off-by: Original Author 
>   [OP: changed X, Y, Z]
>   Signed-off-by: Other Person 
>
> It's also in this kind of situation worth considering whether the
> patch would be better attributed to Allan as the git commit 'author'.
> If I've taken somebody else's work and made mostly minor overhauls
> to it I tend to go for giving them credit in the git commit log.

OK, I'll add these SOB lines and attribute it to Allan as he did most of 
the work.

>
>> ---
>>  linux-user/signal.c  | 264 
---
>>  target/i386/cpu.h|   2 +
>>  target/i386/fpu_helper.c |  12 +++
>>  3 files changed, 242 insertions(+), 36 deletions(-)
>>
>> diff --git a/linux-user/signal.c b/linux-user/signal.c
>> index 0a5bb4e26b..0248621d66 100644
>> --- a/linux-user/signal.c
>> +++ b/linux-user/signal.c
>> @@ -253,8 +253,7 @@ int do_sigprocmask(int how, const sigset_t *set, 
sigset_t *oldset)
>>  return 0;
>>  }
>>
>> -#if !defined(TARGET_OPENRISC) && !defined(TARGET_UNICORE32) && \
>> -!defined(TARGET_X86_64)
>> +#if !defined(TARGET_OPENRISC) && !defined(TARGET_UNICORE32)
>>  /* Just set the guest's signal mask to the specified value; the
>>   * caller is assumed to have called block_signals() already.
>>   */
>
> There's a minor conflict here with the Nios2 code that's now
> in master (which added another clause to this #if), but it's
> trivial to resolve.

I'll rebase my patch on master and fix up the conflicts and send a v2.

>
> Otherwise:
>
> Reviewed-by: Peter Maydell 

Thanks for the review!
-- 
Pranith




[Qemu-devel] [PATCH] Add signal handling support for x86_64.

2016-07-09 Thread Wirth, Allan
Note that x86_64 has only _rt signal handlers. This implementation
attempts to share code with the x86_32 implementation.

Reported-by: Timothy Pearson 
Suggested-by: Peter Maydell 
Signed-off-by: Allan Wirth 
---
 linux-user/signal.c  | 344 ---
 target-i386/cpu.h|   2 +
 target-i386/fpu_helper.c |  12 ++
 3 files changed, 282 insertions(+), 76 deletions(-)

diff --git a/linux-user/signal.c b/linux-user/signal.c
index 9d98045..edca9e4 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -253,8 +253,7 @@ int do_sigprocmask(int how, const sigset_t *set, sigset_t 
*oldset)
 return 0;
 }
 
-#if !defined(TARGET_OPENRISC) && !defined(TARGET_UNICORE32) && \
-!defined(TARGET_X86_64)
+#if !defined(TARGET_OPENRISC) && !defined(TARGET_UNICORE32)
 /* Just set the guest's signal mask to the specified value; the
  * caller is assumed to have called block_signals() already.
  */
@@ -789,9 +788,8 @@ int do_sigaction(int sig, const struct target_sigaction 
*act,
 return ret;
 }
 
-#if defined(TARGET_I386) && TARGET_ABI_BITS == 32
-
-/* from the Linux kernel */
+#if defined(TARGET_I386)
+/* from the Linux kernel - /arch/x86/include/uapi/asm/sigcontext.h */
 
 struct target_fpreg {
 uint16_t significand[4];
@@ -805,7 +803,7 @@ struct target_fpxreg {
 };
 
 struct target_xmmreg {
-abi_ulong element[4];
+uint32_t element[4];
 };
 
 struct target_fpstate {
@@ -830,33 +828,117 @@ struct target_fpstate {
 abi_ulong padding[56];
 };
 
-#define X86_FXSR_MAGIC 0x
+struct target_fpstate_32 {
+/* Regular FPU environment */
+uint32_t cw;
+uint32_t sw;
+uint32_t tag;
+uint32_t ipoff;
+uint32_t cssel;
+uint32_t dataoff;
+uint32_t datasel;
+struct target_fpreg _st[8];
+uint16_t  status;
+uint16_t  magic;  /* 0x = regular FPU data only */
 
-struct target_sigcontext {
+/* FXSR FPU environment */
+uint32_t _fxsr_env[6];   /* FXSR FPU env is ignored */
+uint32_t mxcsr;
+uint32_t reserved;
+struct target_fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
+struct target_xmmreg _xmm[8];
+uint32_t padding[56];
+};
+
+struct target_fpstate_64 {
+/* FXSAVE format */
+uint16_t cw;
+uint16_t sw;
+uint16_t twd;
+uint16_t fop;
+uint64_t rip;
+uint64_t rdp;
+uint32_t mxcsr;
+uint32_t mxcsr_mask;
+uint32_t st_space[32];
+uint32_t xmm_space[64];
+uint32_t reserved[24];
+};
+
+#ifndef TARGET_X86_64
+# define target_fpstate target_fpstate_32
+#else
+# define target_fpstate target_fpstate_64
+#endif
+
+struct target_sigcontext_32 {
 uint16_t gs, __gsh;
 uint16_t fs, __fsh;
 uint16_t es, __esh;
 uint16_t ds, __dsh;
-abi_ulong edi;
-abi_ulong esi;
-abi_ulong ebp;
-abi_ulong esp;
-abi_ulong ebx;
-abi_ulong edx;
-abi_ulong ecx;
-abi_ulong eax;
-abi_ulong trapno;
-abi_ulong err;
-abi_ulong eip;
+uint32_t edi;
+uint32_t esi;
+uint32_t ebp;
+uint32_t esp;
+uint32_t ebx;
+uint32_t edx;
+uint32_t ecx;
+uint32_t eax;
+uint32_t trapno;
+uint32_t err;
+uint32_t eip;
 uint16_t cs, __csh;
-abi_ulong eflags;
-abi_ulong esp_at_signal;
+uint32_t eflags;
+uint32_t esp_at_signal;
 uint16_t ss, __ssh;
-abi_ulong fpstate; /* pointer */
-abi_ulong oldmask;
-abi_ulong cr2;
+uint32_t fpstate; /* pointer */
+uint32_t oldmask;
+uint32_t cr2;
 };
 
+struct target_sigcontext_64 {
+uint64_t r8;
+uint64_t r9;
+uint64_t r10;
+uint64_t r11;
+uint64_t r12;
+uint64_t r13;
+uint64_t r14;
+uint64_t r15;
+
+uint64_t rdi;
+uint64_t rsi;
+uint64_t rbp;
+uint64_t rbx;
+uint64_t rdx;
+uint64_t rax;
+uint64_t rcx;
+uint64_t rsp;
+uint64_t rip;
+
+uint64_t eflags;
+
+uint16_t cs;
+uint16_t gs;
+uint16_t fs;
+uint16_t ss;
+
+uint64_t err;
+uint64_t trapno;
+uint64_t oldmask;
+uint64_t cr2;
+
+uint64_t fpstate; /* pointer */
+uint64_t padding[8];
+};
+
+#ifndef TARGET_X86_64
+# define target_sigcontext target_sigcontext_32
+#else
+# define target_sigcontext target_sigcontext_64
+#endif
+
+/* see Linux/include/uapi/asm-generic/ucontext.h */
 struct target_ucontext {
 abi_ulong tuc_flags;
 abi_ulong tuc_link;
@@ -865,6 +947,7 @@ struct target_ucontext {
 target_sigset_t   tuc_sigmask;  /* mask last for extensibility */
 };
 
+#ifndef TARGET_X86_64
 struct sigframe
 {
 abi_ulong pretcode;
@@ -887,6 +970,18 @@ struct rt_sigframe
 char retcode[8];
 };
 
+#else
+
+struct rt_sigframe
+{
+abi_ulong pretcode;
+struct target_ucontext uc;
+struct target_siginfo info;
+struct target_fpstate fpstate;
+};
+
+#endif
+
 /*
  * Set up a signal frame.
  */
@@ -897,6 +992,7 @@ static void 

Re: [Qemu-devel] [PATCH] linux-user: fix TARGET_NR_select

2016-07-07 Thread Wirth, Allan
Laurent,

Seems to work well for my specific case – select no longer returns EFAULT on 
x86_64 linux user mode, and the arguments are passed correctly.

Thank you!

Cheers,
Allan

On 7/7/16, 7:17 PM, "Laurent Vivier"  wrote:

>TARGET_NR_select can have three different implementations:
>
>  1- to always return -ENOSYS
>
> microblaze, ppc, ppc64
>
> -> TARGET_WANT_NI_OLD_SELECT
>
>  2- to take parameters from a structure pointed by arg1
>(kernel sys_old_select)
>
> i386, arm, m68k
>
> -> TARGET_WANT_OLD_SYS_SELECT
>
>  3- to take parameters from arg[1-5]
> (kernel sys_select)
>
> x86_64, alpha, s390x,
> cris, sparc, sparc64
>
>Some (new) architectures don't define NR_select,
>
>  4- but only NR__newselect with sys_select:
>
>  mips, mips64, sh
>
>  5- don't define NR__newselect, and use pselect6 syscall:
>
>  aarch64, openrisc, tilegx, unicore32
>
>Reported-by: Timothy Pearson 
>Reported-by: Allan Wirth 
>Suggested-by: Peter Maydell 
>Signed-off-by: Laurent Vivier 
>---
> linux-user/arm/target_syscall.h|  2 ++
> linux-user/i386/target_syscall.h   |  2 ++
> linux-user/m68k/target_syscall.h   |  2 ++
> linux-user/microblaze/target_syscall.h |  2 ++
> linux-user/openrisc/syscall_nr.h   |  2 --
> linux-user/ppc/target_syscall.h|  2 ++
> linux-user/sh4/syscall_nr.h|  2 +-
> linux-user/syscall.c   | 48 ++
> linux-user/tilegx/syscall_nr.h |  1 -
> 9 files changed, 42 insertions(+), 21 deletions(-)
>
>diff --git a/linux-user/arm/target_syscall.h b/linux-user/arm/target_syscall.h
>index 11077b7..b1073bf 100644
>--- a/linux-user/arm/target_syscall.h
>+++ b/linux-user/arm/target_syscall.h
>@@ -33,4 +33,6 @@ struct target_pt_regs {
> #define TARGET_MLOCKALL_MCL_CURRENT 1
> #define TARGET_MLOCKALL_MCL_FUTURE  2
> 
>+#define TARGET_WANT_OLD_SYS_SELECT
>+
> #endif  /* TARGET_SYSCALL_H */
>diff --git a/linux-user/i386/target_syscall.h 
>b/linux-user/i386/target_syscall.h
>index 0ac84dc..6678763 100644
>--- a/linux-user/i386/target_syscall.h
>+++ b/linux-user/i386/target_syscall.h
>@@ -154,4 +154,6 @@ struct target_vm86plus_struct {
> #define TARGET_MLOCKALL_MCL_CURRENT 1
> #define TARGET_MLOCKALL_MCL_FUTURE  2
> 
>+#define TARGET_WANT_OLD_SYS_SELECT
>+
> #endif  /* TARGET_SYSCALL_H */
>diff --git a/linux-user/m68k/target_syscall.h 
>b/linux-user/m68k/target_syscall.h
>index 97a4cc0..5e2ccf1 100644
>--- a/linux-user/m68k/target_syscall.h
>+++ b/linux-user/m68k/target_syscall.h
>@@ -24,6 +24,8 @@ struct target_pt_regs {
> #define TARGET_MLOCKALL_MCL_CURRENT 1
> #define TARGET_MLOCKALL_MCL_FUTURE  2
> 
>+#define TARGET_WANT_OLD_SYS_SELECT
>+
> void do_m68k_simcall(CPUM68KState *, int);
> 
> #endif  /* TARGET_SYSCALL_H */
>diff --git a/linux-user/microblaze/target_syscall.h 
>b/linux-user/microblaze/target_syscall.h
>index 3c1ed27..65b07c2 100644
>--- a/linux-user/microblaze/target_syscall.h
>+++ b/linux-user/microblaze/target_syscall.h
>@@ -53,4 +53,6 @@ struct target_pt_regs {
> #define TARGET_MLOCKALL_MCL_CURRENT 1
> #define TARGET_MLOCKALL_MCL_FUTURE  2
> 
>+#define TARGET_WANT_NI_OLD_SELECT
>+
> #endif
>diff --git a/linux-user/openrisc/syscall_nr.h 
>b/linux-user/openrisc/syscall_nr.h
>index 6b1c7d2..04059d0 100644
>--- a/linux-user/openrisc/syscall_nr.h
>+++ b/linux-user/openrisc/syscall_nr.h
>@@ -459,8 +459,6 @@
> #define TARGET_NR_getdents 1065
> #define __ARCH_WANT_SYS_GETDENTS
> #define TARGET_NR_futimesat 1066
>-#define TARGET_NR_select 1067
>-#define __ARCH_WANT_SYS_SELECT
> #define TARGET_NR_poll 1068
> #define TARGET_NR_epoll_wait 1069
> #define TARGET_NR_ustat 1070
>diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
>index 7ca83c2..6616678 100644
>--- a/linux-user/ppc/target_syscall.h
>+++ b/linux-user/ppc/target_syscall.h
>@@ -75,4 +75,6 @@ struct target_revectored_struct {
> #define TARGET_MLOCKALL_MCL_CURRENT 0x2000
> #define TARGET_MLOCKALL_MCL_FUTURE  0x4000
> 
>+#define TARGET_WANT_NI_OLD_SELECT
>+
> #endif  /* TARGET_SYSCALL_H */
>diff --git a/linux-user/sh4/syscall_nr.h b/linux-user/sh4/syscall_nr.h
>index 5009984..e99f735 100644
>--- a/linux-user/sh4/syscall_nr.h
>+++ b/linux-user/sh4/syscall_nr.h
>@@ -84,7 +84,7 @@
> #define TARGET_NR_settimeofday 79
> #define TARGET_NR_getgroups80
> #define TARGET_NR_setgroups81
>-#define TARGET_NR_select   82
>+ /* 82 was sys_oldselect */
> #define TARGET_NR_symlink  83
> #define TARGET_NR_oldlstat 84
> #define TARGET_NR_readlink 85
>diff --git a/linux-user/syscall.c b/linux-user/syscall.c
>index 37f0660..e7ec2d3 100644
>--- a/linux-user/syscall.c
>+++ b/linux-user/syscall.c
>@@ -1255,6 +1255,29 @@ static abi_long do_select(int n,
> 
> return ret;
> }
>+
>+#if 

Re: [Qemu-devel] [PATCH] linux-user: fix signal() syscall on x86_64

2016-07-07 Thread Wirth, Allan


On 7/7/16, 3:09 PM, "Laurent Vivier" <laur...@vivier.eu> wrote:

>
>
>Le 07/07/2016 à 21:04, Wirth, Allan a écrit :
>> 
>> 
>> On 7/7/16, 3:02 PM, "Laurent Vivier" <laur...@vivier.eu> wrote:
>> 
>>>
>>>
>>> Le 07/07/2016 à 20:49, Riku Voipio a écrit :
>>>> On Sat, Jul 02, 2016 at 09:12:09PM +0100, Peter Maydell wrote:
>>>>> On 2 July 2016 at 17:41, Laurent Vivier <laur...@vivier.eu> wrote:
>>>>>> Sadly, this can't work:
>>>>>>
>>>>>> sparc/sparc64/cris use sys_select for NR_select AND NR_newselect.
>>>>>
>>>>>> Not sure all is correct, but it's what I've found:
>>>>>>
>>>>>> | __NR_select| __NR__newselect
>>>>>> ++-+
>>>>>> arm | sys_old_select | sys_select  |
>>>>>> ++-+
>>>>>> aarch64 | sys_select |-|
>>>>>> ++-+
>>>>>> alpha   | sys_select |-|
>>>>>> ++-+
>>>>>> cris| sys_select | sys_select  |
>>>>>> ++-+
>>>>>> m68k| sys_old_select | sys_select  |
>>>>>> ++-+
>>>>>> microblaze  | sys_old_select | sys_select  |
>>>>>> ++-+
>>>>>> mips| sys_old_select | sys_select  |
>>>>>> ++-+
>>>>>> mips64  | sys_select |-|
>>>>>> ++-+
>>>>>> openrisc| sys_select |-|
>>>>>> ++-+
>>>>>> ppc | sys_old_select | sys_select  |
>>>>>> ++-+
>>>>>> s390x   | sys_select |-|
>>>>>> ++-+
>>>>>> sh4 | sys_old_select | sys_select  |
>>>>>> ++-+
>>>>>> sparc   | sys_select | sys_select  |
>>>>>> ++-+
>>>>>> sparc64 | sys_select | sys_select  |
>>>>>> ++-+
>>>>>> tilegx  | sys_select |-|
>>>>>> ++-+
>>>>>> unicore32   | sys_select |-|
>>>>>> ++-+
>>>>>> x86_64  | sys_select |-|
>>>>>> ++-+
>>>>>> i386| sys_old_select | sys_select  |
>>>>>> ++-+
>>>>>
>>>>> Hmm. Looking at current Linux git master, I get
>>>>> slightly different results. The only architectures which
>>>>> define __ARCH_WANT_SYS_OLD_SELECT are:
>>>>>  arm, m68k, mn10300, x86
>>>>> and no others use sys_old_select.
>>>>>
>>>>> So I think we have the following behaviours:
>>>>>
>>>>> (1) Define neither NR_select nor NR__newselect
>>>>>  (and use pselect6 syscall for select):
>>>>>  aarch64, openrisc, tilegx, unicore32, presumably any future arch
>>>>>
>>>>> (2) only define NR__newselect, it is new select:
>>>>>  mips, mips64, sh, s390
>>>>>
>>>>> (3) Only define NR_select, want that to be new select:
>>>>>  alpha, x86_64, s390x
>>>>>
>>>>> (4) NR__newselect is new select, NR_select is old_select:
>>>>>  i386, m68k, arm if kernel is not CONFIG_AEABI
>>>>>
>>>>> (5) NR__newselect is new select, NR_select is defined but
>>>>>  if called returns ENOSYS:
>>>>>  microblaze, arm if CONFIG_AEABI, ppc64
>>>>>
>>>>> (6) NR__newselect is new select,

Re: [Qemu-devel] [PATCH] linux-user: fix signal() syscall on x86_64

2016-07-07 Thread Wirth, Allan


On 7/7/16, 3:02 PM, "Laurent Vivier"  wrote:

>
>
>Le 07/07/2016 à 20:49, Riku Voipio a écrit :
>> On Sat, Jul 02, 2016 at 09:12:09PM +0100, Peter Maydell wrote:
>>> On 2 July 2016 at 17:41, Laurent Vivier  wrote:
 Sadly, this can't work:

 sparc/sparc64/cris use sys_select for NR_select AND NR_newselect.
>>>
 Not sure all is correct, but it's what I've found:

 | __NR_select| __NR__newselect
 ++-+
 arm | sys_old_select | sys_select  |
 ++-+
 aarch64 | sys_select |-|
 ++-+
 alpha   | sys_select |-|
 ++-+
 cris| sys_select | sys_select  |
 ++-+
 m68k| sys_old_select | sys_select  |
 ++-+
 microblaze  | sys_old_select | sys_select  |
 ++-+
 mips| sys_old_select | sys_select  |
 ++-+
 mips64  | sys_select |-|
 ++-+
 openrisc| sys_select |-|
 ++-+
 ppc | sys_old_select | sys_select  |
 ++-+
 s390x   | sys_select |-|
 ++-+
 sh4 | sys_old_select | sys_select  |
 ++-+
 sparc   | sys_select | sys_select  |
 ++-+
 sparc64 | sys_select | sys_select  |
 ++-+
 tilegx  | sys_select |-|
 ++-+
 unicore32   | sys_select |-|
 ++-+
 x86_64  | sys_select |-|
 ++-+
 i386| sys_old_select | sys_select  |
 ++-+
>>>
>>> Hmm. Looking at current Linux git master, I get
>>> slightly different results. The only architectures which
>>> define __ARCH_WANT_SYS_OLD_SELECT are:
>>>  arm, m68k, mn10300, x86
>>> and no others use sys_old_select.
>>>
>>> So I think we have the following behaviours:
>>>
>>> (1) Define neither NR_select nor NR__newselect
>>>  (and use pselect6 syscall for select):
>>>  aarch64, openrisc, tilegx, unicore32, presumably any future arch
>>>
>>> (2) only define NR__newselect, it is new select:
>>>  mips, mips64, sh, s390
>>>
>>> (3) Only define NR_select, want that to be new select:
>>>  alpha, x86_64, s390x
>>>
>>> (4) NR__newselect is new select, NR_select is old_select:
>>>  i386, m68k, arm if kernel is not CONFIG_AEABI
>>>
>>> (5) NR__newselect is new select, NR_select is defined but
>>>  if called returns ENOSYS:
>>>  microblaze, arm if CONFIG_AEABI, ppc64
>>>
>>> (6) NR__newselect is new select, NR_select is a bonkers custom
>>>  thing that tries to autodetect the calling convention:
>>> http://lxr.free-electrons.com/source/arch/powerpc/kernel/syscalls.c#L86
>>>  ppc32 (but only native 32-bit; 32-bit compat support
>>>  on a ppc64 kernel is category 5, so I vote for ignoring
>>>  this weirdness and calling ppc category 5)
>>>
>>> (7) NR_select and NR__newselect are different numbers
>>>  but both are new select:
>>>  cris, sparc, sparc64
>>>
>>> which is a pretty confusing mess, but I think it equates to:
>>> (0) if defined, NR__newselect is always new select
>>> (1) if NR_select is defined, the choices are:
>>>  (a) NR_select is old_select:
>>>i386, m68k, arm
>>>  (b) NR_select is defined but should ENOSYS:
>>>microblaze, ppc
>>>  (c) NR_select defined and is new select:
>>>everything else (alpha, x86-64, s390x, cris, sparc, sparc64)
>>>
>>> and I think we should handle that by having the code in syscall.c
>>> be something like:
>>>
>>> #ifdef TARGET_NR_select
>>> case TARGET_NR_select:
>>> #if defined(TARGET_WANT_NI_OLD_SELECT)
>>> /* some architectures used to have old_select here
>>>  * but now ENOSYS it.
>>>  */
>>> ret = -TARGET_ENOSYS;
>>> break;
>>> #elif defined(TARGET_WANT_OLD_SYS_SELECT)
>>> /* code for old select here; maybe factored out to
>>>  * its own function: ret = do_old_select() ?
>>>  */
>>> #else
>>> /* select is new style select */
>>> ret = do_select(...);
>>> #endif
>>> #endif
>> 
>> I agree, this seems to be the best way to fix select properly.
>

Re: [Qemu-devel] [PATCH] linux-user: fix signal() syscall on x86_64

2016-07-01 Thread Wirth, Allan
Thanks for the feedback. I didn’t find that patch before when I searched, so
apologies for the duplicate submission.

The proposed fix certainly does seem cleaner and more general. Does it
imply though that this patch is incorrect? It fixes the emulation bug
in my use case, and AFAICT does not introduce new emulation bugs.

Cheers,
Allan Wirth

On 7/1/16, 9:35 AM, "Peter Maydell" <peter.mayd...@linaro.org> wrote:

>On 1 July 2016 at 12:59, Wirth, Allan <awi...@akamai.com> wrote:
>> Linux on X86_64 does not use sel_arg_struct for select(), the args are
>> passed directly. This patch switches a define so X86_64 uses the correct
>> calling convention.
>>
>> Signed-off-by: Allan Wirth <awi...@akamai.com>
>> ---
>>  linux-user/syscall.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
>> index 8bf6205..209b2a7 100644
>> --- a/linux-user/syscall.c
>> +++ b/linux-user/syscall.c
>> @@ -8002,7 +8002,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long 
>> arg1,
>>  break;
>>  #if defined(TARGET_NR_select)
>>  case TARGET_NR_select:
>> -#if defined(TARGET_S390X) || defined(TARGET_ALPHA)
>> +#if defined(TARGET_S390X) || defined(TARGET_ALPHA) || defined(TARGET_X86_64)
>>  ret = do_select(arg1, arg2, arg3, arg4, arg5);
>>  #else
>>  {
>
>There is a cleaner approach which we should use to fix this:
>see my comments in reply to this recent patch trying to do
>a similar thing:
>https://patchwork.kernel.org/patch/9185927/
>
>thanks
>-- PMM



[Qemu-devel] [PATCH] linux-user: fix signal() syscall on x86_64

2016-07-01 Thread Wirth, Allan
Linux on X86_64 does not use sel_arg_struct for select(), the args are
passed directly. This patch switches a define so X86_64 uses the correct
calling convention.

Signed-off-by: Allan Wirth 
---
 linux-user/syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 8bf6205..209b2a7 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8002,7 +8002,7 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 break;
 #if defined(TARGET_NR_select)
 case TARGET_NR_select:
-#if defined(TARGET_S390X) || defined(TARGET_ALPHA)
+#if defined(TARGET_S390X) || defined(TARGET_ALPHA) || defined(TARGET_X86_64)
 ret = do_select(arg1, arg2, arg3, arg4, arg5);
 #else
 {
-- 
1.9.1