summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2012-10-09 09:06:49 +0200
committerhyokeun <hyokeun.jeon@samsung.com>2016-09-06 15:55:34 +0900
commitad4ea5cfc21efbb56f653830bdb5a39ceb9ef754 (patch)
treea4479795cb8ffb38bcda6bb7ce93dbd8e270b342
parentdb976387b1e626737b896de2de5abf0d3d626cb2 (diff)
downloadqemu-ad4ea5cfc21efbb56f653830bdb5a39ceb9ef754.tar.gz
qemu-ad4ea5cfc21efbb56f653830bdb5a39ceb9ef754.tar.bz2
qemu-ad4ea5cfc21efbb56f653830bdb5a39ceb9ef754.zip
linux-user: use target_ulong
Linux syscalls pass pointers or data length or other information of that sort to the kernel. This is all stuff you don't want to have sign extended. Otherwise a host 64bit variable parameter with a size parameter will extend it to a negative number, breaking lseek for example. Pass syscall arguments as ulong always. Signed-off-by: Alexander Graf <agraf@suse.de>
-rw-r--r--linux-user/qemu.h8
-rw-r--r--linux-user/syscall.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/linux-user/qemu.h b/linux-user/qemu.h
index bef465de4..dab3b6a2b 100644
--- a/linux-user/qemu.h
+++ b/linux-user/qemu.h
@@ -193,10 +193,10 @@ abi_long memcpy_to_target(abi_ulong dest, const void *src,
void target_set_brk(abi_ulong new_brk);
abi_long do_brk(abi_ulong new_brk);
void syscall_init(void);
-abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
- abi_long arg2, abi_long arg3, abi_long arg4,
- abi_long arg5, abi_long arg6, abi_long arg7,
- abi_long arg8);
+abi_long do_syscall(void *cpu_env, int num, abi_ulong arg1,
+ abi_ulong arg2, abi_ulong arg3, abi_ulong arg4,
+ abi_ulong arg5, abi_ulong arg6, abi_ulong arg7,
+ abi_ulong arg8);
void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
extern THREAD CPUState *thread_cpu;
void cpu_loop(CPUArchState *env);
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 483efb083..8ac1281bc 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7349,10 +7349,10 @@ static target_timer_t get_timer_id(abi_long arg)
/* do_syscall() should always have a single exit point at the end so
that actions, such as logging of syscall results, can be performed.
All errnos that do_syscall() returns must be -TARGET_<errcode>. */
-abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
- abi_long arg2, abi_long arg3, abi_long arg4,
- abi_long arg5, abi_long arg6, abi_long arg7,
- abi_long arg8)
+abi_long do_syscall(void *cpu_env, int num, abi_ulong arg1,
+ abi_ulong arg2, abi_ulong arg3, abi_ulong arg4,
+ abi_ulong arg5, abi_ulong arg6, abi_ulong arg7,
+ abi_ulong arg8)
{
CPUState *cpu = ENV_GET_CPU(cpu_env);
abi_long ret;