Line | |
---|
1 | /* |
---|
2 | * sync test: we map the tty cached. If sync doesn't work some chars will be |
---|
3 | * lost because writes are combined in the write buffer. |
---|
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_SYNC(startstr) |
---|
17 | |
---|
18 | /* reset cop0 status (keep BEV) */ |
---|
19 | lui a0, 0x0040; |
---|
20 | mtc0 a0, COP0_STATUS |
---|
21 | |
---|
22 | la a0, pte1 |
---|
23 | srl a0, a0, 13 |
---|
24 | mtc2 a0, VC_PTPR |
---|
25 | nop |
---|
26 | |
---|
27 | li a0, VC_TLB_EN_ITLB | VC_TLB_EN_DTLB | VC_TLB_EN_ICACHE | VC_TLB_EN_DCACHE |
---|
28 | mtc2 a0, VC_TLB_EN |
---|
29 | |
---|
30 | PRINT_SYNC(mmustr) |
---|
31 | |
---|
32 | /* |
---|
33 | * print several chars quickly: without sync not all of them will |
---|
34 | * show up |
---|
35 | */ |
---|
36 | #define WRITE_TTY sb a0, 0(k0); sync |
---|
37 | la a0, '@' |
---|
38 | WRITE_TTY |
---|
39 | WRITE_TTY |
---|
40 | WRITE_TTY |
---|
41 | WRITE_TTY |
---|
42 | WRITE_TTY |
---|
43 | WRITE_TTY |
---|
44 | PUTCHAR('\n') |
---|
45 | |
---|
46 | /* we should get there */ |
---|
47 | EXIT(0) |
---|
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 | PUTCHAR('\n') |
---|
69 | /* we should not get there */ |
---|
70 | EXIT(1) |
---|
71 | |
---|
72 | .rodata: |
---|
73 | statusstr: .ascii "status \0" |
---|
74 | causestr: .ascii " cause \0" |
---|
75 | pcstr: .ascii " pc \0" |
---|
76 | badvastr: .ascii " badva \0" |
---|
77 | mmustr: .ascii "mmu started\n\0" |
---|
78 | startstr: .ascii "start\n\0" |
---|
79 | |
---|
80 | .org EXCEP_ADDRESS - BOOT_ADDRESS |
---|
81 | .globl evect |
---|
82 | evect: |
---|
83 | j excep |
---|
84 | nop |
---|
85 | .data |
---|
86 | .word MAGIC1 |
---|
87 | testval: |
---|
88 | .word MAGIC2 |
---|
89 | .globl pte1 |
---|
90 | pte1: |
---|
91 | .align 13 |
---|
92 | .word PTE1_V | PTE1_C | PTE1_W | 0x0 /* map PA 0 at VA 0 */ |
---|
93 | .org pte1 + (BOOT_ADDRESS >> 21) * 4 |
---|
94 | .word PTE1_V | PTE1_C | PTE1_X | (BOOT_ADDRESS >> 21) /* map PA 0xbfc00000 at VA 0xbfc00000 */ |
---|
95 | .org pte1 + (TTY_BASE >> 21) * 4 |
---|
96 | .word PTE1_V | PTE1_C | PTE1_W | (TTY_BASE >> 21) /* map PA 0xd0200000 at VA 0xd0200000 *cached!* */ |
---|
97 | .org pte1 + (EXIT_BASE >> 21) * 4 |
---|
98 | .word PTE1_V | PTE1_W | (EXIT_BASE >> 21) /* map PA 0xe0000000 at VA 0xe0000000 */ |
---|
99 | .org pte1 + 8192 |
---|
100 | .word 0 |
---|
101 | |
---|
Note: See
TracBrowser
for help on using the repository browser.