1 /* 2 * host-signal.h: signal info dependent on the host architecture 3 * 4 * Copyright (c) 2021 Warner Losh 5 * 6 * SPDX-License-Identifier: GPL-2.0-or-later 7 */ 8 9 #ifndef ARM_HOST_SIGNAL_H 10 #define ARM_HOST_SIGNAL_H 11 12 #include <sys/ucontext.h> 13 14 static inline uintptr_t host_signal_pc(ucontext_t *uc) 15 { 16 return uc->uc_mcontext.__gregs[_REG_PC]; 17 } 18 19 static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc) 20 { 21 uc->uc_mcontext.__gregs[_REG_PC] = pc; 22 } 23 24 static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc) 25 { 26 /* 27 * In the FSR, bit 11 is WnR. FreeBSD returns this as part of the 28 * si_info.si_trapno. 29 */ 30 uint32_t fsr = info->si_trapno; 31 32 return extract32(fsr, 11, 1); 33 } 34 35 #endif 36