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