aboutsummaryrefslogtreecommitdiff
path: root/linux-user/host/i386/hostdep.h
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user/host/i386/hostdep.h')
-rw-r--r--linux-user/host/i386/hostdep.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/linux-user/host/i386/hostdep.h b/linux-user/host/i386/hostdep.h
index 7609bf5cd7..ee6a810be5 100644
--- a/linux-user/host/i386/hostdep.h
+++ b/linux-user/host/i386/hostdep.h
@@ -12,4 +12,32 @@
#ifndef QEMU_HOSTDEP_H
#define QEMU_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[];
+
+/* For glibc 2.1 */
+#ifndef REG_EIP
+#define REG_EIP EIP
+#endif
+
+/* 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_EIP];
+
+ if (*pcreg > (uintptr_t)safe_syscall_start
+ && *pcreg < (uintptr_t)safe_syscall_end) {
+ *pcreg = (uintptr_t)safe_syscall_start;
+ }
+}
+
+#endif /* __ASSEMBLER__ */
+
#endif