Last change
on this file since 909 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 | * trap test: check that a trap in a delay slot is |
---|
3 | * properly handled |
---|
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 | la sp, 0x00400000 - 16 |
---|
15 | |
---|
16 | PRINT(startstr) |
---|
17 | |
---|
18 | /* reset cop0 status (keep BEV), enable cop1 */ |
---|
19 | lui a0, 0x2040; |
---|
20 | mtc0 a0, COP0_STATUS |
---|
21 | |
---|
22 | la a0, div1 |
---|
23 | lwc1 $f2, 0(a0) |
---|
24 | la a0, div2 |
---|
25 | lwc1 $f0, 0(a0) |
---|
26 | j exit |
---|
27 | div.s $f0, $f0, $f2 |
---|
28 | /* we should not get there, */ |
---|
29 | EXIT(2) |
---|
30 | .globl exit |
---|
31 | exit: |
---|
32 | move a0, v0 |
---|
33 | PRINTX |
---|
34 | PUTCHAR(' ') |
---|
35 | move a0, v1 |
---|
36 | PRINTX |
---|
37 | PUTCHAR('\n') |
---|
38 | /* we should get there */ |
---|
39 | EXIT(0) |
---|
40 | |
---|
41 | .globl excep |
---|
42 | excep: |
---|
43 | .set noreorder |
---|
44 | PRINT(statusstr) |
---|
45 | mfc0 a0, COP0_STATUS |
---|
46 | PRINTX |
---|
47 | |
---|
48 | PRINT(causestr) |
---|
49 | mfc0 a0, COP0_CAUSE |
---|
50 | PRINTX |
---|
51 | |
---|
52 | PRINT(pcstr) |
---|
53 | mfc0 a0, COP0_EXPC |
---|
54 | PRINTX |
---|
55 | |
---|
56 | PRINT(badvastr) |
---|
57 | mfc0 a0, COP_0_BADVADDR |
---|
58 | PRINTX |
---|
59 | PUTCHAR('\n') |
---|
60 | la a0, exit |
---|
61 | mtc0 a0, COP0_EXPC |
---|
62 | li v0, MAGIC1 |
---|
63 | li v1, MAGIC2 |
---|
64 | li a3, 1 |
---|
65 | eret |
---|
66 | nop |
---|
67 | |
---|
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 | usrstr: .ascii "usrmode\n\0" |
---|
78 | |
---|
79 | .org EXCEP_ADDRESS - BOOT_ADDRESS |
---|
80 | .globl evect |
---|
81 | evect: |
---|
82 | j excep |
---|
83 | nop |
---|
84 | .data |
---|
85 | .word MAGIC1 |
---|
86 | testval: |
---|
87 | .word MAGIC2 |
---|
88 | div1: |
---|
89 | .float 10.0 |
---|
90 | .globl div2 |
---|
91 | div2: |
---|
92 | .float 0.0 |
---|
Note: See
TracBrowser
for help on using the repository browser.