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 static inline uintptr_t host_signal_pc(ucontext_t *uc)
14 {
15     return uc->uc_mcontext.gregs[REG_RIP];
16 }
17 
18 static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc)
19 {
20     uc->uc_mcontext.gregs[REG_RIP] = pc;
21 }
22 
23 static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc)
24 {
25     return uc->uc_mcontext.gregs[REG_TRAPNO] == 0xe
26         && (uc->uc_mcontext.gregs[REG_ERR] & 0x2);
27 }
28 
29 #endif
30