6 #define XER_SO (1 << 31)
7 #define XER_OV (1 << 30)
8 #define XER_CA (1 << 29)
9 #define XER_OV32 (1 << 19)
10 #define XER_CA32 (1 << 18)
14 void sigtrap_handler(int sig
, siginfo_t
*si
, void *ucontext
)
16 ucontext_t
*uc
= ucontext
;
17 uc
->uc_mcontext
.regs
->nip
+= 4;
18 saved
= uc
->uc_mcontext
.regs
->xer
;
19 uc
->uc_mcontext
.regs
->xer
|= XER_OV
| XER_OV32
;
24 uint64_t initial
= XER_CA
| XER_CA32
, restored
;
25 struct sigaction sa
= {
26 .sa_sigaction
= sigtrap_handler
,
27 .sa_flags
= SA_SIGINFO
30 sigaction(SIGTRAP
, &sa
, NULL
);
38 assert(saved
== initial
);
39 assert(restored
== (XER_OV
| XER_OV32
| XER_CA
| XER_CA32
));