• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <features.h>
2 #include <fpu_control.h>
3 #include <signal.h>
4 #include <sys/types.h>
5 #include <signal.h>
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <ucontext.h>
9 #include <unistd.h>
10 
11 char source[40] = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\0";
12 char target[40] = "                                       \0";
13 
handle_SIG(int sig)14 void handle_SIG(int sig)
15 {
16 	static int counter;
17 	char buf2[40];
18 
19 	counter++;
20 	asm volatile(	"larl 1,1f\n"
21 			"ex 0,0(1)\n"
22 			"j 2f\n"
23 			"1: mvc 0(30,%0),0(%1)\n"
24 			"2:\n"
25 		::"a" (buf2), "a" (source)
26 		: "1");
27 	if (counter == 2) {
28 		printf("%s\n", target);
29 		exit(1);
30 	} else
31 		alarm(1);
32 }
33 
main()34 int main()
35 {
36 	signal(SIGALRM, handle_SIG);
37 	alarm(1);
38 
39 	asm volatile(	"larl 1,1f\n"
40 			"0: ex 0,0(1)\n"
41 			"j 0b\n"
42 			"1: mvc 0(20,%0),0(%1)\n"
43 		::"a" (target), "a" (source)
44 		: "1");
45 	exit(0);
46 }
47