aboutsummaryrefslogtreecommitdiff
path: root/linux-user/host/s390x/hostdep.h
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2016-06-21 17:32:12 -0700
committerRiku Voipio <riku.voipio@linaro.org>2016-06-26 13:17:22 +0300
commitc9bc3437a905b660561a26cd4ecc64579843267b (patch)
tree729fcc53de84380bf0d7beaf5f07c69e2ad0e0e9 /linux-user/host/s390x/hostdep.h
parent31f875f211f2c61421250e6b3320b15464237b15 (diff)
linux-user: Provide safe_syscall for s390x
Signed-off-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Diffstat (limited to 'linux-user/host/s390x/hostdep.h')
-rw-r--r--linux-user/host/s390x/hostdep.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/linux-user/host/s390x/hostdep.h b/linux-user/host/s390x/hostdep.h
index 7609bf5cd7..e95871c46a 100644
--- a/linux-user/host/s390x/hostdep.h
+++ b/linux-user/host/s390x/hostdep.h
@@ -12,4 +12,27 @@
#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[];
+
+/* 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;
+ unsigned long *pcreg = &uc->uc_mcontext.psw.addr;
+
+ if (*pcreg > (uintptr_t)safe_syscall_start
+ && *pcreg < (uintptr_t)safe_syscall_end) {
+ *pcreg = (uintptr_t)safe_syscall_start;
+ }
+}
+
+#endif /* __ASSEMBLER__ */
+
#endif