xref: /kvm-unit-tests/s390x/snippets/c/spec_ex.c (revision 610c15284a537484682adfb4b6d6313991ab954f)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright IBM Corp. 2021
4  *
5  * Snippet used by specification exception interception test.
6  */
7 #include <libcflat.h>
8 #include <bitops.h>
9 #include <asm/arch_def.h>
10 
main(void)11 __attribute__((section(".text"))) int main(void)
12 {
13 	uint64_t bad_psw = 0;
14 
15 	/* PSW bit 12 has no name or meaning and must be 0 */
16 	lowcore.pgm_new_psw.mask = BIT(63 - 12);
17 	lowcore.pgm_new_psw.addr = 0xdeadbeee;
18 	asm volatile ("lpsw %0" :: "Q"(bad_psw));
19 	return 0;
20 }
21