1 /* x86 variant of the amd64-solaris/context_rflags.c test. */
8 #include <sys/regset.h>
9 #include <sys/syscall.h>
12 #define OBIT(eflags) (!!((eflags) & (1 << 11)))
13 #define SBIT(eflags) (!!((eflags) & (1 << 7)))
18 static void sighandler(int sig
, siginfo_t
*sip
, void *arg
)
21 uc
= *((ucontext_t
*) arg
);
30 sa
.sa_sigaction
= sighandler
;
31 sa
.sa_flags
= SA_SIGINFO
;
32 if (sigfillset(&sa
.sa_mask
)) {
36 if (sigaction(SIGUSR1
, &sa
, NULL
)) {
44 /* Set overflow and sign flags. */
46 "addl $0x7fffffff, %%edx\n"
48 /* Prepare syscall parameters. */
52 "movl %[scall], %%eax\n"
54 /* Trigger the signal handler. */
60 : [scall
] "i" (SYS_kill
), [pid
] "a" (pid
), [sig
] "i" (SIGUSR1
)
63 printf("Values in the signal handler:\n");
64 printf(" overflow=%d, sign=%d\n",
65 OBIT(uc
.uc_mcontext
.gregs
[EFL
]), SBIT(uc
.uc_mcontext
.gregs
[EFL
]));
67 printf("Values after the return from the signal handler:\n");
68 printf(" overflow=%d, sign=%d\n", OBIT(eflags
), SBIT(eflags
));