1 /* 2 * host-signal.h: signal info dependent on the host architecture 3 * 4 * Copyright (c) 2003-2005 Fabrice Bellard 5 * Copyright (c) 2021 Linaro Limited 6 * 7 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later. 8 * See the COPYING file in the top-level directory. 9 */ 10 11 #ifndef PPC_HOST_SIGNAL_H 12 #define PPC_HOST_SIGNAL_H 13 14 /* Needed for PT_* constants */ 15 #include <asm/ptrace.h> 16 17 /* The third argument to a SA_SIGINFO handler is ucontext_t. */ 18 typedef ucontext_t host_sigcontext; 19 20 static inline uintptr_t host_signal_pc(host_sigcontext *uc) 21 { 22 return uc->uc_mcontext.gp_regs[PT_NIP]; 23 } 24 25 static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc) 26 { 27 uc->uc_mcontext.gp_regs[PT_NIP] = pc; 28 } 29 30 static inline void *host_signal_mask(host_sigcontext *uc) 31 { 32 return &uc->uc_sigmask; 33 } 34 35 static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc) 36 { 37 return uc->uc_mcontext.gp_regs[PT_TRAP] != 0x400 38 && (uc->uc_mcontext.gp_regs[PT_DSISR] & 0x02000000); 39 } 40 41 #endif 42