qemu/linux-user/host/riscv64/hostdep.h
<<
>>
Prefs
   1/*
   2 * hostdep.h : things which are dependent on the host architecture
   3 *
   4 * This work is licensed under the terms of the GNU GPL, version 2 or later.
   5 * See the COPYING file in the top-level directory.
   6 */
   7
   8#ifndef RISCV64_HOSTDEP_H
   9#define RISCV64_HOSTDEP_H
  10
  11/* We have a safe-syscall.inc.S */
  12#define HAVE_SAFE_SYSCALL
  13
  14#ifndef __ASSEMBLER__
  15
  16/* These are defined by the safe-syscall.inc.S file */
  17extern char safe_syscall_start[];
  18extern char safe_syscall_end[];
  19
  20/* Adjust the signal context to rewind out of safe-syscall if we're in it */
  21static inline void rewind_if_in_safe_syscall(void *puc)
  22{
  23    ucontext_t *uc = puc;
  24    unsigned long *pcreg = &uc->uc_mcontext.__gregs[REG_PC];
  25
  26    if (*pcreg > (uintptr_t)safe_syscall_start
  27        && *pcreg < (uintptr_t)safe_syscall_end) {
  28        *pcreg = (uintptr_t)safe_syscall_start;
  29    }
  30}
  31
  32#endif /* __ASSEMBLER__ */
  33
  34#endif
  35