source: trunk/softs/tests_cc_vcache/test_itlb_inval2/test.S @ 520

Last change on this file since 520 was 520, checked in by bouyer, 11 years ago

Re-add the tests; reverting previous which was done at the wrong level (sorry)

File size: 2.6 KB
Line 
1/*
2 * itlb inval: a write to a PTE2 should invalidate the corresponding
3 * itlb entry.
4 */
5#include <registers.h>
6#include <misc.h>
7#include <vcache.h>
8
9        .text
10        .globl  _start
11_start:
12        .set noreorder
13        la      k0, TTY_BASE
14        la      k1, EXIT_BASE
15
16        PRINT(startstr)
17
18        /* reset cop0 status (keep BEV) */
19        lui     a0, 0x0040;
20        mtc0    a0, COP0_STATUS
21
22        la      a0, pte1_a
23        srl     a0, a0, 13
24        mtc2    a0, VC_PTPR
25        nop
26
27        li      a0, VC_TLB_EN_ITLB | VC_TLB_EN_DTLB | VC_TLB_EN_ICACHE | VC_TLB_EN_DCACHE
28        mtc2    a0, VC_TLB_EN
29
30        PRINT(mmustr)
31        jal     doload
32        nop
33        PRINTX
34        PUTCHAR(' ')
35        la      t0, pte2_a
36        la      a0, (BOOT_ADDRESS+0x2000) >> 12
37        sw      a0, 12(t0) /* change PTE2 */
38        sync
391:
40        ll      a0, 8(t0)
41        la      a0, PTE2_V | PTE2_C | PTE2_X
42        sc      a0, 8(t0)
43        beqz    a0, 1b
44        nop
45
46        jal     doload /* now we should get the second value */
47        nop
48        PRINTX
49        PUTCHAR('\n')
50        /* we should get there */
51        EXIT(0)
52
53        .globl excep
54excep:
55        .set noreorder
56        PRINT(statusstr)
57        mfc0    a0, COP0_STATUS
58        PRINTX
59
60        PRINT(causestr)
61        mfc0    a0, COP0_CAUSE
62        PRINTX
63
64        PRINT(pcstr)
65        mfc0    a0, COP0_EXPC
66        PRINTX
67
68        PRINT(badvastr)
69        mfc0    a0, COP_0_BADVADDR
70        PRINTX
71
72        PUTCHAR('\n')
73        /* we should not get there */
74        EXIT(1)
75
76        .rodata:
77statusstr: .ascii "status \0"
78causestr: .ascii " cause \0"
79pcstr: .ascii " pc \0"
80badvastr: .ascii " badva \0"
81mmustr: .ascii "mmu started \0"
82startstr: .ascii "start\n\0"
83
84        .org EXCEP_ADDRESS - BOOT_ADDRESS
85        .globl evect
86evect:
87        j       excep
88        nop
89
90        /*
91         * code that will be switched by MMU switch.
92         * we use a ldscript trick here, to load this function at
93         * the appropriate address
94         */
95        .section .text2, "ax"
96        .globl doload
97doload:
98        jr      ra
99        li      a0, MAGIC1
100        /* we should not get there */
101        EXIT(1)
102        nop
103        .align 12
104        .globl doload2
105doload2:
106        jr      ra
107        li      a0, MAGIC2
108        /* we should not get there */
109        EXIT(1)
110        nop
111
112        .data
113        .word MAGIC1
114testval:
115        .word MAGIC2
116        .globl pte2_a
117
118/*
119 * one PD with a level 2 PTP: we change an entry in the PTP and
120 * check that the ITLB has been invalidated
121 */
122pte2_a:
123        .align 12
124        .word PTE2_V | PTE2_C | PTE2_X
125        .word BOOT_ADDRESS >> 12
126        .word PTE2_V | PTE2_C | PTE2_X
127        .word (BOOT_ADDRESS+0x1000) >> 12
128        .org pte2_a + 4092
129        .word 0
130        .globl pte2_b
131        .globl pte1_a
132pte1_a:
133        .align 13
134        .word PTE1_V | PTE1_C | PTE1_W | 0x0 /* map PA 0 at VA 0 */
135        .word 0x0
136        .org pte1_a + (BOOT_ADDRESS >> 21) * 4
137        .word PTE1_V | PTE1_T | (0x1000 >> 12) /* map PA 0xbfc00000 at VA 0xbfc00000 with 4k page: check real address of pte2_a !!! */
138        .org pte1_a + (TTY_BASE >> 21) * 4
139        .word PTE1_V | PTE1_W | (TTY_BASE >> 21) /* map PA 0xd0200000 at VA 0xd0200000 */
140        .org pte1_a + (EXIT_BASE >> 21) * 4
141        .word PTE1_V | PTE1_W | (EXIT_BASE >> 21) /* map PA 0xe0000000 at VA 0xe0000000 */
142        .org pte1_a + 8192
Note: See TracBrowser for help on using the repository browser.