]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/testsuite/sim/bfin/c_seq_ex1_call_mv_pop.S
* elfxx-tilegx.c (tilegx_elf_relocate_section): Silence bogus warning.
[thirdparty/binutils-gdb.git] / sim / testsuite / sim / bfin / c_seq_ex1_call_mv_pop.S
CommitLineData
1d7b4a70
MF
1//Original:/proj/frio/dv/testcases/core/c_seq_ex1_call_mv_pop/c_seq_ex1_call_mv_pop.dsp
2// Spec Reference: sequencer stage ex1 ( call + regmv + pushpopmultiple)
3# mach: bfin
4# sim: --environment operating
5
6#include "test.h"
7.include "testutils.inc"
8start
9
10include(std.inc)
11include(selfcheck.inc)
12include(gen_int.inc)
13INIT_R_REGS(0);
14INIT_P_REGS(0);
15INIT_I_REGS(0); // initialize the dsp address regs
16INIT_M_REGS(0);
17INIT_L_REGS(0);
18INIT_B_REGS(0);
19//CHECK_INIT(p5, 0xe0000000);
20include(symtable.inc)
21CHECK_INIT_DEF(p5);
22
23#ifndef STACKSIZE
24#define STACKSIZE 0x10
25#endif
26#ifndef EVT
27#define EVT 0xFFE02000
28#endif
29#ifndef EVT15
30#define EVT15 0xFFE0203C
31#endif
32#ifndef EVT_OVERRIDE
33#define EVT_OVERRIDE 0xFFE02100
34#endif
35#ifndef ITABLE
36#define ITABLE DATA_ADDR_1
37#endif
38
39GEN_INT_INIT(ITABLE) // set location for interrupt table
40
41//
42// Reset/Bootstrap Code
43// (Here we should set the processor operating modes, initialize registers,
44//
45
46BOOT:
47
48 // in reset mode now
49LD32_LABEL(sp, KSTACK); // setup the stack pointer
50FP = SP; // and frame pointer
51
52LD32(p0, EVT); // Setup Event Vectors and Handlers
53LD32_LABEL(r0, EHANDLE); // Emulation Handler (Int0)
54 [ P0 ++ ] = R0;
55
56LD32_LABEL(r0, RHANDLE); // Reset Handler (Int1)
57 [ P0 ++ ] = R0;
58
59LD32_LABEL(r0, NHANDLE); // NMI Handler (Int2)
60 [ P0 ++ ] = R0;
61
62LD32_LABEL(r0, XHANDLE); // Exception Handler (Int3)
63 [ P0 ++ ] = R0;
64
65 [ P0 ++ ] = R0; // IVT4 not used
66
67LD32_LABEL(r0, HWHANDLE); // HW Error Handler (Int5)
68 [ P0 ++ ] = R0;
69
70LD32_LABEL(r0, THANDLE); // Timer Handler (Int6)
71 [ P0 ++ ] = R0;
72
73LD32_LABEL(r0, I7HANDLE); // IVG7 Handler
74 [ P0 ++ ] = R0;
75
76LD32_LABEL(r0, I8HANDLE); // IVG8 Handler
77 [ P0 ++ ] = R0;
78
79LD32_LABEL(r0, I9HANDLE); // IVG9 Handler
80 [ P0 ++ ] = R0;
81
82LD32_LABEL(r0, I10HANDLE);// IVG10 Handler
83 [ P0 ++ ] = R0;
84
85LD32_LABEL(r0, I11HANDLE);// IVG11 Handler
86 [ P0 ++ ] = R0;
87
88LD32_LABEL(r0, I12HANDLE);// IVG12 Handler
89 [ P0 ++ ] = R0;
90
91LD32_LABEL(r0, I13HANDLE);// IVG13 Handler
92 [ P0 ++ ] = R0;
93
94LD32_LABEL(r0, I14HANDLE);// IVG14 Handler
95 [ P0 ++ ] = R0;
96
97LD32_LABEL(r0, I15HANDLE);// IVG15 Handler
98 [ P0 ++ ] = R0;
99
100LD32(p0, EVT_OVERRIDE);
101 R0 = 0;
102 [ P0 ++ ] = R0;
103 R0 = -1; // Change this to mask interrupts (*)
104 [ P0 ] = R0; // IMASK
105CSYNC;
106
107DUMMY:
108
109 R0 = 0 (Z);
110
111LT0 = r0; // set loop counters to something deterministic
112LB0 = r0;
113LC0 = r0;
114LT1 = r0;
115LB1 = r0;
116LC1 = r0;
117
118ASTAT = r0; // reset other internal regs
119
120// The following code sets up the test for running in USER mode
121
122LD32_LABEL(r0, STARTUSER);// One gets to user mode by doing a
123 // ReturnFromInterrupt (RTI)
124RETI = r0; // We need to load the return address
125
126// Comment the following line for a USER Mode test
127
128JUMP STARTSUP; // jump to code start for SUPERVISOR mode
129
130RTI;
131
132STARTSUP:
133LD32_LABEL(p1, BEGIN);
134
135LD32(p0, EVT15);
136 [ P0 ] = P1; // IVG15 (General) handler (Int 15) load with start
137
138RAISE 15; // after we RTI, INT 15 should be taken,& return to BEGIN in
139 // SUPERVISOR MODE & go to different RAISE in supervisor mode
140 // until the end of the test.
141
142NOP; // Workaround for Bug 217
143RTI;
144
145//
146// The Main Program
147//
148STARTUSER:
149LD32_LABEL(sp, USTACK); // setup the stack pointer
150FP = SP; // set frame pointer
151JUMP BEGIN;
152
153//*********************************************************************
154
155BEGIN:
156
157 // COMMENT the following line for USER MODE tests
158 [ -- SP ] = RETI; // enable interrupts in supervisor mode
159
160 // **** YOUR CODE GOES HERE ****
161
162LD32_LABEL(p1, SUBR1);
163
164
165 // PUT YOUR TEST HERE!
166// PUSH
167 R0 = 0x01;
168 R1 = 0x02;
169 R2 = 0x03;
170 R3 = 0x04;
171 R4 = 0x05;
172 R5 = 0x06;
173 R6 = 0x07;
174 R7 = 0x08;
175
176
177 [ -- SP ] = ( R7:0 );
178// RAISE 2; // RTN
179CALL (p1);
180 P1 = R1;
181 R2 = P1;
182 [ -- SP ] = ( R7:0 );
183 R1 = 0x12;
184 R2 = 0x13;
185 R3 = 0x14;
186 R4 = 0x15;
187 R5 = 0x16;
188 R6 = 0x17;
189 R7 = 0x18;
190
191LABEL1:
192// RAISE 5; // RTI
193 P2 = R2;
194 R3 = P2;
195
196 [ -- SP ] = ( R7:0 );
197
198 R2 = 0x23;
199 R3 = 0x24;
200 R4 = 0x25;
201 R5 = 0x26;
202 R6 = 0x27;
203 R7 = 0x28;
204
205// RAISE 6; // RTI
206CALL SUBR2;
207 P1 = R3;
208 R4 = P1;
209 [ -- SP ] = ( R7:0 );
210// POP
211 R0 = 0x00;
212 R1 = 0x00;
213 R2 = 0x00;
214 R3 = 0x00;
215 R4 = 0x00;
216 R5 = 0x00;
217 R6 = 0x00;
218 R7 = 0x00;
219
220LABEL2:
221// RAISE 7; // RTI
222 P4 = R4;
223 R5 = P4;
224 ( R7:0 ) = [ SP ++ ];
225
226
227
228CHECKREG(r0, 0x00000001);
229CHECKREG(r1, 0x00000012);
230CHECKREG(r2, 0x00000023);
231CHECKREG(r3, 0x00000024);
232CHECKREG(r4, 0x00000024);
233CHECKREG(r5, 0x00000026);
234CHECKREG(r6, 0x00000027);
235CHECKREG(r7, 0x00000028);
236
237// RAISE 8; // RTI
238CALL SUBR3;
239 P3 = R5;
240 R6 = P3;
241 ( R7:0 ) = [ SP ++ ];
242CHECKREG(r0, 0x00000001);
243CHECKREG(r1, 0x00000012);
244CHECKREG(r2, 0x00000013);
245CHECKREG(r3, 0x00000013);
246CHECKREG(r4, 0x00000015);
247CHECKREG(r5, 0x00000016);
248CHECKREG(r6, 0x00000017);
249CHECKREG(r7, 0x00000018);
250 R0 = 12;
251 R1 = 13;
252 R2 = 14;
253 R3 = 15;
254 R4 = 16;
255 R5 = 17;
256 R6 = 18;
257 R7 = 19;
258
259
260LABEL3:
261// RAISE 9; // RTI
262 P4 = R6;
263 R7 = P4;
264 ( R7:0 ) = [ SP ++ ];
265
266CHECKREG(r0, 0x00000001);
267CHECKREG(r1, 0x00000002);
268CHECKREG(r2, 0x00000002);
269CHECKREG(r3, 0x00000004);
270CHECKREG(r4, 0x00000005);
271CHECKREG(r5, 0x00000006);
272CHECKREG(r6, 0x00000007);
273CHECKREG(r7, 0x00000008);
274R0 = I0;
275R1 = I1;
276R2 = I2;
277R3 = I3;
278CHECKREG(r0, 0x00000002);
279CHECKREG(r1, 0x00000002);
280CHECKREG(r2, 0x00000002);
281CHECKREG(r3, 0x00000000);
282
283
284END:
285dbg_pass; // End the test
286
287
288SUBR1: // should jump here
289 I0 += 2;
290 RTS;
291 I3 += 2; // should not go here
292 RTS;
293
294SUBR2: // should jump here
295 I1 += 2;
296 RTS;
297 I3 += 2; // should not go here
298 RTS;
299
300SUBR3: // should jump here
301 I2 += 2;
302 RTS;
303 I3 += 2; // should not go here
304 RTS;
305
306
307
308//*********************************************************************
309
310//
311// Handlers for Events
312//
313
314EHANDLE: // Emulation Handler 0
315RTE;
316
317RHANDLE: // Reset Handler 1
318RTI;
319
320NHANDLE: // NMI Handler 2
321 I0 += 2;
322RTN;
323
324XHANDLE: // Exception Handler 3
325 R1 = 3;
326RTX;
327
328HWHANDLE: // HW Error Handler 5
329 I1 += 2;
330RTI;
331
332THANDLE: // Timer Handler 6
333 I2 += 2;
334RTI;
335
336I7HANDLE: // IVG 7 Handler
337 I3 += 2;
338RTI;
339
340I8HANDLE: // IVG 8 Handler
341 I0 += 2;
342RTI;
343
344I9HANDLE: // IVG 9 Handler
345 I0 += 2;
346RTI;
347
348I10HANDLE: // IVG 10 Handler
349 R7 = 10;
350RTI;
351
352I11HANDLE: // IVG 11 Handler
353 I0 = R0;
354 I1 = R1;
355 I2 = R2;
356 I3 = R3;
357 M0 = R4;
358 R0 = 11;
359RTI;
360
361I12HANDLE: // IVG 12 Handler
362 R1 = 12;
363RTI;
364
365I13HANDLE: // IVG 13 Handler
366 R2 = 13;
367RTI;
368
369I14HANDLE: // IVG 14 Handler
370 R3 = 14;
371RTI;
372
373I15HANDLE: // IVG 15 Handler
374 R4 = 15;
375RTI;
376
377NOP;NOP;NOP;NOP;NOP;NOP;NOP; // needed for icache bug
378
379//
380// Data Segment
381//
382
383.data
384DATA:
385 .space (0x10);
386
387// Stack Segments (Both Kernel and User)
388
389 .space (STACKSIZE);
390KSTACK:
391
392 .space (STACKSIZE);
393USTACK: