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