59e96bcbf9
These headers all use QEMU_HOSTDEP_H as header guard symbol. Reuse of the same guard symbol in multiple headers is okay as long as they cannot be included together. Since we can avoid guard symbol reuse easily, do so: use guard symbol $target_HOSTDEP_H for linux-user/host/$target/hostdep.h. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard Henderson <rth@twiddle.net>
39 lines
976 B
C
39 lines
976 B
C
/*
|
|
* 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
|
|
|
|
#ifndef __ASSEMBLER__
|
|
|
|
/* These are defined by the safe-syscall.inc.S file */
|
|
extern char safe_syscall_start[];
|
|
extern char safe_syscall_end[];
|
|
|
|
/* 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)
|
|
{
|
|
struct ucontext *uc = puc;
|
|
greg_t *pcreg = &uc->uc_mcontext.gregs[REG_RIP];
|
|
|
|
if (*pcreg > (uintptr_t)safe_syscall_start
|
|
&& *pcreg < (uintptr_t)safe_syscall_end) {
|
|
*pcreg = (uintptr_t)safe_syscall_start;
|
|
}
|
|
}
|
|
|
|
#endif /* __ASSEMBLER__ */
|
|
|
|
#endif
|