aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/xtensa/test_phys_mem.S
blob: 9bb3ee3866edcdbe15123a10b6f584d8be15056e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#include "macros.inc"

test_suite phys_mem

#if XCHAL_HAVE_PTP_MMU && !XCHAL_HAVE_SPANNING_WAY

.purgem test_init

.macro test_init
    movi    a2, 0xc0000003 /* PPN */
    movi    a3, 0xc0000004 /* VPN */
    wdtlb   a2, a3
    witlb   a2, a3
    movi    a2, 0xc0000000
    wsr     a2, ptevaddr
.endm

test inst_fetch_get_pte_no_phys
    set_vector kernel, 2f

    movi    a2, 0x20000000
    jx      a2
2:
    movi    a2, 0x20000000
    rsr     a3, excvaddr
    assert  eq, a2, a3
    rsr     a3, epc1
    assert  eq, a2, a3
    rsr     a3, exccause
    movi    a2, 16
    assert  eq, a2, a3
test_end

test read_get_pte_no_phys
    set_vector kernel, 2f

    movi    a2, 0x20000000
1:
    l32i    a3, a2, 0
    test_fail
2:
    movi    a2, 0x20000000
    rsr     a3, excvaddr
    assert  eq, a2, a3
    movi    a2, 1b
    rsr     a3, epc1
    assert  eq, a2, a3
    rsr     a3, exccause
    movi    a2, 24
    assert  eq, a2, a3
test_end

test write_get_pte_no_phys
    set_vector kernel, 2f

    movi    a2, 0x20000000
1:
    s32i    a3, a2, 0
    test_fail
2:
    movi    a2, 0x20000000
    rsr     a3, excvaddr
    assert  eq, a2, a3
    movi    a2, 1b
    rsr     a3, epc1
    assert  eq, a2, a3
    rsr     a3, exccause
    movi    a2, 24
    assert  eq, a2, a3
test_end

#endif

test inst_fetch_no_phys
    set_vector kernel, 2f

    movi    a2, 0xc0000000
    jx      a2
2:
    movi    a2, 0xc0000000
    rsr     a3, excvaddr
    assert  eq, a2, a3
    rsr     a3, epc1
    assert  eq, a2, a3
    rsr     a3, exccause
    movi    a2, 14
    assert  eq, a2, a3
test_end

test read_no_phys
    set_vector kernel, 2f

    movi    a2, 0xc0000000
1:
    l32i    a3, a2, 0
    test_fail
2:
    movi    a2, 0xc0000000
    rsr     a3, excvaddr
    assert  eq, a2, a3
    movi    a2, 1b
    rsr     a3, epc1
    assert  eq, a2, a3
    rsr     a3, exccause
    movi    a2, 15
    assert  eq, a2, a3
test_end

test write_no_phys
    set_vector kernel, 2f

    movi    a2, 0xc0000000
1:
    s32i    a3, a2, 0
    test_fail
2:
    movi    a2, 0xc0000000
    rsr     a3, excvaddr
    assert  eq, a2, a3
    movi    a2, 1b
    rsr     a3, epc1
    assert  eq, a2, a3
    rsr     a3, exccause
    movi    a2, 15
    assert  eq, a2, a3
test_end

test_suite_end