qemu

FORK: QEMU emulator
git clone https://git.neptards.moe/neptards/qemu.git
Log | Files | Refs | Submodules | LICENSE

host-signal.h (913B)


      1 /*
      2  * host-signal.h: signal info dependent on the host architecture
      3  *
      4  * Copyright (C) 2021 Linaro Limited
      5  *
      6  * This work is licensed under the terms of the GNU GPL, version 2 or later.
      7  * See the COPYING file in the top-level directory.
      8  */
      9 
     10 #ifndef X86_64_HOST_SIGNAL_H
     11 #define X86_64_HOST_SIGNAL_H
     12 
     13 /* The third argument to a SA_SIGINFO handler is ucontext_t. */
     14 typedef ucontext_t host_sigcontext;
     15 
     16 static inline uintptr_t host_signal_pc(host_sigcontext *uc)
     17 {
     18     return uc->uc_mcontext.gregs[REG_RIP];
     19 }
     20 
     21 static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
     22 {
     23     uc->uc_mcontext.gregs[REG_RIP] = pc;
     24 }
     25 
     26 static inline void *host_signal_mask(host_sigcontext *uc)
     27 {
     28     return &uc->uc_sigmask;
     29 }
     30 
     31 static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
     32 {
     33     return uc->uc_mcontext.gregs[REG_TRAPNO] == 0xe
     34         && (uc->uc_mcontext.gregs[REG_ERR] & 0x2);
     35 }
     36 
     37 #endif