[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/2] tests/tcg/s390x: Add per.S
From: |
Ilya Leoshkevich |
Subject: |
[PATCH 2/2] tests/tcg/s390x: Add per.S |
Date: |
Wed, 30 Nov 2022 18:46:10 +0100 |
Add a small test to avoid regressions.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
tests/tcg/s390x/Makefile.softmmu-target | 1 +
tests/tcg/s390x/per.S | 55 +++++++++++++++++++++++++
2 files changed, 56 insertions(+)
create mode 100644 tests/tcg/s390x/per.S
diff --git a/tests/tcg/s390x/Makefile.softmmu-target
b/tests/tcg/s390x/Makefile.softmmu-target
index a34fa68473e..1d649753f4e 100644
--- a/tests/tcg/s390x/Makefile.softmmu-target
+++ b/tests/tcg/s390x/Makefile.softmmu-target
@@ -7,3 +7,4 @@ QEMU_OPTS=-action panic=exit-failure -kernel
-Wl,--build-id=none $< -o $@
TESTS += unaligned-lowcore
+TESTS += per
diff --git a/tests/tcg/s390x/per.S b/tests/tcg/s390x/per.S
new file mode 100644
index 00000000000..02f8422c44d
--- /dev/null
+++ b/tests/tcg/s390x/per.S
@@ -0,0 +1,55 @@
+#define N_ITERATIONS 10
+
+ .org 0x8d
+ilc:
+ .org 0x8e
+program_interruption_code:
+ .org 0x96
+per_code:
+ .org 0x150
+program_old_psw:
+ .org 0x1d0 /* program new PSW */
+ .quad 0,pgm_handler
+ .org 0x200 /* lowcore padding */
+
+ .globl _start
+_start:
+ lpswe per_on_psw
+start_per:
+ lghi %r0,N_ITERATIONS
+ xgr %r1,%r1
+ lctlg %c9,%c11,per_on_regs
+loop:
+ brct %r0,loop
+ lctlg %c9,%c11,per_off_regs
+ cgijne %r1,N_ITERATIONS-1,fail /* expected number of events? */
+ lpswe success_psw
+fail:
+ lpswe failure_psw
+
+pgm_handler:
+ chhsi program_interruption_code,0x80 /* PER event? */
+ jne fail
+ cli per_code,0x80 /* successful-branching event? */
+ jne fail
+ la %r1,1(%r1) /* increment event counter */
+ mvc return_psw(8),program_old_psw
+ lg %r3,program_old_psw+8
+ llgc %r2,ilc
+ sgr %r3,%r2 /* rewind PSW */
+ stg %r3,return_psw+8
+ lpswe return_psw
+
+ .align 8
+per_on_psw:
+ .quad 0x4000000000000000,start_per
+per_on_regs:
+ .quad 0x80000000,0,-1 /* successful-branching everywhere */
+per_off_regs:
+ .quad 0,0,0
+return_psw:
+ .quad 0,0
+success_psw:
+ .quad 0x2000000000000,0xfff /* see is_special_wait_psw() */
+failure_psw:
+ .quad 0x2000000000000,0 /* disabled wait */
--
2.38.1