ld: Move the .note.build-id section to near the start of the memory map.
[binutils-gdb.git] / sim / testsuite / bfin / c_except_sys_sstep.S
blobc7195553b695b6f17c3d4e39e0ea6c17cf3da606
1 //Original:/proj/frio/dv/testcases/core/c_except_sys_sstep/c_except_sys_sstep.dsp
2 // Spec Reference: Single Step Supervisor Exception Test (NO REGTRACE!)
3 # mach: bfin
4 # sim: --environment operating
6 #include "test.h"
7 .include "testutils.inc"
8 start
10 include(gen_int.inc)
11 include(selfcheck.inc)
12 include(std.inc)
14 #ifndef STACKSIZE
15 #define STACKSIZE 0x10
16 #endif
17 #ifndef EVT
18 #define EVT  0xFFE02000
19 #endif
20 #ifndef EVT15
21 #define EVT15  0xFFE0203C
22 #endif
23 #ifndef EVT_OVERRIDE
24 #define EVT_OVERRIDE 0xFFE02100
25 #endif
28 ////MY_GEN_INT_INIT(0xF0000000) // set location for interrupt table
31 // Reset/Bootstrap Code
32 //   (Here we should set the processor operating modes, initialize registers,
33 //    etc.)
36 BOOT:
37 INIT_R_REGS(0);     // initialize general purpose regs
39 INIT_P_REGS(0);     // initialize the pointers
41 INIT_I_REGS(0);     // initialize the dsp address regs
42 INIT_M_REGS(0);
43 INIT_L_REGS(0);
44 INIT_B_REGS(0);
45 //    CHECK_INIT(p2, 0x2000);
46 include(symtable.inc)
47 CHECK_INIT_DEF(p2);
50 LD32_LABEL(sp, KSTACK);   // setup the stack pointer
51 FP = SP;        // and frame pointer
53 LD32(p0, EVT);      // Setup Event Vectors and Handlers
55 LD32_LABEL(r0, EHANDLE);  // Emulation Handler (Int0)
56     [ P0 ++ ] = R0;
58 LD32_LABEL(r0, RHANDLE);  // Reset Handler (Int1)
59     [ P0 ++ ] = R0;
61 LD32_LABEL(r0, NHANDLE);  // NMI Handler (Int2)
62     [ P0 ++ ] = R0;
64 LD32_LABEL(r0, XHANDLE);  // Exception Handler (Int3)
65     [ P0 ++ ] = R0;
67     [ P0 ++ ] = R0;        // IVT4 not used
69 LD32_LABEL(r0, HWHANDLE); // HW Error Handler (Int5)
70     [ P0 ++ ] = R0;
72 LD32_LABEL(r0, THANDLE);  // Timer Handler (Int6)
73     [ P0 ++ ] = R0;
75 LD32_LABEL(r0, I7HANDLE); // IVG7 Handler
76     [ P0 ++ ] = R0;
78 LD32_LABEL(r0, I8HANDLE); // IVG8 Handler
79     [ P0 ++ ] = R0;
81 LD32_LABEL(r0, I9HANDLE); // IVG9 Handler
82     [ P0 ++ ] = R0;
84 LD32_LABEL(r0, I10HANDLE);// IVG10 Handler
85     [ P0 ++ ] = R0;
87 LD32_LABEL(r0, I11HANDLE);// IVG11 Handler
88     [ P0 ++ ] = R0;
90 LD32_LABEL(r0, I12HANDLE);// IVG12 Handler
91     [ P0 ++ ] = R0;
93 LD32_LABEL(r0, I13HANDLE);// IVG13 Handler
94     [ P0 ++ ] = R0;
96 LD32_LABEL(r0, I14HANDLE);// IVG14 Handler
97     [ P0 ++ ] = R0;
99 LD32_LABEL(r0, I15HANDLE);// IVG15 Handler
100     [ P0 ++ ] = R0;
102 LD32(p0, EVT_OVERRIDE);
103     R0 = 0;
104     [ P0 ++ ] = R0;
105     R0 = -1;     // Change this to mask interrupts (*)
106     [ P0 ] = R0;   // IMASK
108 DUMMY:
110     R0 = 0 (Z);
112 LT0 = r0;       // set loop counters to something deterministic
113 LB0 = r0;
114 LC0 = r0;
115 LT1 = r0;
116 LB1 = r0;
117 LC1 = r0;
119 ASTAT = r0;     // reset other internal regs
120     R0 = 1;
121 SYSCFG = r0;    // Enable Supervisor Single Step
122     R4 = 0;
124 LD32_LABEL(r0, START);
125 RETI = r0;      // We need to load the return address
127 RTI;
130 START:
131 LD32_LABEL(sp, USTACK);   // setup the stack pointer
132 FP = SP;            // set frame pointer
133 JUMP BEGIN;
135 //*********************************************************************
137 BEGIN:
139     R0 = 0;
140     R1 = 1;
141     R2 = 2;
142     R3 = 3;
143     R5 = 5;
144     R6 = 6;
145     R7 = 7;
147 EXCPT 3;            // turn off single step via handler
149 CHECKREG(r4, 0x0b); // 11 instrs are executed before single step = disabled
150 CHECKREG(r0, 0x00);
151 CHECKREG(r1, 0x03);
152 CHECKREG(r2, 0x10);
153 CHECKREG(r3, 0x04);
154 CHECKREG(r5, 0x09);
155 CHECKREG(r6, 0x06);
156 CHECKREG(r7, 0x07);
159     // PUT YOUR TEST HERE!
162 END:
163 dbg_pass;            // End the test
165 //*********************************************************************
168 // Handlers for Events
171 EHANDLE:            // Emulation Handler 0
172 RTE;
174 RHANDLE:            // Reset Handler 1
175 RTI;
177 NHANDLE:            // NMI Handler 2
178 RTN;
180 XHANDLE:            // Exception Handler 3
181     [ -- SP ] = ASTAT; // save ASTAT
182     R1 = SEQSTAT;
183     R1 <<= 26;
184     R1 >>= 26;      // only want EXCAUSE
185     R2 = 0x10;      // EXCAUSE 0x10 means Single Step (exception)
186 CC = r1 == r2;
187 IF CC JUMP SSCOUNT;  // Go to Single Step Handler
189 SYSCFG = r0;      // otherwise must be an EXCPT, so turn off singlestep
190     R3 += 1;
192 JUMP.S EXIT;
194 SSCOUNT:
195     R4 += 1;        // R4 counts single step events
197 EXIT:
198 ASTAT = [sp++];
199     R5 += 1;
201 RTX;
203 HWHANDLE:           // HW Error Handler 5
204 RTI;
206 THANDLE:            // Timer Handler 6
207 RTI;
209 I7HANDLE:           // IVG 7 Handler
210 RTI;
212 I8HANDLE:           // IVG 8 Handler
213 RTI;
215 I9HANDLE:           // IVG 9 Handler
216 RTI;
218 I10HANDLE:          // IVG 10 Handler
219 RTI;
221 I11HANDLE:          // IVG 11 Handler
222 RTI;
224 I12HANDLE:          // IVG 12 Handler
225 RTI;
227 I13HANDLE:          // IVG 13 Handler
228 RTI;
230 I14HANDLE:          // IVG 14 Handler
231 RTI;
233 I15HANDLE:          // IVG 15 Handler
234 RTI;
236 NOP;NOP;NOP;NOP;NOP;NOP;NOP; // needed for icache bug
239 // Data Segment
242 .data
243 DATA:
244     .space (0x10);
246 // Stack Segments (Both Kernel and User)
248     .space (STACKSIZE);
249 KSTACK:
251     .space (STACKSIZE);
252 USTACK: