source: trunk/softs/tests_ccvcache_v4/test_dtlb_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.1 KB
Line 
1/*
2 * dtlb inval on PTPR write: check that no stale entry exists in the dtlb
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     # PTPR <= pte1_b
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, testval + 0x00200000
31        lw      a0, 0(t0);
32        PRINTX                  # print MAGIC3
33        PUTCHAR('\n')
34
35        la      a0, pte1_a
36        srl     a0, a0, 13
37        mtc2    a0, VC_PTPR     # PTPR <= pte1_a
38        nop
39        PRINT(mmustr_a)
40        la      t0, testval + 0x00200000
41        lw      a0, 0(t0);
42        PRINTX                  # print MAGIC1
43        PUTCHAR('\n')
44
45        /* we should get there */
46        EXIT(0)
47
48        .globl excep
49excep:
50        .set noreorder
51        PRINT(statusstr)
52        mfc0    a0, COP0_STATUS
53        PRINTX
54
55        PRINT(causestr)
56        mfc0    a0, COP0_CAUSE
57        PRINTX
58
59        PRINT(pcstr)
60        mfc0    a0, COP0_EXPC
61        PRINTX
62
63        PRINT(badvastr)
64        mfc0    a0, COP_0_BADVADDR
65        PRINTX
66
67        PUTCHAR('\n')
68        /* we should not get there */
69        EXIT(3)
70
71        .rodata:
72statusstr: .ascii "status \0"
73causestr: .ascii " cause \0"
74pcstr: .ascii " pc \0"
75badvastr: .ascii " badva \0"
76mmustr_a: .ascii "mmu started ptpr_a \0"
77mmustr_b: .ascii "mmu started ptpr_b \0"
78startstr: .ascii "start\n\0"
79
80        .org EXCEP_ADDRESS - BOOT_ADDRESS
81        .globl evect
82evect:
83        j       excep
84        nop
85
86        .data
87        /* first 2 pages is data that will be switched my mmu switch */
88data_a:
89        .word MAGIC1
90testval:
91        .word MAGIC2
92        .org data_a + 0x1000
93data_b:
94        .word MAGIC3
95        .word MAGIC4
96
97/*
98 * two PD with two different PTE2 for code: check that dtlb points to
99 * the right one by loading 2 different data at the same virtual address
100 */
101        .globl pte2_a
102pte2_a:
103        .align 12
104        .word PTE2_V | PTE2_C | PTE2_X
105        .word 0x0000 >> 12 /* check real value of data_a */
106
107        .org pte2_a + 4092
108        .word 0
109        .globl pte2_b
110pte2_b:
111        .align 12
112        .word PTE2_V | PTE2_C | PTE2_X
113        .word 0x1000 >> 12 /* check real value of data_b */
114
115        .org pte2_b + 4092
116        .word 0
117
118        .globl pte1_a
119pte1_a:
120        .align 13
121        .word PTE1_V | PTE1_C | PTE1_W | 0x0 /* map PA 0 at VA 0 */
122        .word PTE1_V | PTE1_T | (0x2000 >> 12) /* map PA 0x0 at VA 0x00200000 via pte2_a */
123
124        .org pte1_a + (BOOT_ADDRESS >> 21) * 4
125        .word PTE1_V | PTE1_C | PTE1_X | (BOOT_ADDRESS >> 21) /* map PA 0xbfc00000 at VA 0xbfc00000 */
126
127        .org pte1_a + (TTY_BASE >> 21) * 4
128        .word PTE1_V | PTE1_W | (TTY_BASE >> 21) /* map PA 0xd0200000 at VA 0xd0200000 */
129
130        .org pte1_a + (EXIT_BASE >> 21) * 4
131        .word PTE1_V | PTE1_W | (EXIT_BASE >> 21) /* map PA 0xe0000000 at VA 0xe0000000 */
132        .org pte1_a + 8192
133        .globl pte1_b
134pte1_b:
135        .align 13
136        .word PTE1_V | PTE1_C | PTE1_W | 0x0 /* map PA 0 at VA 0 */
137        .word PTE1_V | PTE1_T | (0x3000 >> 12) /* map PA 0x1000 at VA 0x00200000 via pte2_b */
138        .org pte1_b + (BOOT_ADDRESS >> 21) * 4
139        .word PTE1_V | PTE1_C | PTE1_X | (BOOT_ADDRESS >> 21) /* map PA 0xbfc00000 at VA 0xbfc00000 */
140        .org pte1_b + (TTY_BASE >> 21) * 4
141        .word PTE1_V | PTE1_W | (TTY_BASE >> 21) /* map PA 0xd0200000 at VA 0xd0200000 */
142        .org pte1_b + (EXIT_BASE >> 21) * 4
143        .word PTE1_V | PTE1_W | (EXIT_BASE >> 21) /* map PA 0xe0000000 at VA 0xe0000000 */
144        .org pte1_b + 8188
145        .word 0
Note: See TracBrowser for help on using the repository browser.