1 /* x86 variant of the amd64-solaris/context_rflags2.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)))
20 static void sighandler(int sig
, siginfo_t
*sip
, void *arg
)
22 ucontext_t
*ucp
= (ucontext_t
*) arg
;
27 /* Break out of the endless loop. */
28 *(uintptr_t*)&ucp
->uc_mcontext
.gregs
[EIP
] = (uintptr_t)break_out
;
37 /* Uninitialised, but we know px[0] is 0x0. */
38 int *px
= malloc(sizeof(*px
));
41 sa
.sa_sigaction
= sighandler
;
42 sa
.sa_flags
= SA_SIGINFO
;
43 if (sigfillset(&sa
.sa_mask
)) {
47 if (sigaction(SIGALRM
, &sa
, NULL
)) {
55 /* Set overflow and sign flags. */
57 "addl $0x7fffffff, %%edx\n"
59 /* Loopity loop, this is where the SIGALRM is triggered. */
70 /* Check that the overflow and sign flags are uninitialised.
72 Note: This actually fails because the eflags are only approximate
73 (always initialised) in the signal handler. */
74 if (!OBIT(uc
.uc_mcontext
.gregs
[EFL
]) || !SBIT(uc
.uc_mcontext
.gregs
[EFL
]))
77 /* Check that the overflow and sign flags are uninitialised. */
78 if (!OBIT(eflags
) || !SBIT(eflags
))