qemu-e2k/linux-user
Laurent Vivier 45c874ebba linux-user: ioctl() command type is int
When executing a 64bit target chroot on 64bit host,
the ioctl() command can mismatch.

It seems the previous commit doesn't solve the problem in
my case:

    9c6bf9c7 linux-user: Fix ioctl cmd type mismatch on 64-bit targets

For example, a ppc64 chroot on an x86_64 host:

bash-4.3# ls
Unsupported ioctl: cmd=0x80087467
Unsupported ioctl: cmd=0x802c7415

The origin of the problem is in syscall.c:do_ioctl().

    static abi_long do_ioctl(int fd, abi_long cmd, abi_long arg)

In this case (ppc64) abi_long is long (on the x86_64), and

    cmd = 0x0000000080087467

then
    if (ie->target_cmd == cmd)

target_cmd is int, so target_cmd = 0x80087467
and to compare an int with a long, the sign is extended to 64bit,
so the comparison is:

    if (0xffffffff80087467 == 0x0000000080087467)

which doesn't match whereas it should.

This patch uses int in the case of the target command type
instead of abi_long.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2015-06-16 09:37:17 +03:00
..
aarch64 target-arm: make c13 cp regs banked (FCSEIDR, ...) 2014-12-11 12:07:52 +00:00
alpha linux-user/alpha: Add define for NR_shmat to enable shmat syscall 2015-01-27 22:33:56 +02:00
arm linux-user/arm: Correct TARGET_NR_timerfd to TARGET_NR_timerfd_create 2015-05-18 17:45:10 +01:00
cris linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
i386 linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
m68k linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
microblaze linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
mips linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
mips64 mips64-linux-user: Fix definition of struct sigaltstack 2015-01-27 22:33:57 +02:00
openrisc linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
ppc linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
s390x linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
sh4 linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
sparc linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
sparc64 linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
unicore32 linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
x86_64 linux-user: Support target-to-host translation of mlockall argument 2014-08-22 15:06:35 +03:00
Makefile.objs linux-user: rename cpu-uname -> uname 2014-05-02 21:59:36 +03:00
elfload.c linux-user: Use abi_ulong for TARGET_ELF_PAGESTART 2015-06-15 11:36:58 +03:00
errno_defs.h Remove unnecessary trailing newlines 2008-12-13 09:32:43 +00:00
flat.h Support for 32 bit ABI on 64 bit targets (only enabled Sparc64) 2007-10-14 16:27:31 +00:00
flatload.c linux-user: Remove regs parameter of load_elf_binary and load_flt_binary 2014-01-10 08:51:37 +02:00
ioctls.h linux-user: Convert blkpg to use a special subop handler 2014-10-06 21:52:45 +03:00
linux_loop.h Fix build failure with old kernel headers (loop.h is incompatible with 2008-05-23 16:06:43 +00:00
linuxload.c cpu: Move opaque field from CPU_COMMON to CPUState 2014-03-13 19:20:47 +01:00
m68k-sim.c exec: Change cpu_abort() argument to CPUState 2014-03-13 19:52:28 +01:00
main.c linux-user: fix the breakpoint inheritance in spawned threads 2015-06-16 08:21:02 +03:00
mmap.c translate-all: remove unnecessary argument to tb_invalidate_phys_range 2015-06-05 17:09:59 +02:00
qemu.h linux-user: fix gcc-4.9 compiler error on __{get,put]}_user 2014-06-17 08:52:08 +03:00
signal.c s390x: Common access to floating point registers 2015-05-27 17:52:03 +02:00
socket.h linux-user: support SO_PASSSEC setsockopt option 2014-06-29 14:19:59 +03:00
strace.c linux-user: Don't omit comma for strace of rt_sigaction() 2013-04-05 14:40:54 +02:00
strace.list linux-user: add setns and unshare 2014-08-22 15:06:34 +03:00
syscall.c linux-user: ioctl() command type is int 2015-06-16 09:37:17 +03:00
syscall_defs.h linux-user: correct stat structure in MIPS N32 2015-02-13 14:11:29 +00:00
syscall_types.h linux-user: Convert blkpg to use a special subop handler 2014-10-06 21:52:45 +03:00
target_flat.h linux-user/FLAT: allow targets to override FLAT processing 2011-02-09 10:33:54 +02:00
uaccess.c Fix missing strnlen problems 2009-07-01 18:24:44 +00:00
uname.c linux-user/uname: Return correct uname string for x86_64 2014-06-17 09:21:40 +03:00
uname.h linux-user: move uname functions to uname.c 2014-05-02 21:59:36 +03:00
vm86.c linux-user/vm86.c: Use cpu_ldl_data &c rather than plain ldl &c 2015-01-20 15:19:33 +00:00