source: trunk/softs/tests_ccvcache_v4/test_idtlb_ptprinval/test.S @ 232

Last change on this file since 232 was 232, checked in by alain, 12 years ago

Introducing the elementary tests for a TSAR mono-cluster
mono-processor platform with MMU using the vci_cc_vcache_v4
such as the "tsarv4_mono_mmu".
(assemby level tests written by Manuel Bouyer)

File size: 3.5 KB
Line 
1/*
2 * itlb inval on PTPR write: check that no stale entry exists in the itlb
3 * after MMU context swicth
4 */
5#include <registers.h>
6#include <misc.h>
7#include <vcache.h>
8        .text
9        .globl  _start
10_start:
11        .set noreorder
12        la      k0, TTY_BASE
13        la      k1, EXIT_BASE
14
15        PRINT(startstr)
16
17        /* reset cop0 status (keep BEV) */
18        lui     a0, 0x0040;
19        mtc0    a0, COP0_STATUS
20
21        la      a0, pte1_b
22        srl     a0, a0, 13
23        mtc2    a0, VC_PTPR
24        nop
25
26        li      a0, VC_TLB_EN_ITLB | VC_TLB_EN_DTLB | VC_TLB_EN_ICACHE | VC_TLB_EN_DCACHE
27        mtc2    a0, VC_TLB_EN
28
29        PRINT(mmustr_b)
30        la      t0, rodata
31        lw      a0, 0(t0)
32        PRINTX
33        PUTCHAR(' ')
34        jal     doload
35        nop
36        PRINTX
37        PUTCHAR('\n')
38        la      a0, pte1_a
39        srl     a0, a0, 13
40        mtc2    a0, VC_PTPR
41        nop
42#if 0 /* works with this - this shows the old pte2 address is cached */
43        la      a0, pte2_a
44        lw      a1, 12(a0)
45        la      a0, pte2_b
46        sw      a1, 12(a0)
47#endif
48        PRINT(mmustr_a)
49        la      t0, rodata
50        lw      a0, 0(t0)
51        PRINTX
52        PUTCHAR(' ')
53        jal     doload
54        nop
55        PRINTX
56        PUTCHAR('\n')
57
58        /* we should get there */
59        EXIT(0)
60
61        .globl excep
62excep:
63        .set noreorder
64        PRINT(statusstr)
65        mfc0    a0, COP0_STATUS
66        PRINTX
67
68        PRINT(causestr)
69        mfc0    a0, COP0_CAUSE
70        PRINTX
71
72        PRINT(pcstr)
73        mfc0    a0, COP0_EXPC
74        PRINTX
75
76        PRINT(badvastr)
77        mfc0    a0, COP_0_BADVADDR
78        PRINTX
79
80        PUTCHAR('\n')
81        /* we should not get there */
82        EXIT(3)
83
84        .rodata:
85statusstr: .ascii "status \0"
86causestr: .ascii " cause \0"
87pcstr: .ascii " pc \0"
88badvastr: .ascii " badva \0"
89mmustr_a: .ascii "mmu started ptpr_a \0"
90mmustr_b: .ascii "mmu started ptpr_b \0"
91startstr: .ascii "start\n\0"
92
93        .org EXCEP_ADDRESS - BOOT_ADDRESS
94        .globl evect
95evect:
96        j       excep
97        nop
98
99        /*
100         * code that will be switched by MMU switch.
101         * we use a ldscript trick here, to load this function at
102         * the appropriate address
103         */
104        .section .text2, "ax"
105        .globl doload
106doload:
107        jr      ra
108        li      a0, MAGIC1
109        /* we should not get there */
110        EXIT(1)
111        nop
112rodata:
113        .word MAGIC2
114        .org doload + 0x1000 /* in the second page, mapped by pte1_b */
115        jr ra
116        li      a0, MAGIC2
117        /* we should not get there */
118        EXIT(2)
119        nop
120        .word MAGIC1
121
122        .data
123        .word MAGIC1
124testval:
125        .word MAGIC2
126        .globl pte2_a
127
128/*
129 * two PD with two different PTE2 for code: check that itlb points to
130 * the right one by executing 2 different code at the same address
131 */
132pte2_a:
133        .align 12
134        .word PTE2_V | PTE2_C | PTE2_X
135        .word BOOT_ADDRESS >> 12
136        .word PTE2_V | PTE2_C | PTE2_X
137        .word (BOOT_ADDRESS+0x1000) >> 12
138        .org pte2_a + 4092
139        .word 0
140        .globl pte2_b
141pte2_b:
142        .align 12
143        .word PTE2_V | PTE2_C | PTE2_X
144        .word BOOT_ADDRESS >> 12
145        .word PTE2_V | PTE2_C | PTE2_X
146        .word (BOOT_ADDRESS+0x2000) >> 12
147        .org pte2_b + 4092
148        .word 0
149        .globl pte1_a
150pte1_a:
151        .align 13
152        .word PTE1_V | PTE1_C | PTE1_W | 0x0 /* map PA 0 at VA 0 */
153        .word 0x0
154        .org pte1_a + (BOOT_ADDRESS >> 21) * 4
155        .word PTE1_V | PTE1_T | (0x1000 >> 12) /* map PA 0xbfc00000 at VA 0xbfc00000 with 4k page: check real address of pte2_a !!! */
156        .org pte1_a + (TTY_BASE >> 21) * 4
157        .word PTE1_V | PTE1_W | (TTY_BASE >> 21) /* map PA 0xd0200000 at VA 0xd0200000 */
158        .org pte1_a + (EXIT_BASE >> 21) * 4
159        .word PTE1_V | PTE1_W | (EXIT_BASE >> 21) /* map PA 0xe0000000 at VA 0xe0000000 */
160        .org pte1_a + 8192
161        .globl pte1_b
162pte1_b:
163        .align 13
164        .word PTE1_V | PTE1_C | PTE1_W | 0x0 /* map PA 0 at VA 0 */
165        .word 0x0
166        .org pte1_b + (BOOT_ADDRESS >> 21) * 4
167        .word PTE1_V | PTE1_T | (0x2000 >> 12) /* map PA 0xbfc00000 at VA 0xbfc00000 with 4k page: check real address of pte2_b !!! */
168        .org pte1_b + (TTY_BASE >> 21) * 4
169        .word PTE1_V | PTE1_W | (TTY_BASE >> 21) /* map PA 0xd0200000 at VA 0xd0200000 */
170        .org pte1_b + (EXIT_BASE >> 21) * 4
171        .word PTE1_V | PTE1_W | (EXIT_BASE >> 21) /* map PA 0xe0000000 at VA 0xe0000000 */
172        .org pte1_b + 8188
173        .word 0
Note: See TracBrowser for help on using the repository browser.