FreeBSD: add file descriptor tracking for _umtx_op
[valgrind.git] / none / tests / s390x / op_exception.c
blobf4ff9b005bfa82f0abb3d12277de21f8683079c6
1 /* zArchitecture specifies that operation exception(illegal opcode) is
2 suppressing. That means that the program check old psw will point to
3 the instruction after the illegal one (according to the calculated length).
4 There are some programs out there that use this mechanism to detect available
5 instruction (sigh).
6 This patch checks, that valgrind makes forard progress. */
7 #include <signal.h>
8 #include <stdio.h>
9 #include <string.h>
10 static volatile int got_ill;
11 static void handle_ill(int sig)
13 got_ill = 1;
15 int main()
17 struct sigaction sa;
19 memset(&sa, 0, sizeof(sa));
20 sa.sa_handler = handle_ill;
21 sigaction(SIGILL, &sa, NULL);
23 got_ill = 0;
24 /* most architectures loop here, but on s390 this would increase the
25 PSW by 2 and then by 2 */
26 asm volatile(".insn e,0x0000\n\t.insn e,0x0000");
27 if (got_ill)
28 printf("0x00000000 does not loop\n");
30 got_ill = 0;
31 /* most architectures loop here, but on s390 this would increase the
32 PSW by 6 and then by 2*/
33 asm volatile(".insn ril,0xffffffffffff,0xf,.-2\n\t.insn e,0x0000");
34 if (got_ill)
35 printf("0xffffffff does not loop\n");
36 return 0;