source: trunk/softs/tests_cc_vcache/test_dtlb_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.3 KB
Line 
1/*
2 * dtlb inval: a write to a PTE2 should invalidate the corresponding
3 * dtlb entry.
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_a
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)
30        la      t0, testval + 0x00200000
31        lw      a0, 0(t0);
32        PRINTX
33        PUTCHAR(' ')
34        la      t0, pte2_a
35        la      a0, 0x1000 >> 12
36        sw      a0, 4(t0) /* swap PTE2 entry */
371:
38        ll      a0, 0(t0)
39        la      a0, PTE2_V | PTE2_C | PTE2_X
40        sc      a0, 0(t0)
41        beqz    a0, 1b
42        nop
43
44        la      t0, testval + 0x00200000
45        lw      a0, 0(t0); /* should get MAGIC1 */
46        PRINTX
47        PUTCHAR('\n')
48
49        /* we should get there */
50        EXIT(0)
51
52        .globl excep
53excep:
54        .set noreorder
55        PRINT(statusstr)
56        mfc0    a0, COP0_STATUS
57        PRINTX
58
59        PRINT(causestr)
60        mfc0    a0, COP0_CAUSE
61        PRINTX
62
63        PRINT(pcstr)
64        mfc0    a0, COP0_EXPC
65        PRINTX
66
67        PRINT(badvastr)
68        mfc0    a0, COP_0_BADVADDR
69        PRINTX
70
71        PUTCHAR('\n')
72        /* we should not get there */
73        EXIT(1)
74
75        .rodata:
76statusstr: .ascii "status \0"
77causestr: .ascii " cause \0"
78pcstr: .ascii " pc \0"
79badvastr: .ascii " badva \0"
80mmustr: .ascii "mmu started \0"
81startstr: .ascii "start\n\0"
82
83        .org EXCEP_ADDRESS - BOOT_ADDRESS
84        .globl evect
85evect:
86        j       excep
87        nop
88
89        .data
90        /* first 2 pages is data that will be switched my mmu switch */
91data_a:
92        .word MAGIC1
93testval:
94        .word MAGIC2
95        .align 12
96        .word MAGIC2
97        .word MAGIC1
98        .globl pte2_a
99/*
100 * one PD with a level 2 PTP: we switch an entry in the PTP and
101 * check that the dtlb is invalidated
102 */
103pte2_a:
104        .align 12
105        .word PTE2_V | PTE2_C | PTE2_X
106        .word 0x0000 >> 12 /* check real value of data_a */
107        .org pte2_a + 4092
108        .word 0
109        .globl pte2_b
110        .globl pte1_a
111pte1_a:
112        .align 13
113        .word PTE1_V | PTE1_C | PTE1_W | 0x0 /* map PA 0 at VA 0 */
114        .word PTE1_V | PTE1_T | (0x2000 >> 12) /* map PA 0x0 at VA 0x00200000 via pte2_a */
115        .org pte1_a + (BOOT_ADDRESS >> 21) * 4
116        .word PTE1_V | PTE1_C | PTE1_X | (BOOT_ADDRESS >> 21) /* map PA 0xbfc00000 at VA 0xbfc00000 */
117        .org pte1_a + (TTY_BASE >> 21) * 4
118        .word PTE1_V | PTE1_W | (TTY_BASE >> 21) /* map PA 0xd0200000 at VA 0xd0200000 */
119        .org pte1_a + (EXIT_BASE >> 21) * 4
120        .word PTE1_V | PTE1_W | (EXIT_BASE >> 21) /* map PA 0xe0000000 at VA 0xe0000000 */
121        .org pte1_a + 8192
Note: See TracBrowser for help on using the repository browser.