linux-user: Remove HAVE_SAFE_SYSCALL and hostdep.h

All supported hosts now define HAVE_SAFE_SYSCALL, so remove
the ifdefs.  This leaves hostdep.h empty, so remove it.

Reviewed-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2021-11-15 22:08:23 +03:00
parent 95c021dac8
commit 0a7e01904d
19 changed files with 1 additions and 254 deletions

View File

@ -1,18 +0,0 @@
/*
* hostdep.h : things which are dependent on the host architecture
*
* * Written by Peter Maydell <peter.maydell@linaro.org>
*
* Copyright (C) 2016 Linaro Limited
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef AARCH64_HOSTDEP_H
#define AARCH64_HOSTDEP_H
/* We have a safe-syscall.inc.S */
#define HAVE_SAFE_SYSCALL
#endif

View File

@ -1,18 +0,0 @@
/*
* hostdep.h : things which are dependent on the host architecture
*
* * Written by Peter Maydell <peter.maydell@linaro.org>
*
* Copyright (C) 2016 Linaro Limited
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef ARM_HOSTDEP_H
#define ARM_HOSTDEP_H
/* We have a safe-syscall.inc.S */
#define HAVE_SAFE_SYSCALL
#endif

View File

@ -1,18 +0,0 @@
/*
* hostdep.h : things which are dependent on the host architecture
*
* * Written by Peter Maydell <peter.maydell@linaro.org>
*
* Copyright (C) 2016 Linaro Limited
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef I386_HOSTDEP_H
#define I386_HOSTDEP_H
/* We have a safe-syscall.inc.S */
#define HAVE_SAFE_SYSCALL
#endif

View File

@ -1,15 +0,0 @@
/*
* hostdep.h : things which are dependent on the host architecture
*
* * Written by Peter Maydell <peter.maydell@linaro.org>
*
* Copyright (C) 2016 Linaro Limited
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef IA64_HOSTDEP_H
#define IA64_HOSTDEP_H
#endif

View File

@ -1,18 +0,0 @@
/*
* hostdep.h : things which are dependent on the host architecture
*
* * Written by Peter Maydell <peter.maydell@linaro.org>
*
* Copyright (C) 2016 Linaro Limited
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef MIPS_HOSTDEP_H
#define MIPS_HOSTDEP_H
/* We have a safe-syscall.inc.S */
#define HAVE_SAFE_SYSCALL
#endif

View File

@ -1,15 +0,0 @@
/*
* hostdep.h : things which are dependent on the host architecture
*
* * Written by Peter Maydell <peter.maydell@linaro.org>
*
* Copyright (C) 2016 Linaro Limited
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef PPC_HOSTDEP_H
#define PPC_HOSTDEP_H
#endif

View File

@ -1,18 +0,0 @@
/*
* hostdep.h : things which are dependent on the host architecture
*
* * Written by Peter Maydell <peter.maydell@linaro.org>
*
* Copyright (C) 2016 Linaro Limited
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef PPC64_HOSTDEP_H
#define PPC64_HOSTDEP_H
/* We have a safe-syscall.inc.S */
#define HAVE_SAFE_SYSCALL
#endif

View File

@ -1,14 +0,0 @@
/*
* hostdep.h : things which are dependent on the host architecture
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef RISCV_HOSTDEP_H
#define RISCV_HOSTDEP_H
/* We have a safe-syscall.inc.S */
#define HAVE_SAFE_SYSCALL
#endif

View File

@ -1,15 +0,0 @@
/*
* hostdep.h : things which are dependent on the host architecture
*
* * Written by Peter Maydell <peter.maydell@linaro.org>
*
* Copyright (C) 2016 Linaro Limited
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef S390_HOSTDEP_H
#define S390_HOSTDEP_H
#endif

View File

@ -1,18 +0,0 @@
/*
* hostdep.h : things which are dependent on the host architecture
*
* * Written by Peter Maydell <peter.maydell@linaro.org>
*
* Copyright (C) 2016 Linaro Limited
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef S390X_HOSTDEP_H
#define S390X_HOSTDEP_H
/* We have a safe-syscall.inc.S */
#define HAVE_SAFE_SYSCALL
#endif

View File

@ -1,15 +0,0 @@
/*
* hostdep.h : things which are dependent on the host architecture
*
* * Written by Peter Maydell <peter.maydell@linaro.org>
*
* Copyright (C) 2016 Linaro Limited
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef SPARC_HOSTDEP_H
#define SPARC_HOSTDEP_H
#endif

View File

@ -1,18 +0,0 @@
/*
* hostdep.h : things which are dependent on the host architecture
*
* * Written by Peter Maydell <peter.maydell@linaro.org>
*
* Copyright (C) 2016 Linaro Limited
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef SPARC64_HOSTDEP_H
#define SPARC64_HOSTDEP_H
/* We have a safe-syscall.inc.S */
#define HAVE_SAFE_SYSCALL
#endif

View File

@ -1,15 +0,0 @@
/*
* hostdep.h : things which are dependent on the host architecture
*
* * Written by Peter Maydell <peter.maydell@linaro.org>
*
* Copyright (C) 2016 Linaro Limited
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef X32_HOSTDEP_H
#define X32_HOSTDEP_H
#endif

View File

@ -1,18 +0,0 @@
/*
* hostdep.h : things which are dependent on the host architecture
*
* * Written by Peter Maydell <peter.maydell@linaro.org>
*
* Copyright (C) 2016 Linaro Limited
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef X86_64_HOSTDEP_H
#define X86_64_HOSTDEP_H
/* We have a safe-syscall.inc.S */
#define HAVE_SAFE_SYSCALL
#endif

View File

@ -10,10 +10,8 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "hostdep.h"
#include "safe-syscall.h" #include "safe-syscall.h"
#ifdef HAVE_SAFE_SYSCALL
/* /*
* This is intended to be invoked via tail-call on the error path * This is intended to be invoked via tail-call on the error path
* from the assembly in host/arch/safe-syscall.inc.S. This takes * from the assembly in host/arch/safe-syscall.inc.S. This takes
@ -25,4 +23,3 @@ long safe_syscall_set_errno_tail(int value)
errno = value; errno = value;
return -1; return -1;
} }
#endif

View File

@ -10,15 +10,12 @@
* See the COPYING file in the top-level directory. * See the COPYING file in the top-level directory.
*/ */
#include "hostdep.h"
#include "target_errno_defs.h" #include "target_errno_defs.h"
/* We have the correct host directory on our include path /* We have the correct host directory on our include path
* so that this will pull in the right fragment for the architecture. * so that this will pull in the right fragment for the architecture.
*/ */
#ifdef HAVE_SAFE_SYSCALL
#include "safe-syscall.inc.S" #include "safe-syscall.inc.S"
#endif
/* We must specifically say that we're happy for the stack to not be /* We must specifically say that we're happy for the stack to not be
* executable, otherwise the toolchain will default to assuming our * executable, otherwise the toolchain will default to assuming our

View File

@ -124,7 +124,7 @@
* need to check SA_RESTART flags in QEMU or distinguish the various * need to check SA_RESTART flags in QEMU or distinguish the various
* kinds of restartability. * kinds of restartability.
*/ */
#ifdef HAVE_SAFE_SYSCALL
/* The core part of this function is implemented in assembly */ /* The core part of this function is implemented in assembly */
extern long safe_syscall_base(int *pending, long number, ...); extern long safe_syscall_base(int *pending, long number, ...);
extern long safe_syscall_set_errno_tail(int value); extern long safe_syscall_set_errno_tail(int value);
@ -137,15 +137,4 @@ extern char safe_syscall_end[];
safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \ safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
__VA_ARGS__) __VA_ARGS__)
#else
/*
* Fallback for architectures which don't yet provide a safe-syscall assembly
* fragment; note that this is racy!
* This should go away when all host architectures have been updated.
*/
#define safe_syscall syscall
#endif
#endif #endif

View File

@ -798,7 +798,6 @@ int queue_signal(CPUArchState *env, int sig, int si_type,
/* Adjust the signal context to rewind out of safe-syscall if we're in it */ /* Adjust the signal context to rewind out of safe-syscall if we're in it */
static inline void rewind_if_in_safe_syscall(void *puc) static inline void rewind_if_in_safe_syscall(void *puc)
{ {
#ifdef HAVE_SAFE_SYSCALL
ucontext_t *uc = (ucontext_t *)puc; ucontext_t *uc = (ucontext_t *)puc;
uintptr_t pcreg = host_signal_pc(uc); uintptr_t pcreg = host_signal_pc(uc);
@ -806,7 +805,6 @@ static inline void rewind_if_in_safe_syscall(void *puc)
&& pcreg < (uintptr_t)safe_syscall_end) { && pcreg < (uintptr_t)safe_syscall_end) {
host_signal_set_pc(uc, (uintptr_t)safe_syscall_start); host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
} }
#endif
} }
static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)

View File

@ -18,7 +18,6 @@
#ifndef LINUX_USER_USER_INTERNALS_H #ifndef LINUX_USER_USER_INTERNALS_H
#define LINUX_USER_USER_INTERNALS_H #define LINUX_USER_USER_INTERNALS_H
#include "hostdep.h"
#include "exec/user/thunk.h" #include "exec/user/thunk.h"
#include "exec/exec-all.h" #include "exec/exec-all.h"
#include "qemu/log.h" #include "qemu/log.h"