Last change
on this file 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:
1.3 KB
|
Line | |
---|
1 | /* |
---|
2 | * Check that we can take an interrupt, and return to a different address. |
---|
3 | * We use a software-triggerted interrupt. |
---|
4 | */ |
---|
5 | #include <registers.h> |
---|
6 | #include <misc.h> |
---|
7 | |
---|
8 | .text |
---|
9 | .globl _start |
---|
10 | _start: |
---|
11 | .set noreorder |
---|
12 | la k0, TTY_BASE |
---|
13 | la k1, EXIT_BASE |
---|
14 | |
---|
15 | /* reset cop0 status (keep BEV), enbale soft interrupt 0 */ |
---|
16 | lui a0, 0x0040; |
---|
17 | addiu a0, 0x0101; |
---|
18 | mtc0 a0, COP0_STATUS |
---|
19 | |
---|
20 | /* reset cause, make sure IV is off */ |
---|
21 | mtc0 zero, COP0_CAUSE |
---|
22 | |
---|
23 | PRINT(startstr) |
---|
24 | |
---|
25 | /* generate an interrupt */ |
---|
26 | mfc0 a0, COP0_CAUSE |
---|
27 | nop |
---|
28 | ori a0, 0x0100 |
---|
29 | mtc0 a0, COP0_CAUSE |
---|
30 | nop |
---|
31 | /* we should not end there */ |
---|
32 | EXIT(1) |
---|
33 | |
---|
34 | exret: |
---|
35 | PRINT(eretstr) |
---|
36 | EXIT(0) |
---|
37 | |
---|
38 | |
---|
39 | .globl excep |
---|
40 | excep: |
---|
41 | .set noreorder |
---|
42 | PRINT(statusstr) |
---|
43 | mfc0 a0, COP0_STATUS |
---|
44 | PRINTX |
---|
45 | |
---|
46 | PRINT(causestr) |
---|
47 | mfc0 a0, COP0_CAUSE |
---|
48 | PRINTX |
---|
49 | |
---|
50 | PRINT(pcstr) |
---|
51 | mfc0 a0, COP0_EXPC |
---|
52 | PRINTX |
---|
53 | |
---|
54 | PRINT(badvastr) |
---|
55 | mfc0 a0, COP_0_BADVADDR |
---|
56 | PRINTX |
---|
57 | |
---|
58 | PUTCHAR('\n') |
---|
59 | /* clear interrupt */ |
---|
60 | mfc0 a0, COP0_CAUSE |
---|
61 | xori a0, 0x100 |
---|
62 | mtc0 a0, COP0_CAUSE |
---|
63 | nop |
---|
64 | la a0, exret |
---|
65 | mtc0 a0, COP0_EXPC |
---|
66 | nop |
---|
67 | eret |
---|
68 | /* we should not end there */ |
---|
69 | EXIT(1) |
---|
70 | |
---|
71 | .rodata: |
---|
72 | statusstr: .ascii "status \0" |
---|
73 | causestr: .ascii " cause \0" |
---|
74 | pcstr: .ascii " pc \0" |
---|
75 | badvastr: .ascii " badva \0" |
---|
76 | startstr: .ascii "start\n\0" |
---|
77 | eretstr: .ascii "eret\n\0" |
---|
78 | |
---|
79 | .org EXCEP_ADDRESS - BOOT_ADDRESS |
---|
80 | .globl evect |
---|
81 | evect: |
---|
82 | j excep |
---|
83 | nop |
---|
84 | .data |
---|
85 | myvar: .word 0 |
---|
Note: See
TracBrowser
for help on using the repository browser.