source: trunk/softs/tests_cc_vcache/test_trap_delayslot/test.S @ 800

Last change on this file since 800 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 trap 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        nop
22        nop
23        nop
24        j exit
25        teq     zero, zero
26        /* we should not get there, */
27        EXIT(2)
28        .globl exit
29exit:
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
40excep:
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        la      a0, exit
59        mtc0    a0, COP0_EXPC
60        li      v0, MAGIC1
61        li      v1, MAGIC2
62        li      a3, 1
63        eret
64        nop
65
66#we should not end there
67        EXIT(1)
68
69        .rodata:
70statusstr: .ascii "status \0"
71causestr: .ascii " cause \0"
72pcstr: .ascii " pc \0"
73badvastr: .ascii " badva \0"
74startstr: .ascii "start\n\0"
75usrstr: .ascii "usrmode\n\0"
76
77        .org EXCEP_ADDRESS - BOOT_ADDRESS
78        .globl evect
79evect:
80        j       excep
81        nop
82        .data
83        .word MAGIC1
84testval:
85        .word MAGIC2
Note: See TracBrowser for help on using the repository browser.