[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 12/15] bsd-user/sysarch: Move to using do_freebsd_arch_sysarch
From: |
Warner Losh |
Subject: |
[PATCH v2 12/15] bsd-user/sysarch: Move to using do_freebsd_arch_sysarch interface |
Date: |
Fri, 8 Oct 2021 17:15:03 -0600 |
do_freebsd_arch_sysarch() exists in $ARCH/target_arch_sysarch.h for x86.
Call it from do_freebsd_sysarch() and remove the mostly duplicate
version in syscall.c. Future changes will move it to os-sys.c and
support other architectures.
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
bsd-user/syscall.c | 45 +--------------------------------------------
1 file changed, 1 insertion(+), 44 deletions(-)
diff --git a/bsd-user/syscall.c b/bsd-user/syscall.c
index 2fd2ba8330..d3b9f431e2 100644
--- a/bsd-user/syscall.c
+++ b/bsd-user/syscall.c
@@ -91,50 +91,7 @@ static abi_long do_obreak(abi_ulong new_brk)
#if defined(TARGET_I386)
static abi_long do_freebsd_sysarch(CPUX86State *env, int op, abi_ulong parms)
{
- abi_long ret = 0;
- abi_ulong val;
- int idx;
-
- switch (op) {
-#ifdef TARGET_ABI32
- case TARGET_FREEBSD_I386_SET_GSBASE:
- case TARGET_FREEBSD_I386_SET_FSBASE:
- if (op == TARGET_FREEBSD_I386_SET_GSBASE)
-#else
- case TARGET_FREEBSD_AMD64_SET_GSBASE:
- case TARGET_FREEBSD_AMD64_SET_FSBASE:
- if (op == TARGET_FREEBSD_AMD64_SET_GSBASE)
-#endif
- idx = R_GS;
- else
- idx = R_FS;
- if (get_user(val, parms, abi_ulong))
- return -TARGET_EFAULT;
- cpu_x86_load_seg(env, idx, 0);
- env->segs[idx].base = val;
- break;
-#ifdef TARGET_ABI32
- case TARGET_FREEBSD_I386_GET_GSBASE:
- case TARGET_FREEBSD_I386_GET_FSBASE:
- if (op == TARGET_FREEBSD_I386_GET_GSBASE)
-#else
- case TARGET_FREEBSD_AMD64_GET_GSBASE:
- case TARGET_FREEBSD_AMD64_GET_FSBASE:
- if (op == TARGET_FREEBSD_AMD64_GET_GSBASE)
-#endif
- idx = R_GS;
- else
- idx = R_FS;
- val = env->segs[idx].base;
- if (put_user(val, parms, abi_ulong))
- return -TARGET_EFAULT;
- break;
- /* XXX handle the others... */
- default:
- ret = -TARGET_EINVAL;
- break;
- }
- return ret;
+ do_freebsd_arch_sysarch(env, op, parms);
}
#endif
--
2.32.0
- [PATCH v2 09/15] bsd-user/target_os_elf: If ELF_HWCAP2 is defined, publish it, (continued)
- [PATCH v2 09/15] bsd-user/target_os_elf: If ELF_HWCAP2 is defined, publish it, Warner Losh, 2021/10/08
- [PATCH v2 06/15] bsd-user/errno_defs.h: Add internal error numbers, Warner Losh, 2021/10/08
- [PATCH v2 07/15] bsd-user: move TARGET_MC_GET_CLEAR_RET to target_os_signal.h, Warner Losh, 2021/10/08
- [PATCH v2 10/15] bsd-user: Remove used from TaskState, Warner Losh, 2021/10/08
- [PATCH v2 08/15] bsd-user/target_os_elf.h: Remove fallback ELF_HWCAP and reorder, Warner Losh, 2021/10/08
- [PATCH v2 12/15] bsd-user/sysarch: Move to using do_freebsd_arch_sysarch interface,
Warner Losh <=
- [PATCH v2 14/15] bsd-user: Rename sigqueue to qemu_sigqueue, Warner Losh, 2021/10/08
- [PATCH v2 13/15] bsd-user/sysarch: Provide a per-arch framework for sysarch syscall, Warner Losh, 2021/10/08
- [PATCH v2 11/15] bsd-user: Add stop_all_tasks, Warner Losh, 2021/10/08
- [PATCH v2 15/15] bsd-user/signal: Create a dummy signal queueing function, Warner Losh, 2021/10/08