Last change
on this file since 1030 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.2 KB
|
Line | |
---|
1 | /* |
---|
2 | * trap test: check that a we can generate a trap from FPE instruction |
---|
3 | */ |
---|
4 | #include <registers.h> |
---|
5 | #include <misc.h> |
---|
6 | |
---|
7 | .text |
---|
8 | .globl _start |
---|
9 | _start: |
---|
10 | .set noreorder |
---|
11 | la k0, TTY_BASE |
---|
12 | la k1, EXIT_BASE |
---|
13 | la sp, 0x00400000 - 16 |
---|
14 | |
---|
15 | PRINT(startstr) |
---|
16 | |
---|
17 | /* reset cop0 status (keep BEV), enable cop1 */ |
---|
18 | lui a0, 0x2040; |
---|
19 | mtc0 a0, COP0_STATUS |
---|
20 | /* enable COP1 exceptions */ |
---|
21 | li a0, 0x0f80 |
---|
22 | ctc1 a0, $31 |
---|
23 | #if 0 |
---|
24 | li a0, 0xf000 |
---|
25 | ctc1 a0, $26 |
---|
26 | #endif |
---|
27 | la a0, div1 |
---|
28 | lwc1 $f2, 0(a0) |
---|
29 | la a0, div2 |
---|
30 | lwc1 $f0, 0(a0) |
---|
31 | div.s $f0, $f2, $f0 |
---|
32 | cfc1 a0, $31 |
---|
33 | PRINTX |
---|
34 | PUTCHAR('\n') |
---|
35 | EXIT(2) |
---|
36 | |
---|
37 | .globl excep |
---|
38 | excep: |
---|
39 | .set noreorder |
---|
40 | PRINT(statusstr) |
---|
41 | mfc0 a0, COP0_STATUS |
---|
42 | PRINTX |
---|
43 | |
---|
44 | PRINT(causestr) |
---|
45 | mfc0 a0, COP0_CAUSE |
---|
46 | PRINTX |
---|
47 | |
---|
48 | PRINT(pcstr) |
---|
49 | mfc0 a0, COP0_EXPC |
---|
50 | PRINTX |
---|
51 | |
---|
52 | PRINT(badvastr) |
---|
53 | mfc0 a0, COP_0_BADVADDR |
---|
54 | PRINTX |
---|
55 | PUTCHAR('\n') |
---|
56 | #we should end there |
---|
57 | EXIT(0) |
---|
58 | |
---|
59 | .rodata: |
---|
60 | statusstr: .ascii "status \0" |
---|
61 | causestr: .ascii " cause \0" |
---|
62 | pcstr: .ascii " pc \0" |
---|
63 | badvastr: .ascii " badva \0" |
---|
64 | startstr: .ascii "start\n\0" |
---|
65 | usrstr: .ascii "usrmode\n\0" |
---|
66 | |
---|
67 | .org EXCEP_ADDRESS - BOOT_ADDRESS |
---|
68 | .globl evect |
---|
69 | evect: |
---|
70 | j excep |
---|
71 | nop |
---|
72 | .data |
---|
73 | .word MAGIC1 |
---|
74 | testval: |
---|
75 | .word MAGIC2 |
---|
76 | .globl div1 |
---|
77 | div1: |
---|
78 | .float 10.0 |
---|
79 | .globl div2 |
---|
80 | div2: |
---|
81 | .float 0.0 |
---|
Note: See
TracBrowser
for help on using the repository browser.