source: trunk/softs/tests_cc_vcache/test_interrupt_loop_tmp/test.S @ 520

Last change on this file since 520 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: 3.0 KB
Line 
1/*
2 * Check interrupt/return with interrup occuring at various points in
3 * the software. Cache is enabled to we have on interrupt/cycle
4 */
5#include <registers.h>
6#include <misc.h>
7#include <vcache.h>
8#include <xicu.h>
9
10        .text
11        .globl  _start
12_start:
13        .set noreorder
14        la      k0, TTY_BASE
15        la      k1, EXIT_BASE
16
17        /* reset cause, make sure IV is off */
18        mtc0    zero, COP0_CAUSE
19
20        la      a0, pte1
21        srl     a0, a0, 13
22        mtc2    a0, VC_PTPR
23        nop
24
25        li      a0, VC_TLB_EN_ITLB | VC_TLB_EN_DTLB | VC_TLB_EN_ICACHE | VC_TLB_EN_DCACHE
26        mtc2    a0, VC_TLB_EN
27
28        PRINT(startstr)
29
30        /* program xicu */
31        la      t0, XICU_BASE
32        /* clear pending interrupt */
33        lw      a0, XICU_PTI_ACK(0)(t0)
34        /* route PTI0 to irq 0 */
35        li      a0, 1 << 0
36        sw      a0, XICU_MSK_PTI_E(0)(t0)
37        /* init s0 */
38        li      s0, MAGIC2
39        /*
40         * interrupt in INTERRUPT_DELAY cycles.
41         */
42        li      s2, 1
43        sw      s2, XICU_PTI_PER(0)(t0)
44        /* clear pending interrupt */
45        lw      a0, XICU_PTI_ACK(0)(t0)
46        /* reset cop0 status (keep BEV), enable interrupt 0 */
47        lui     a0, 0x0040;
48        addiu   a0, 0x0401;
49        mtc0    a0, COP0_STATUS
50
51        nop
52        li      s0, MAGIC1
53        addiu   s0, s0, -1
54loop:   
55        addiu   s0, s0, -1
56        addiu   s0, s0, -1
57        addiu   s0, s0, -1
58        j       bla
59        addiu   s0, s0, 5
60        EXIT(1)
61        addiu   s0, s0, -1
62        .align 6
63bla:
64        addiu   s0, s0, -1
65        li              s1, MAGIC1
66        beq         s0, s1, loop
67        addiu   s0, s0, -1
68
69        /* we should not end there */
70        EXIT(1)
71
72        .align 6
73end:
74        PRINT(endstr)
75        move    a0, s0
76        PRINTX
77        PUTCHAR('\n')
78        EXIT(0)
79
80        .rodata:
81statusstr: .ascii "status \0"
82causestr: .ascii " cause \0"
83pcstr: .ascii " pc \0"
84badvastr: .ascii " badva \0"
85xicustr: .ascii " xicu \0"
86startstr: .ascii "start\n\0"
87perstr: .ascii " period \0"
88endstr: .ascii "end \0"
89
90        .org EXCEP_ADDRESS - BOOT_ADDRESS
91        .globl excep
92excep:
93        .set noreorder
94        addiu   s0, s0, -10
95        /* disable timer0 */
96        la      t0, XICU_BASE
97        sw      zero, XICU_PTI_PER(0)(t0)
98        PRINT(statusstr)
99        mfc0    a0, COP0_STATUS
100        PRINTX
101
102        PRINT(pcstr)
103        mfc0    a0, COP0_EXPC
104        PRINTX
105
106        PRINT(causestr)
107        mfc0    a0, COP0_CAUSE
108        PRINTX
109
110        PRINT(badvastr)
111        mfc0    a0, COP_0_BADVADDR
112        PRINTX
113
114        PRINT(xicustr)
115        la      t0, XICU_BASE
116        lw      a0, XICU_PRIO(0)(t0)
117        PRINTX
118
119//      PRINT(perstr)
120//      move a0, s2
121//      PRINTX
122//
123        PUTCHAR('\n')
124
125#if 0
126        andi s3, s2, 1
127        beqz s3, noflush
128#endif
129        addiu   s0, s0, 10
130
131#if 1
132        // Flush cache of jump routine
133        la s3, bla
134        mtc2 s3, VC_ICACHE_INVAL
135        mtc2 s3, VC_ITLB_INVAL
136#endif
137               
138noflush:
139        addiu s2, s2, 1
140        li s3, 194*2
141        beq s2, s3, end2
142        srl s3, s2, 1
143        la      t0, XICU_BASE
144        sw      s3, XICU_PTI_PER(0)(t0)
145        eret
146        /* we should not end there */
147        EXIT(1)
148end2:
149        EXIT(0)
150
151        .data
152myvar:  .word 0
153pte1:
154        .align 13
155        .word PTE1_V | PTE1_C | PTE1_W | 0x0 /* map PA 0 at VA 0 */
156        .org pte1 + (BOOT_ADDRESS >> 21) * 4
157        .word PTE1_V | PTE1_C | PTE1_X | (BOOT_ADDRESS >> 21) /* map PA 0xbfc00000 at VA 0xbfc00000 */
158        .org pte1 + (TTY_BASE >> 21) * 4
159        .word PTE1_V | PTE1_W | (TTY_BASE >> 21) /* map PA 0xd0200000 at VA 0xd0200000 */
160        .org pte1 + (XICU_BASE >> 21) * 4
161        .word PTE1_V | PTE1_W | (XICU_BASE >> 21) /* map PA 0xd2000000 at VA 0xd2000000 */
162        .org pte1 + (EXIT_BASE >> 21) * 4
163        .word PTE1_V | PTE1_W | (EXIT_BASE >> 21) /* map PA 0xe0000000 at VA 0xe0000000 */
164        .org pte1 + 8192
165        .word 0
166
Note: See TracBrowser for help on using the repository browser.