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 ARM_HOST_SIGNAL_H
12 #define ARM_HOST_SIGNAL_H
13
14 /* The third argument to a SA_SIGINFO handler is ucontext_t. */
15 typedef ucontext_t host_sigcontext;
16
host_signal_pc(host_sigcontext * uc)17 static inline uintptr_t host_signal_pc(host_sigcontext *uc)
18 {
19 return uc->uc_mcontext.arm_pc;
20 }
21
host_signal_set_pc(host_sigcontext * uc,uintptr_t pc)22 static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
23 {
24 uc->uc_mcontext.arm_pc = pc;
25 }
26
host_signal_mask(host_sigcontext * uc)27 static inline void *host_signal_mask(host_sigcontext *uc)
28 {
29 return &uc->uc_sigmask;
30 }
31
host_signal_write(siginfo_t * info,host_sigcontext * uc)32 static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
33 {
34 /*
35 * In the FSR, bit 11 is WnR, assuming a v6 or
36 * later processor. On v5 we will always report
37 * this as a read, which will fail later.
38 */
39 uint32_t fsr = uc->uc_mcontext.error_code;
40 return extract32(fsr, 11, 1);
41 }
42
43 #endif
44