Last change
on this file since 637 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.0 KB
|
Line | |
---|
1 | /* |
---|
2 | * load/store bus fault exception test: we can restart the faulting instruction |
---|
3 | * We use the MMU to cause fault |
---|
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 |
---|
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 | |
---|
31 | /* 0x00000000 not mapped yet: we fault, load the MMU and retry */ |
---|
32 | move a1, zero |
---|
33 | la s0, testval |
---|
34 | lw a1, 0(s0) /* this should trigger the exception */ |
---|
35 | move a0, s0 |
---|
36 | PRINTX |
---|
37 | PUTCHAR(':') |
---|
38 | PUTCHAR(' ') |
---|
39 | move a0, a1 |
---|
40 | PRINTX |
---|
41 | PUTCHAR('\n') |
---|
42 | |
---|
43 | /* we should get there */ |
---|
44 | EXIT(0) |
---|
45 | |
---|
46 | .globl excep |
---|
47 | excep: |
---|
48 | .set noreorder |
---|
49 | PRINT(statusstr) |
---|
50 | mfc0 a0, COP0_STATUS |
---|
51 | PRINTX |
---|
52 | |
---|
53 | PRINT(causestr) |
---|
54 | mfc0 a0, COP0_CAUSE |
---|
55 | PRINTX |
---|
56 | |
---|
57 | PRINT(pcstr) |
---|
58 | mfc0 a0, COP0_EXPC |
---|
59 | PRINTX |
---|
60 | |
---|
61 | PRINT(badvastr) |
---|
62 | mfc0 a0, COP_0_BADVADDR |
---|
63 | PRINTX |
---|
64 | |
---|
65 | PUTCHAR('\n') |
---|
66 | /* map VA 0 at PA 0: just copy entry for 0x00200000 */ |
---|
67 | la t0, pte1 + 0x00200000 |
---|
68 | lw a0, 4(t0) |
---|
69 | sw a0, 0(t0) |
---|
70 | /* mtc2 zero, VC_DTLB_INVAL */ |
---|
71 | eret |
---|
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 | .word MAGIC1 |
---|
88 | testval: |
---|
89 | .word MAGIC2 |
---|
90 | .globl pte1 |
---|
91 | pte1: |
---|
92 | .align 13 |
---|
93 | .word 0x0 /* map PA 0 at VA 0 */ |
---|
94 | .word PTE1_V | PTE1_C | PTE1_W | 0x0 /* map PA 0 at VA 0x00200000 */ |
---|
95 | .org pte1 + (BOOT_ADDRESS >> 21) * 4 |
---|
96 | .word PTE1_V | PTE1_C | PTE1_X | (BOOT_ADDRESS >> 21) /* map PA 0xbfc00000 at VA 0xbfc00000 */ |
---|
97 | .org pte1 + (TTY_BASE >> 21) * 4 |
---|
98 | .word PTE1_V | PTE1_W | (TTY_BASE >> 21) /* map PA 0xd0200000 at VA 0xd0200000 */ |
---|
99 | .org pte1 + (EXIT_BASE >> 21) * 4 |
---|
100 | .word PTE1_V | PTE1_W | (EXIT_BASE >> 21) /* map PA 0xe0000000 at VA 0xe0000000 */ |
---|
101 | .org pte1 + 8192 |
---|
102 | .word 0 |
---|
103 | |
---|
Note: See
TracBrowser
for help on using the repository browser.