diff options
| author | Richard Henderson | 2018-12-20 21:10:15 +0100 |
|---|---|---|
| committer | Richard Henderson | 2018-12-25 20:40:02 +0100 |
| commit | b8c92c6d2969e88b252f1d2351237a87981d1e74 (patch) | |
| tree | ab71e4b30b00786b9475ee03cc279c762034a3a7 /linux-user/host/riscv64/hostdep.h | |
| parent | disas/microblaze: Remove unused REG_SP macro (diff) | |
| download | qemu-b8c92c6d2969e88b252f1d2351237a87981d1e74.tar.gz qemu-b8c92c6d2969e88b252f1d2351237a87981d1e74.tar.xz qemu-b8c92c6d2969e88b252f1d2351237a87981d1e74.zip | |
linux-user: Add safe_syscall for riscv64 host
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'linux-user/host/riscv64/hostdep.h')
| -rw-r--r-- | linux-user/host/riscv64/hostdep.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/linux-user/host/riscv64/hostdep.h b/linux-user/host/riscv64/hostdep.h index 28467ba00b..865f0fb9ff 100644 --- a/linux-user/host/riscv64/hostdep.h +++ b/linux-user/host/riscv64/hostdep.h @@ -8,4 +8,27 @@ #ifndef RISCV64_HOSTDEP_H #define RISCV64_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) +{ + ucontext_t *uc = puc; + unsigned long *pcreg = &uc->uc_mcontext.__gregs[REG_PC]; + + if (*pcreg > (uintptr_t)safe_syscall_start + && *pcreg < (uintptr_t)safe_syscall_end) { + *pcreg = (uintptr_t)safe_syscall_start; + } +} + +#endif /* __ASSEMBLER__ */ + #endif |
