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