s390x: Interception tests
PATCH v4 1/1 s390x: Interception tests
Certain CPU instructions will cause an exit of the virtual machine. Run some of these instructions to check whether they are emulated right by KVM (or QEMU).
Reviewed-by David Hildenbrand <[email protected]>
Signed-off-by Thomas Huth <[email protected]>
---
v4:
- Use %%c0 for lctlg instead of 0
- Replaced "CPU ID" with "CPU address" in the STAP test
lib/s390x/asm/interrupt.h | 20 ++++ s390x/Makefile | 1 + s390x/intercept.c | 227 ++++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 3 + 4 files changed, 251 insertions(+) create mode 100644 s390x/intercept.c
lib/s390x/asm/interrupt.h +20 -0
@@ -15,4 +15,24 @@ void handle_pgm_int(void);void expect_pgm_int (void );void check_pgm_int_code (uint16_t code); +/* Activate low-address protection */ +static inline void low_prot_enable (void ) +{ +uint64_t cr0; + + asmvolatile (" stctg %%c0,%%c0,%0 " : :"Q" (cr0) :"memory" ); + cr0 |=1ULL << (63 -35 ); + asmvolatile (" lctlg %%c0,%%c0,%0 " : :"Q" (cr0)); +} + +/* Disable low-address protection */ +static inline void low_prot_disable (void ) +{ +uint64_t cr0; + + asmvolatile (" stctg %%c0,%%c0,%0 " : :"Q" (cr0) :"memory" ); + cr0 &= ~(1ULL << (63 -35 )); + asmvolatile (" lctlg %%c0,%%c0,%0 " : :"Q" (cr0)); +} +#endif
s390x/Makefile +1 -0
@@ -1,4 +1,5 @@ tests = $(TEST_DIR)/selftest.elf +tests += $(TEST_DIR)/intercept.elf all: directories test_cases
s390x/intercept.c new file +227 -0
227 lines not on this page · raw message
s390x/unittests.cfg +3 -0
@@ -22,3 +22,6 @@ file = selftest.elf groups = selftest extra_params = -append 'test 123' + +[intercept] +file = intercept.elf
Signature · 1 line
1.8.3.1
Radim Krčmář
Applied2017-06-07 17:05+0200, Thomas Huth:
Quoted 7 lines
Certain CPU instructions will cause an exit of the virtual machine. Run some of these instructions to check whether they are emulated right by KVM (or QEMU).
Reviewed-by David Hildenbrand <[email protected]>Signed-off-by Thomas Huth <[email protected]>---
Applied, thanks.