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> [JRZ: changes from linux-user/qemu.h wass moved to linux-user/user-internals.h] Signed-off-by: Jose R Ziviani <jziviani@suse.de> [DF: Forward port, i.e., use ulong for do_prctl too] Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
This commit is contained in:
@@ -6405,8 +6405,8 @@ static abi_long do_prctl_inval1(CPUArchState *env, abi_long arg2)
|
|||||||
#define do_prctl_sme_set_vl do_prctl_inval1
|
#define do_prctl_sme_set_vl do_prctl_inval1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
|
static abi_long do_prctl(CPUArchState *env, abi_ulong option, abi_ulong arg2,
|
||||||
abi_long arg3, abi_long arg4, abi_long arg5)
|
abi_ulong arg3, abi_ulong arg4, abi_ulong arg5)
|
||||||
{
|
{
|
||||||
abi_long ret;
|
abi_long ret;
|
||||||
|
|
||||||
@@ -8581,10 +8581,10 @@ _syscall2(int, pivot_root, const char *, new_root, const char *, put_old)
|
|||||||
* of syscall results, can be performed.
|
* of syscall results, can be performed.
|
||||||
* All errnos that do_syscall() returns must be -TARGET_<errcode>.
|
* All errnos that do_syscall() returns must be -TARGET_<errcode>.
|
||||||
*/
|
*/
|
||||||
static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
|
static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_ulong arg1,
|
||||||
abi_long arg2, abi_long arg3, abi_long arg4,
|
abi_ulong arg2, abi_ulong arg3, abi_ulong arg4,
|
||||||
abi_long arg5, abi_long arg6, abi_long arg7,
|
abi_ulong arg5, abi_ulong arg6, abi_ulong arg7,
|
||||||
abi_long arg8)
|
abi_ulong arg8)
|
||||||
{
|
{
|
||||||
CPUState *cpu = env_cpu(cpu_env);
|
CPUState *cpu = env_cpu(cpu_env);
|
||||||
abi_long ret;
|
abi_long ret;
|
||||||
@@ -13203,10 +13203,10 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
abi_long do_syscall(CPUArchState *cpu_env, int num, abi_long arg1,
|
abi_long do_syscall(CPUArchState *cpu_env, int num, abi_ulong arg1,
|
||||||
abi_long arg2, abi_long arg3, abi_long arg4,
|
abi_ulong arg2, abi_ulong arg3, abi_ulong arg4,
|
||||||
abi_long arg5, abi_long arg6, abi_long arg7,
|
abi_ulong arg5, abi_ulong arg6, abi_ulong arg7,
|
||||||
abi_long arg8)
|
abi_ulong arg8)
|
||||||
{
|
{
|
||||||
CPUState *cpu = env_cpu(cpu_env);
|
CPUState *cpu = env_cpu(cpu_env);
|
||||||
abi_long ret;
|
abi_long ret;
|
||||||
|
|||||||
@@ -59,10 +59,10 @@ int info_is_fdpic(struct image_info *info);
|
|||||||
|
|
||||||
void target_set_brk(abi_ulong new_brk);
|
void target_set_brk(abi_ulong new_brk);
|
||||||
void syscall_init(void);
|
void syscall_init(void);
|
||||||
abi_long do_syscall(CPUArchState *cpu_env, int num, abi_long arg1,
|
abi_long do_syscall(CPUArchState *cpu_env, int num, abi_ulong arg1,
|
||||||
abi_long arg2, abi_long arg3, abi_long arg4,
|
abi_ulong arg2, abi_ulong arg3, abi_ulong arg4,
|
||||||
abi_long arg5, abi_long arg6, abi_long arg7,
|
abi_ulong arg5, abi_ulong arg6, abi_ulong arg7,
|
||||||
abi_long arg8);
|
abi_ulong arg8);
|
||||||
extern __thread CPUState *thread_cpu;
|
extern __thread CPUState *thread_cpu;
|
||||||
G_NORETURN void cpu_loop(CPUArchState *env);
|
G_NORETURN void cpu_loop(CPUArchState *env);
|
||||||
abi_long get_errno(abi_long ret);
|
abi_long get_errno(abi_long ret);
|
||||||
|
|||||||
Reference in New Issue
Block a user