]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Test cases for #270082 (s390x: Make sure to point the PSW address to
authorJulian Seward <jseward@acm.org>
Wed, 13 Apr 2011 15:15:52 +0000 (15:15 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 13 Apr 2011 15:15:52 +0000 (15:15 +0000)
the next address on SIGILL)
(Christian Borntraeger <borntraeger@de.ibm.com>)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11694

none/tests/s390x/Makefile.am
none/tests/s390x/op_exception.c [new file with mode: 0644]
none/tests/s390x/op_exception.stderr.exp [new file with mode: 0644]
none/tests/s390x/op_exception.stdout.exp [new file with mode: 0644]
none/tests/s390x/op_exception.vgtest [new file with mode: 0644]

index 34c763bed51513fe34de0440fa825b502482433a..a521449911bc743806924a6bf689f2e51bd30da2 100644 (file)
@@ -4,7 +4,8 @@ dist_noinst_SCRIPTS = filter_stderr
 
 INSN_TESTS = clc clcle cvb cvd icm lpr tcxb lam_stam xc mvst add sub mul \
              and or xor insert div srst fold_And16 flogr sub_EI add_EI \
-             and_EI or_EI xor_EI insert_EI mul_GE add_GE condloadstore
+             and_EI or_EI xor_EI insert_EI mul_GE add_GE condloadstore \
+             op_exception
 
 check_PROGRAMS = $(INSN_TESTS) \
                 ex_sig \
diff --git a/none/tests/s390x/op_exception.c b/none/tests/s390x/op_exception.c
new file mode 100644 (file)
index 0000000..d6e8679
--- /dev/null
@@ -0,0 +1,38 @@
+/* zArchitecture specifies that operation exception(illegal opcode) is
+suppressing. That means that the program check old psw will point to
+the instruction after the illegal one (according to the calculated length).
+There are some programs out there that use this mechanism to detect available
+intruction (sigh).
+This patch checks, that valgrind makes forard progress. */
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+static volatile int got_ill;
+static void handle_ill(int sig)
+{
+        got_ill = 1;
+}
+int main()
+{
+       struct sigaction sa;
+
+       memset(&sa, 0, sizeof(sa));
+       sa.sa_handler = handle_ill;
+       sigaction(SIGILL, &sa, NULL);
+
+       got_ill = 0;
+       /* most architectures loop here, but on s390 this would increase the
+          PSW by 2 and then by 2 */
+        asm volatile(".long 0\n");
+        if (got_ill)
+                printf("0x00000000 does not loop\n");
+
+       got_ill = 0;
+       /* most architectures loop here, but on s390 this would increase the
+          PSW by 6 and then by 2*/
+        asm volatile(".long 0xffffffff\n.long 0xffff0000\n");
+        if (got_ill)
+                printf("0xffffffff does not loop\n");
+
+}
+
diff --git a/none/tests/s390x/op_exception.stderr.exp b/none/tests/s390x/op_exception.stderr.exp
new file mode 100644 (file)
index 0000000..c766668
--- /dev/null
@@ -0,0 +1,54 @@
+
+vex s390->IR: unknown insn: 0000
+valgrind: Unrecognised instruction at address 0x.........
+   at 0x........: main (op_exception.c:23)
+Your program just tried to execute an instruction that Valgrind
+did not recognise.  There are two possible reasons for this.
+1. Your program has a bug and erroneously jumped to a non-code
+   location.  If you are running Memcheck and you just saw a
+   warning about a bad jump, it's probably your program's fault.
+2. The instruction is legitimate but Valgrind doesn't handle it,
+   i.e. it's Valgrind's fault.  If you think this is the case or
+   you are not sure, please let us know and we'll try to fix it.
+Either way, Valgrind will now raise a SIGILL signal which will
+probably kill your program.
+vex s390->IR: unknown insn: 0000
+valgrind: Unrecognised instruction at address 0x.........
+   at 0x........: main (op_exception.c:27)
+Your program just tried to execute an instruction that Valgrind
+did not recognise.  There are two possible reasons for this.
+1. Your program has a bug and erroneously jumped to a non-code
+   location.  If you are running Memcheck and you just saw a
+   warning about a bad jump, it's probably your program's fault.
+2. The instruction is legitimate but Valgrind doesn't handle it,
+   i.e. it's Valgrind's fault.  If you think this is the case or
+   you are not sure, please let us know and we'll try to fix it.
+Either way, Valgrind will now raise a SIGILL signal which will
+probably kill your program.
+vex s390->IR: unknown insn: FFFF FFFF FFFF
+valgrind: Unrecognised instruction at address 0x.........
+   at 0x........: main (op_exception.c:30)
+Your program just tried to execute an instruction that Valgrind
+did not recognise.  There are two possible reasons for this.
+1. Your program has a bug and erroneously jumped to a non-code
+   location.  If you are running Memcheck and you just saw a
+   warning about a bad jump, it's probably your program's fault.
+2. The instruction is legitimate but Valgrind doesn't handle it,
+   i.e. it's Valgrind's fault.  If you think this is the case or
+   you are not sure, please let us know and we'll try to fix it.
+Either way, Valgrind will now raise a SIGILL signal which will
+probably kill your program.
+vex s390->IR: unknown insn: 0000
+valgrind: Unrecognised instruction at address 0x.........
+   at 0x........: main (op_exception.c:34)
+Your program just tried to execute an instruction that Valgrind
+did not recognise.  There are two possible reasons for this.
+1. Your program has a bug and erroneously jumped to a non-code
+   location.  If you are running Memcheck and you just saw a
+   warning about a bad jump, it's probably your program's fault.
+2. The instruction is legitimate but Valgrind doesn't handle it,
+   i.e. it's Valgrind's fault.  If you think this is the case or
+   you are not sure, please let us know and we'll try to fix it.
+Either way, Valgrind will now raise a SIGILL signal which will
+probably kill your program.
+
diff --git a/none/tests/s390x/op_exception.stdout.exp b/none/tests/s390x/op_exception.stdout.exp
new file mode 100644 (file)
index 0000000..b6fcb3a
--- /dev/null
@@ -0,0 +1,2 @@
+0x00000000 does not loop
+0xffffffff does not loop
diff --git a/none/tests/s390x/op_exception.vgtest b/none/tests/s390x/op_exception.vgtest
new file mode 100644 (file)
index 0000000..cbac497
--- /dev/null
@@ -0,0 +1 @@
+prog: op_exception