xref: /openbmc/qemu/tests/tcg/s390x/sam.S (revision c8db90b8)
1/* DAT on, home-space mode, 64-bit mode */
2#define DAT_PSWM 0x400c00180000000
3#define VIRTUAL_BASE 0x123456789abcd000
4
5    .org 0x8e
6program_interruption_code:
7    .org 0x150
8program_old_psw:
9    .org 0x1d0                         /* program new PSW */
10    .quad 0,pgm_handler
11    .org 0x200                         /* lowcore padding */
12
13    .globl _start
14_start:
15    lctlg %c13,%c13,hasce
16    lpswe dat_psw
17start_dat:
18    sam24
19sam24_suppressed:
20    /* sam24 should fail */
21fail:
22    basr %r12,%r0
23    lpswe failure_psw-.(%r12)
24pgm_handler:
25    chhsi program_interruption_code,6  /* specification exception? */
26    jne fail
27    clc suppressed_psw(16),program_old_psw  /* correct location? */
28    jne fail
29    lpswe success_psw
30
31    .align 8
32dat_psw:
33    .quad DAT_PSWM,VIRTUAL_BASE+start_dat
34suppressed_psw:
35    .quad DAT_PSWM,VIRTUAL_BASE+sam24_suppressed
36success_psw:
37    .quad 0x2000000000000,0xfff        /* see is_special_wait_psw() */
38failure_psw:
39    .quad 0x2000000000000,0            /* disabled wait */
40hasce:
41    /* DT = 0b11 (region-first-table), TL = 3 (2k entries) */
42    .quad region_first_table + (3 << 2) + 3
43    .align 0x1000
44region_first_table:
45    .org region_first_table + ((VIRTUAL_BASE >> 53) & 0x7ff) * 8
46    /* TT = 0b11 (region-first-table), TL = 3 (2k entries) */
47    .quad region_second_table + (3 << 2) + 3
48    .org region_first_table + 0x800 * 8
49region_second_table:
50    .org region_second_table + ((VIRTUAL_BASE >> 42) & 0x7ff) * 8
51    /* TT = 0b10 (region-second-table), TL = 3 (2k entries) */
52    .quad region_third_table + (2 << 2) + 3
53    .org region_second_table + 0x800 * 8
54region_third_table:
55    .org region_third_table + ((VIRTUAL_BASE >> 31) & 0x7ff) * 8
56    /* TT = 0b01 (region-third-table), TL = 3 (2k entries) */
57    .quad segment_table + (1 << 2) + 3
58    .org region_third_table + 0x800 * 8
59segment_table:
60    .org segment_table + ((VIRTUAL_BASE >> 20) & 0x7ff) * 8
61    /* TT = 0b00 (segment-table) */
62    .quad page_table
63    .org segment_table + 0x800 * 8
64page_table:
65    .org page_table + ((VIRTUAL_BASE >> 12) & 0xff) * 8
66    .quad 0
67    .org page_table + 0x100 * 8
68