source: trunk/softs/tests_ccvcache_v4/test_pte2sc_dirty/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.7 KB
Line 
1/*
2 * pte2d_ref: a sc to data should set the dirty bits in PTE
3 */
4#include <registers.h>
5#include <misc.h>
6#include <vcache.h>
7        .text
8        .globl  _start
9_start:
10        .set noreorder
11        la      k0, TTY_BASE
12        la      k1, EXIT_BASE
13
14        PRINT(startstr)
15
16        /* reset cop0 status (keep BEV) */
17        lui     a0, 0x0040;
18        mtc0    a0, COP0_STATUS
19
20        la      a0, pte1_a
21        srl     a0, a0, 13
22        mtc2    a0, VC_PTPR
23        nop
24
25        li      a0, VC_TLB_EN_ITLB | VC_TLB_EN_DTLB | VC_TLB_EN_ICACHE | VC_TLB_EN_DCACHE
26        mtc2    a0, VC_TLB_EN
27
28        PRINT(mmustr)
29        la      s0, pte2_a
30        lw      s1, 0(s0) /* get PTE */
31        move    a0, s1
32        PRINTX
33        PUTCHAR(' ')
34        la      a1, (PTE2_L | PTE2_D)
35        and     a0, s1, a1
36        bne     a0, zero, fail /* PTE2_L or PTE2_D already set, not good */
37        nop
38
39        la      t0, testval + 0x00200000
40        la      a1, MAGIC3
411:
42        ll      a0, 0(t0)
43        sc      a1, 0(t0); /* cause page to be referenced and dirty */
44        beqz    a1, 1b
45        nop
46
47        lw      s1, 0(s0) /* get PTE */
48        move    a0, s1
49        PRINTX
50        PUTCHAR(' ')
51        la      a1, (PTE2_L | PTE2_D)
52        and     a0, s1, a1
53        bne     a0, a1, fail /* PTE2_L not set, not good */
54        nop
55
56        /* check again, using ll */
57        ll      s1, 0(s0) /* get PTE */
58        move    a0, s1
59        PRINTX
60        PUTCHAR('\n')
61        la      a1, (PTE2_L | PTE2_D)
62        and     a0, s1, a1
63        bne     a0, a1, fail /* PTE2_L not set, not good */
64        nop
65
66        EXIT(0)
67fail:
68        /* we should not get there */
69        EXIT(1)
70
71        .globl excep
72excep:
73        .set noreorder
74        PRINT(statusstr)
75        mfc0    a0, COP0_STATUS
76        PRINTX
77
78        PRINT(causestr)
79        mfc0    a0, COP0_CAUSE
80        PRINTX
81
82        PRINT(pcstr)
83        mfc0    a0, COP0_EXPC
84        PRINTX
85
86        PRINT(badvastr)
87        mfc0    a0, COP_0_BADVADDR
88        PRINTX
89
90        PUTCHAR('\n')
91        /* we should get there */
92        EXIT(0)
93
94        .rodata:
95statusstr: .ascii "status \0"
96causestr: .ascii " cause \0"
97pcstr: .ascii " pc \0"
98badvastr: .ascii " badva \0"
99mmustr: .ascii "mmu started \0"
100startstr: .ascii "start\n\0"
101
102        .org EXCEP_ADDRESS - BOOT_ADDRESS
103        .globl evect
104evect:
105        j       excep
106        nop
107
108        .data
109        /* first 2 pages is data that will be switched my mmu switch */
110data_a:
111        .word MAGIC1
112testval:
113        .word MAGIC2
114        .globl pte2_a
115/*
116 * one PD with a level 2 PTP: we invalidate an entry in the PTP and
117 * check that the VA is no longer accessible
118 */
119pte2_a:
120        .align 12
121        .word PTE2_V | PTE2_C | PTE2_X | PTE2_W
122        .word 0x0000 >> 12 /* check real value of data_a */
123        .org pte2_a + 4092
124        .word 0
125        .globl pte2_b
126        .globl pte1_a
127pte1_a:
128        .align 13
129        .word PTE1_V | PTE1_C | PTE1_W | 0x0 /* map PA 0 at VA 0 */
130        .word PTE1_V | PTE1_T | (0x1000 >> 12) /* map PA 0x0 at VA 0x00200000 via pte2_a */
131        .org pte1_a + (BOOT_ADDRESS >> 21) * 4
132        .word PTE1_V | PTE1_C | PTE1_X | (BOOT_ADDRESS >> 21) /* map PA 0xbfc00000 at VA 0xbfc00000 */
133        .org pte1_a + (TTY_BASE >> 21) * 4
134        .word PTE1_V | PTE1_W | (TTY_BASE >> 21) /* map PA 0xd0200000 at VA 0xd0200000 */
135        .org pte1_a + (EXIT_BASE >> 21) * 4
136        .word PTE1_V | PTE1_W | (EXIT_BASE >> 21) /* map PA 0xe0000000 at VA 0xe0000000 */
137        .org pte1_a + 8192
Note: See TracBrowser for help on using the repository browser.