xref: /kvm-unit-tests/s390x/snippets/asm/pv-diag-500.S (revision 1d0f08f40d53daa39566842ec46a112db5f7e524)
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Diagnose 0x500 snippet used for PV interception tests
4 *
5 * Copyright (c) 2021 IBM Corp
6 *
7 * Authors:
8 *  Janosch Frank <frankja@linux.ibm.com>
9 */
10#include <asm/asm-offsets.h>
11#include "macros.S"
12.section .text
13
14/* Clean and pre-load registers that are used for diag 500 */
15xgr	%r1, %r1
16xgr	%r2, %r2
17xgr	%r3, %r3
18xgr	%r4, %r4
19lghi	%r1, 1
20lghi	%r2, 2
21lghi	%r3, 3
22lghi	%r4, 4
23
24/* Let's jump to the next label on a PGM */
25SET_PSW_NEW_ADDR 5, next, GEN_LC_PGM_NEW_PSW
26
27/* Execute the diag500 */
28diag	0, 0, 0x500
29
30/* Should never be executed because of the PGM */
31diag	0, 0, 0x44
32
33/* Execute again to test spec PGM injection*/
34next:
35lh	%r1, GEN_LC_PGM_INT_CODE
36diag	%r1, 0, 0x9c
37larl	%r5, done
38stg	%r5, GEN_LC_PGM_NEW_PSW + 8
39diag	0, 0, 0x500
40
41/* Should never be executed because of the PGM */
42diag	0, 0, 0x44
43
44done:
45lh	%r1, GEN_LC_PGM_INT_CODE
46diag	%r1, 0, 0x9c
47