2 * hostdep.h : things which are dependent on the host architecture
4 * * Written by Peter Maydell <peter.maydell@linaro.org>
6 * Copyright (C) 2016 Linaro Limited
8 * This work is licensed under the terms of the GNU GPL, version 2 or later.
9 * See the COPYING file in the top-level directory.
12 #ifndef X86_64_HOSTDEP_H
13 #define X86_64_HOSTDEP_H
15 /* We have a safe-syscall.inc.S */
16 #define HAVE_SAFE_SYSCALL
20 /* These are defined by the safe-syscall.inc.S file */
21 extern char safe_syscall_start
[];
22 extern char safe_syscall_end
[];
24 /* Adjust the signal context to rewind out of safe-syscall if we're in it */
25 static inline void rewind_if_in_safe_syscall(void *puc
)
28 greg_t
*pcreg
= &uc
->uc_mcontext
.gregs
[REG_RIP
];
30 if (*pcreg
> (uintptr_t)safe_syscall_start
31 && *pcreg
< (uintptr_t)safe_syscall_end
) {
32 *pcreg
= (uintptr_t)safe_syscall_start
;
36 #endif /* __ASSEMBLER__ */