1
2
3
4
5
6
7
8
9
10
11#ifndef SPARC64_HOST_SIGNAL_H
12#define SPARC64_HOST_SIGNAL_H
13
14
15typedef struct sigcontext host_sigcontext;
16
17static inline uintptr_t host_signal_pc(host_sigcontext *sc)
18{
19 return sc->sigc_regs.tpc;
20}
21
22static inline void host_signal_set_pc(host_sigcontext *sc, uintptr_t pc)
23{
24 sc->sigc_regs.tpc = pc;
25 sc->sigc_regs.tnpc = pc + 4;
26}
27
28static inline void *host_signal_mask(host_sigcontext *sc)
29{
30 return &sc->sigc_mask;
31}
32
33static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
34{
35 uint32_t insn = *(uint32_t *)host_signal_pc(uc);
36
37 if ((insn >> 30) == 3) {
38 switch ((insn >> 19) & 0x3f) {
39 case 0x05:
40 case 0x15:
41 case 0x06:
42 case 0x16:
43 case 0x04:
44 case 0x14:
45 case 0x07:
46 case 0x17:
47 case 0x0e:
48 case 0x1e:
49 case 0x24:
50 case 0x34:
51 case 0x27:
52 case 0x37:
53 case 0x26:
54 case 0x36:
55 case 0x25:
56 case 0x3c:
57 case 0x3e:
58 return true;
59 }
60 }
61 return false;
62}
63
64#endif
65