1 /* x86 variant of the amd64-solaris/context_rflags.c test. */
8 #include <sys/syscall.h>
9 #include <sys/ucontext.h>
11 #define OBIT(eflags) (!!((eflags) & (1 << 11)))
12 #define SBIT(eflags) (!!((eflags) & (1 << 7)))
17 static void sighandler(int sig
, siginfo_t
*sip
, ucontext_t
*ucp
)
29 sa
.sa_handler
= sighandler
;
30 sa
.sa_flags
= SA_SIGINFO
;
31 if (sigfillset(&sa
.sa_mask
)) {
35 if (sigaction(SIGUSR1
, &sa
, NULL
)) {
43 /* Set overflow and sign flags. */
45 "addl $0x7fffffff, %%edx\n"
47 /* Prepare syscall parameters. */
51 "movl %[scall], %%eax\n"
53 /* Trigger the signal handler. */
59 : [scall
] "i" (SYS_kill
), [pid
] "a" (pid
), [sig
] "i" (SIGUSR1
)
62 printf("Values in the signal handler:\n");
63 printf(" overflow=%d, sign=%d\n",
64 OBIT(uc
.uc_mcontext
.gregs
[EFL
]), SBIT(uc
.uc_mcontext
.gregs
[EFL
]));
66 printf("Values after the return from the signal handler:\n");
67 printf(" overflow=%d, sign=%d\n", OBIT(eflags
), SBIT(eflags
));