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:
1.2 KB
|
Line | |
---|
1 | /* |
---|
2 | * arithmetic overflow test: check that a overflow 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) */ |
---|
19 | lui a0, 0x0040; |
---|
20 | mtc0 a0, COP0_STATUS |
---|
21 | la a0, 0x7fffffff |
---|
22 | li a1, 0x02 |
---|
23 | j exit |
---|
24 | add a0, a0, a1 |
---|
25 | /* we should not get there, */ |
---|
26 | EXIT(2) |
---|
27 | .globl exit |
---|
28 | exit: |
---|
29 | move a0, v0 |
---|
30 | PRINTX |
---|
31 | PUTCHAR(' ') |
---|
32 | move a0, v1 |
---|
33 | PRINTX |
---|
34 | PUTCHAR('\n') |
---|
35 | /* we should get there */ |
---|
36 | EXIT(0) |
---|
37 | |
---|
38 | .globl excep |
---|
39 | excep: |
---|
40 | .set noreorder |
---|
41 | PRINT(statusstr) |
---|
42 | mfc0 a0, COP0_STATUS |
---|
43 | PRINTX |
---|
44 | |
---|
45 | PRINT(causestr) |
---|
46 | mfc0 a0, COP0_CAUSE |
---|
47 | PRINTX |
---|
48 | |
---|
49 | PRINT(pcstr) |
---|
50 | mfc0 a0, COP0_EXPC |
---|
51 | PRINTX |
---|
52 | |
---|
53 | PRINT(badvastr) |
---|
54 | mfc0 a0, COP_0_BADVADDR |
---|
55 | PRINTX |
---|
56 | PUTCHAR('\n') |
---|
57 | la a0, exit |
---|
58 | mtc0 a0, COP0_EXPC |
---|
59 | li v0, MAGIC1 |
---|
60 | li v1, MAGIC2 |
---|
61 | li a3, 1 |
---|
62 | eret |
---|
63 | nop |
---|
64 | |
---|
65 | #we should not end there |
---|
66 | EXIT(1) |
---|
67 | |
---|
68 | .rodata: |
---|
69 | statusstr: .ascii "status \0" |
---|
70 | causestr: .ascii " cause \0" |
---|
71 | pcstr: .ascii " pc \0" |
---|
72 | badvastr: .ascii " badva \0" |
---|
73 | startstr: .ascii "start\n\0" |
---|
74 | usrstr: .ascii "usrmode\n\0" |
---|
75 | |
---|
76 | .org EXCEP_ADDRESS - BOOT_ADDRESS |
---|
77 | .globl evect |
---|
78 | evect: |
---|
79 | j excep |
---|
80 | nop |
---|
81 | .data |
---|
82 | .word MAGIC1 |
---|
83 | testval: |
---|
84 | .word MAGIC2 |
---|
Note: See
TracBrowser
for help on using the repository browser.