source: trunk/softs/tests_ccvcache_v4/test_pte_llsc/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.4 KB
Line 
1/*
2 * Check that the MMU doens't clobber the OS bits in PTEs, and interraction
3 * with ll/sc
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        /* reset cop0 status (keep BEV) */
17        lui     a0, 0x0040;
18        mtc0    a0, COP0_STATUS
19
20        la      a0, pte1
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        /* do a swap of pte2[0] to make the entry valid */
29        la      s0, pte2 + 0x00200000
301:      la      a1, PTE2_V | PTE2_C | PTE2_W | PTE2_os
31        ll      a0, 0(s0)
32        sc      a1, 0(s0)
33        beqz    a1, 1b
34        nop
35        PRINTX
36        PUTCHAR(' ')
37        /* now write to myvar via pte2[0] */
38        li      a0, MAGIC2
39        la      s1, myvar + 0x00200000
40        sw      a0, 0(s1)
41        /*
42         * and invalidate pte2[0], again using a swap
43         * check that we get the same value with lw and ll
44         */
45        lw      s1, 0(s0)
462:
47        move    a1, zero
48        ll      a0, 0(s0)
49        sc      a1, 0(s0)
50        beqz    a1, 2b
51        PRINTX
52        PUTCHAR(' ')
53        move    a0, s1
54        PRINTX
55        PUTCHAR(' ')
56        /* finally check what lw tells us now */
57        lw      a0, 0(s0)
58        PRINTX
59        PUTCHAR('\n')
60
61        EXIT(0)
62
63        .globl excep
64excep:
65        .set noreorder
66        PRINT(statusstr)
67        mfc0    a0, COP0_STATUS
68        PRINTX
69
70        PRINT(causestr)
71        mfc0    a0, COP0_CAUSE
72        PRINTX
73
74        PRINT(pcstr)
75        mfc0    a0, COP0_EXPC
76        PRINTX
77
78        PRINT(badvastr)
79        mfc0    a0, COP_0_BADVADDR
80        PRINTX
81
82        PUTCHAR('\n')
83        /* we should not get there */
84        EXIT(1)
85
86        .rodata:
87statusstr: .ascii "status \0"
88causestr: .ascii " cause \0"
89pcstr: .ascii " pc \0"
90badvastr: .ascii " badva \0"
91value:  .word 0x1234abcd
92string: .ascii "hello world \0"
93
94        .org EXCEP_ADDRESS - BOOT_ADDRESS
95        .globl evect
96evect:
97        j       excep
98        nop
99
100        .data
101myvar:  .word MAGIC1
102        .globl pte1
103pte2:
104        .align 12
105        .word 0 /* invalid for now */
106        .word 0x0000 >> 12 /* check real value of myvar */
107        .word PTE2_V | PTE2_C | PTE2_W | PTE2_os /* map pte2 too */
108        .word 0x1000 >> 12 /* check real address of pte2 */
109        .org pte2 + 4092
110        .word 0
111        .globl pte1
112pte1:
113        .align 13
114        .word PTE1_V | PTE1_C | PTE1_W | 0x0 /* map PA 0 at VA 0 */
115        .word PTE1_V | PTE1_T | (0x1000 >> 12) /* map PA 0x0 at VA 0x00200000 via pte2 */
116        .org pte1 + (BOOT_ADDRESS >> 21) * 4
117        .word PTE1_V | PTE1_C | PTE1_X | (BOOT_ADDRESS >> 21) /* map PA 0xbfc00000 at VA 0xbfc00000 */
118        .org pte1 + (TTY_BASE >> 21) * 4
119        .word PTE1_V | PTE1_W | (TTY_BASE >> 21) /* map PA 0xd0200000 at VA 0xd0200000 */
120        .org pte1 + (EXIT_BASE >> 21) * 4
121        .word PTE1_V | PTE1_W | (EXIT_BASE >> 21) /* map PA 0xe0000000 at VA 0xe0000000 */
122        .org pte1 + 8192
123        .word 0
124
Note: See TracBrowser for help on using the repository browser.