Last change
on this file since 291 was
232,
checked in by alain, 12 years ago
|
Introducing the elementary tests for a TSAR mono-cluster
mono-processor platform with MMU using the vci_cc_vcache_v4
such as the "tsarv4_mono_mmu".
(assemby level tests written by Manuel Bouyer)
|
File size:
1.3 KB
|
Line | |
---|
1 | /* |
---|
2 | * syscall test: check that a syscall 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 | /* switch to user mode */ |
---|
22 | mfc0 a0, COP0_STATUS |
---|
23 | ori a0, 0x10 |
---|
24 | mtc0 a0, COP0_STATUS |
---|
25 | nop |
---|
26 | nop |
---|
27 | nop |
---|
28 | PRINT(usrstr) |
---|
29 | syscall |
---|
30 | bne a3, zero, exit |
---|
31 | nop |
---|
32 | /* we should not get there, a3 is not 0 */ |
---|
33 | EXIT(2) |
---|
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 | mfc0 a0, COP0_EXPC |
---|
64 | addiu a0, a0, 4 |
---|
65 | mtc0 a0, COP0_EXPC |
---|
66 | li v0, MAGIC1 |
---|
67 | li v1, MAGIC2 |
---|
68 | li a3, 1 |
---|
69 | eret |
---|
70 | nop |
---|
71 | |
---|
72 | #we should not end there |
---|
73 | EXIT(1) |
---|
74 | |
---|
75 | .rodata: |
---|
76 | statusstr: .ascii "status \0" |
---|
77 | causestr: .ascii " cause \0" |
---|
78 | pcstr: .ascii " pc \0" |
---|
79 | badvastr: .ascii " badva \0" |
---|
80 | startstr: .ascii "start\n\0" |
---|
81 | usrstr: .ascii "usrmode\n\0" |
---|
82 | |
---|
83 | .org EXCEP_ADDRESS - BOOT_ADDRESS |
---|
84 | .globl evect |
---|
85 | evect: |
---|
86 | j excep |
---|
87 | nop |
---|
88 | .data |
---|
89 | .word MAGIC1 |
---|
90 | testval: |
---|
91 | .word MAGIC2 |
---|
Note: See
TracBrowser
for help on using the repository browser.