source: trunk/softs/tests_cc_vcache/test_interrupt/test.S @ 604

Last change on this file since 604 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 * Check that we can take an interrupt, and return from it.
3 * We use a software-triggerted interrupt.
4 */
5#include <registers.h>
6#include <misc.h>
7
8
9        .text
10        .globl  _start
11_start:
12        .set noreorder
13        la      k0, TTY_BASE
14        la      k1, EXIT_BASE
15
16        /* reset cop0 status (keep BEV), enbale soft interrupt 0 */
17        lui     a0, 0x0040;
18        addiu   a0, 0x0101;
19        mtc0    a0, COP0_STATUS
20
21        /* reset cause, make sure IV is off */
22        mtc0    zero, COP0_CAUSE
23
24        PRINT(startstr)
25
26        /* generate an interrupt */
27        mfc0    a0, COP0_CAUSE
28        nop
29        ori     a0, 0x0100
30        mtc0    a0, COP0_CAUSE
31        li      a0, MAGIC1
32        PRINTX
33        PUTCHAR('\n')
34        /* we should end here after taking the exeption */
35        EXIT(0)
36
37        .globl excep
38excep:
39        .set noreorder
40        PRINT(statusstr)
41        mfc0    a0, COP0_STATUS
42        PRINTX
43
44        PRINT(causestr)
45        mfc0    a0, COP0_CAUSE
46        PRINTX
47
48        PRINT(pcstr)
49        mfc0    a0, COP0_EXPC
50        PRINTX
51
52        PRINT(badvastr)
53        mfc0    a0, COP_0_BADVADDR
54        PRINTX
55
56        PUTCHAR('\n')
57        /* clear interrupt */
58        mfc0    a0, COP0_CAUSE
59        xori    a0, 0x100
60        mtc0    a0, COP0_CAUSE
61        nop
62        eret
63        /* we should not end there */
64        EXIT(1)
65
66        .rodata:
67statusstr: .ascii "status \0"
68causestr: .ascii " cause \0"
69pcstr: .ascii " pc \0"
70badvastr: .ascii " badva \0"
71startstr: .ascii "start\n\0"
72eretstr: .ascii "eret\n\0"
73
74        .org EXCEP_ADDRESS - BOOT_ADDRESS
75        .globl evect
76evect:
77        j       excep
78        nop
79        .data
80myvar:  .word 0
Note: See TracBrowser for help on using the repository browser.