source:
trunk/softs/tests_ccvcache_v4/test_breakpoint/test.S
@
279
Last change on this file since 279 was 232, checked in by , 13 years ago | |
---|---|
File size: 1.2 KB |
Line | |
---|---|
1 | /* |
2 | * breakpoint test: check that a breakpoint generates an exception, and we can |
3 | * return |
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 | nop |
22 | nop |
23 | nop |
24 | break |
25 | bne a3, zero, exit |
26 | nop |
27 | /* we should not get there, a3 is not 0 */ |
28 | EXIT(2) |
29 | exit: |
30 | move a0, v0 |
31 | PRINTX |
32 | PUTCHAR(' ') |
33 | move a0, v1 |
34 | PRINTX |
35 | PUTCHAR('\n') |
36 | /* we should get there */ |
37 | EXIT(0) |
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 | PUTCHAR('\n') |
58 | mfc0 a0, COP0_EXPC |
59 | addiu a0, a0, 4 |
60 | mtc0 a0, COP0_EXPC |
61 | li v0, MAGIC1 |
62 | li v1, MAGIC2 |
63 | li a3, 1 |
64 | eret |
65 | nop |
66 | |
67 | #we should not end there |
68 | EXIT(1) |
69 | |
70 | .rodata: |
71 | statusstr: .ascii "status \0" |
72 | causestr: .ascii " cause \0" |
73 | pcstr: .ascii " pc \0" |
74 | badvastr: .ascii " badva \0" |
75 | startstr: .ascii "start\n\0" |
76 | usrstr: .ascii "usrmode\n\0" |
77 | |
78 | .org EXCEP_ADDRESS - BOOT_ADDRESS |
79 | .globl evect |
80 | evect: |
81 | j excep |
82 | nop |
83 | .data |
84 | .word MAGIC1 |
85 | testval: |
86 | .word MAGIC2 |
Note: See TracBrowser
for help on using the repository browser.