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