xref: /openbmc/qemu/tests/tcg/xtensa/test_phys_mem.S (revision 503bb0b9)
1#include "macros.inc"
2
3test_suite phys_mem
4
5.purgem test_init
6
7.macro test_init
8    movi    a2, 0xc0000003 /* PPN */
9    movi    a3, 0xc0000004 /* VPN */
10    wdtlb   a2, a3
11    witlb   a2, a3
12    movi    a2, 0xc0000000
13    wsr     a2, ptevaddr
14.endm
15
16test inst_fetch_get_pte_no_phys
17    set_vector kernel, 2f
18
19    movi    a2, 0x20000000
20    jx      a2
212:
22    movi    a2, 0x20000000
23    rsr     a3, excvaddr
24    assert  eq, a2, a3
25    rsr     a3, epc1
26    assert  eq, a2, a3
27    rsr     a3, exccause
28    movi    a2, 16
29    assert  eq, a2, a3
30test_end
31
32test read_get_pte_no_phys
33    set_vector kernel, 2f
34
35    movi    a2, 0x20000000
361:
37    l32i    a3, a2, 0
38    test_fail
392:
40    movi    a2, 0x20000000
41    rsr     a3, excvaddr
42    assert  eq, a2, a3
43    movi    a2, 1b
44    rsr     a3, epc1
45    assert  eq, a2, a3
46    rsr     a3, exccause
47    movi    a2, 24
48    assert  eq, a2, a3
49test_end
50
51test write_get_pte_no_phys
52    set_vector kernel, 2f
53
54    movi    a2, 0x20000000
551:
56    s32i    a3, a2, 0
57    test_fail
582:
59    movi    a2, 0x20000000
60    rsr     a3, excvaddr
61    assert  eq, a2, a3
62    movi    a2, 1b
63    rsr     a3, epc1
64    assert  eq, a2, a3
65    rsr     a3, exccause
66    movi    a2, 24
67    assert  eq, a2, a3
68test_end
69
70test inst_fetch_no_phys
71    set_vector kernel, 2f
72
73    movi    a2, 0xc0000000
74    jx      a2
752:
76    movi    a2, 0xc0000000
77    rsr     a3, excvaddr
78    assert  eq, a2, a3
79    rsr     a3, epc1
80    assert  eq, a2, a3
81    rsr     a3, exccause
82    movi    a2, 14
83    assert  eq, a2, a3
84test_end
85
86test read_no_phys
87    set_vector kernel, 2f
88
89    movi    a2, 0xc0000000
901:
91    l32i    a3, a2, 0
92    test_fail
932:
94    movi    a2, 0xc0000000
95    rsr     a3, excvaddr
96    assert  eq, a2, a3
97    movi    a2, 1b
98    rsr     a3, epc1
99    assert  eq, a2, a3
100    rsr     a3, exccause
101    movi    a2, 15
102    assert  eq, a2, a3
103test_end
104
105test write_no_phys
106    set_vector kernel, 2f
107
108    movi    a2, 0xc0000000
1091:
110    s32i    a3, a2, 0
111    test_fail
1122:
113    movi    a2, 0xc0000000
114    rsr     a3, excvaddr
115    assert  eq, a2, a3
116    movi    a2, 1b
117    rsr     a3, epc1
118    assert  eq, a2, a3
119    rsr     a3, exccause
120    movi    a2, 15
121    assert  eq, a2, a3
122test_end
123
124test_suite_end
125