xref: /kvm-unit-tests/s390x/snippets/c/spec_ex.c (revision 2c96b77ec9d3b1fcec7525174e23a6240ee05949)
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 
11 __attribute__((section(".text"))) int main(void)
12 {
13 	struct lowcore *lowcore = (struct lowcore *) 0;
14 	uint64_t bad_psw = 0;
15 
16 	/* PSW bit 12 has no name or meaning and must be 0 */
17 	lowcore->pgm_new_psw.mask = BIT(63 - 12);
18 	lowcore->pgm_new_psw.addr = 0xdeadbeee;
19 	asm volatile ("lpsw %0" :: "Q"(bad_psw));
20 	return 0;
21 }
22