source: trunk/softs/tests_cc_vcache/test_breakpoint/test.S @ 727

Last change on this file since 727 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 * 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)
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        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:
71statusstr: .ascii "status \0"
72causestr: .ascii " cause \0"
73pcstr: .ascii " pc \0"
74badvastr: .ascii " badva \0"
75startstr: .ascii "start\n\0"
76usrstr: .ascii "usrmode\n\0"
77
78        .org EXCEP_ADDRESS - BOOT_ADDRESS
79        .globl evect
80evect:
81        j       excep
82        nop
83        .data
84        .word MAGIC1
85testval:
86        .word MAGIC2
Note: See TracBrowser for help on using the repository browser.