Last change
on this file since 423 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:
1.9 KB
|
Line | |
---|
1 | /* |
---|
2 | * Basic MMU checks: we can read mapped addresses, we can't read unmapped |
---|
3 | * addresses |
---|
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 | PRINT(startstr) |
---|
17 | |
---|
18 | la a0, pte1 |
---|
19 | srl a0, a0, 13 |
---|
20 | mtc2 a0, VC_PTPR |
---|
21 | nop |
---|
22 | |
---|
23 | li a0, VC_TLB_EN_ITLB | VC_TLB_EN_DTLB | VC_TLB_EN_ICACHE | VC_TLB_EN_DCACHE |
---|
24 | mtc2 a0, VC_TLB_EN |
---|
25 | |
---|
26 | PRINT(mmustr) |
---|
27 | |
---|
28 | /* we can read our magic number at 0x00200000 */ |
---|
29 | la s0, 0x00200000 |
---|
30 | move a0, s0 |
---|
31 | PRINTX |
---|
32 | PUTCHAR(':') |
---|
33 | PUTCHAR(' ') |
---|
34 | lw a0, 0(s0) |
---|
35 | PRINTX |
---|
36 | PUTCHAR('\n') |
---|
37 | /* but not at 0x00000000 */ |
---|
38 | la s0, 0x00000000 |
---|
39 | move a0, s0 |
---|
40 | PRINTX |
---|
41 | PUTCHAR(':') |
---|
42 | PUTCHAR(' ') |
---|
43 | lw a0, 0(s0) /* this should trigger the exception */ |
---|
44 | PRINTX |
---|
45 | |
---|
46 | /* we shouldn't get there */ |
---|
47 | EXIT(1) |
---|
48 | |
---|
49 | .globl excep |
---|
50 | excep: |
---|
51 | .set noreorder |
---|
52 | PRINT(statusstr) |
---|
53 | mfc0 a0, COP0_STATUS |
---|
54 | PRINTX |
---|
55 | |
---|
56 | PRINT(causestr) |
---|
57 | mfc0 a0, COP0_CAUSE |
---|
58 | PRINTX |
---|
59 | |
---|
60 | PRINT(pcstr) |
---|
61 | mfc0 a0, COP0_EXPC |
---|
62 | PRINTX |
---|
63 | |
---|
64 | PRINT(badvastr) |
---|
65 | mfc0 a0, COP_0_BADVADDR |
---|
66 | PRINTX |
---|
67 | |
---|
68 | li a0, '\n' |
---|
69 | sb a0, 0(k0) |
---|
70 | |
---|
71 | EXIT(0) |
---|
72 | |
---|
73 | .rodata: |
---|
74 | statusstr: .ascii "status \0" |
---|
75 | causestr: .ascii " cause \0" |
---|
76 | pcstr: .ascii " pc \0" |
---|
77 | badvastr: .ascii " badva \0" |
---|
78 | mmustr: .ascii "mmu started\n\0" |
---|
79 | startstr: .ascii "start\n\0" |
---|
80 | |
---|
81 | .org EXCEP_ADDRESS - BOOT_ADDRESS |
---|
82 | .globl evect |
---|
83 | evect: |
---|
84 | j excep |
---|
85 | nop |
---|
86 | .data |
---|
87 | testval: |
---|
88 | .word MAGIC1 |
---|
89 | .align 13 |
---|
90 | .globl pte1 |
---|
91 | pte1: |
---|
92 | .word 0x0 /* map PA 0 at VA 0 */ |
---|
93 | .word PTE1_V | PTE1_C | PTE1_W | 0x0 /* map PA 0 at VA 0x00200000 */ |
---|
94 | .org pte1 + (BOOT_ADDRESS >> 21) * 4 |
---|
95 | .word PTE1_V | PTE1_C | PTE1_X | (BOOT_ADDRESS >> 21) /* map PA 0xbfc00000 at VA 0xbfc00000 */ |
---|
96 | .org pte1 + (TTY_BASE >> 21) * 4 |
---|
97 | .word PTE1_V | PTE1_W | (TTY_BASE >> 21) /* map PA 0xd0200000 at VA 0xd0200000 */ |
---|
98 | .org pte1 + (EXIT_BASE >> 21) * 4 |
---|
99 | .word PTE1_V | PTE1_W | (EXIT_BASE >> 21) /* map PA 0xe0000000 at VA 0xe0000000 */ |
---|
100 | .org pte1 + 8192 |
---|
101 | .word 0 |
---|
102 | |
---|
Note: See
TracBrowser
for help on using the repository browser.