• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 intruction (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;
handle_ill(int sig)11 static void handle_ill(int sig)
12 {
13         got_ill = 1;
14 }
main()15 int main()
16 {
17 	struct sigaction sa;
18 
19 	memset(&sa, 0, sizeof(sa));
20 	sa.sa_handler = handle_ill;
21 	sigaction(SIGILL, &sa, NULL);
22 
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(".long 0\n");
27         if (got_ill)
28                 printf("0x00000000 does not loop\n");
29 
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(".long 0xffffffff\n.long 0xffff0000\n");
34         if (got_ill)
35                 printf("0xffffffff does not loop\n");
36 	return 0;
37 }
38 
39