2012-10-10 20:18:11 +02:00
|
|
|
From: Alexander Graf <agraf@suse.de>
|
|
|
|
Date: Tue, 9 Oct 2012 09:06:49 +0200
|
2019-01-04 22:08:16 +01:00
|
|
|
Subject: linux-user: use target_ulong
|
2012-10-10 20:18:11 +02:00
|
|
|
|
|
|
|
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>
|
2021-12-17 11:07:39 +01:00
|
|
|
[JRZ: changes from linux-user/qemu.h wass moved to linux-user/user-internals.h]
|
|
|
|
Signed-off-by: Jose R Ziviani <jziviani@suse.de>
|
2012-10-10 20:18:11 +02:00
|
|
|
---
|
2021-12-17 11:07:39 +01:00
|
|
|
linux-user/syscall.c | 18 +++++++++---------
|
|
|
|
linux-user/user-internals.h | 8 ++++----
|
2018-12-06 22:20:59 +01:00
|
|
|
2 files changed, 13 insertions(+), 13 deletions(-)
|
2012-10-10 20:18:11 +02:00
|
|
|
|
|
|
|
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
|
2021-12-17 11:07:39 +01:00
|
|
|
index d4f3295b9d1837126f35d8357e80..381066e788eb36c1d6ca5b872353 100644
|
2012-10-10 20:18:11 +02:00
|
|
|
--- a/linux-user/syscall.c
|
|
|
|
+++ b/linux-user/syscall.c
|
2021-12-17 11:07:39 +01:00
|
|
|
@@ -8346,10 +8346,10 @@ _syscall2(int, pivot_root, const char *, new_root, const char *, put_old)
|
2018-12-06 22:20:59 +01:00
|
|
|
* of syscall results, can be performed.
|
|
|
|
* All errnos that do_syscall() returns must be -TARGET_<errcode>.
|
|
|
|
*/
|
|
|
|
-static abi_long do_syscall1(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)
|
|
|
|
+static abi_long do_syscall1(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)
|
|
|
|
{
|
2019-09-12 17:54:03 +02:00
|
|
|
CPUState *cpu = env_cpu(cpu_env);
|
2018-12-06 22:20:59 +01:00
|
|
|
abi_long ret;
|
2021-12-17 11:07:39 +01:00
|
|
|
@@ -10807,7 +10807,7 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
|
2018-12-06 22:20:59 +01:00
|
|
|
*/
|
|
|
|
ret = -TARGET_EINVAL;
|
2019-09-12 17:54:03 +02:00
|
|
|
if (cpu_isar_feature(aa64_sve, env_archcpu(cpu_env))
|
2018-12-06 22:20:59 +01:00
|
|
|
- && arg2 >= 0 && arg2 <= 512 * 16 && !(arg2 & 15)) {
|
|
|
|
+ && arg2 <= 512 * 16 && !(arg2 & 15)) {
|
|
|
|
CPUARMState *env = cpu_env;
|
2019-09-12 17:54:03 +02:00
|
|
|
ARMCPU *cpu = env_archcpu(env);
|
2018-12-06 22:20:59 +01:00
|
|
|
uint32_t vq, old_vq;
|
2021-12-17 11:07:39 +01:00
|
|
|
@@ -13176,10 +13176,10 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
|
2018-12-06 22:20:59 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-10-10 20:18:11 +02:00
|
|
|
-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)
|
|
|
|
{
|
2019-09-12 17:54:03 +02:00
|
|
|
CPUState *cpu = env_cpu(cpu_env);
|
2012-10-10 20:18:11 +02:00
|
|
|
abi_long ret;
|
2021-12-17 11:07:39 +01:00
|
|
|
diff --git a/linux-user/user-internals.h b/linux-user/user-internals.h
|
|
|
|
index 661612a088b5c4e37f8f9fbcb6af..db24553432003b2faa3957d63c3d 100644
|
|
|
|
--- a/linux-user/user-internals.h
|
|
|
|
+++ b/linux-user/user-internals.h
|
|
|
|
@@ -60,10 +60,10 @@ int info_is_fdpic(struct image_info *info);
|
|
|
|
|
|
|
|
void target_set_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);
|
|
|
|
extern __thread CPUState *thread_cpu;
|
|
|
|
void cpu_loop(CPUArchState *env);
|
|
|
|
const char *target_strerror(int err);
|