ld: Move the .note.build-id section to near the start of the memory map.
[binutils-gdb.git] / sim / testsuite / bfin / c_seq_wb_rti_lsmmrj_mvp.S
blob4b97beef57465e534a30a53d679215ecb2a6e0ef
1 //Original:/proj/frio/dv/testcases/core/c_seq_wb_rti_lsmmrj_mvp/c_seq_wb_rti_lsmmrj_mvp.dsp
2 // Spec Reference: sequencer:wb ( rti ldst mmr jump regmv pushpopmultiple)
3 # mach: bfin
4 # sim: --environment operating
6 #include "test.h"
7 .include "testutils.inc"
8 start
10 include(std.inc)
11 include(selfcheck.inc)
12 include(gen_int.inc)
13 INIT_R_REGS(0);
14 INIT_P_REGS(0);
15 INIT_I_REGS(0);     // initialize the dsp address regs
16 INIT_M_REGS(0);
17 INIT_L_REGS(0);
18 INIT_B_REGS(0);
19 //CHECK_INIT(p5, 0xe0000000);
20 include(symtable.inc)
21 CHECK_INIT_DEF(p5);
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
39 GEN_INT_INIT(ITABLE) // set location for interrupt table
42 // Reset/Bootstrap Code
43 //   (Here we should set the processor operating modes, initialize registers,
46 BOOT:
48                               // in reset mode now
49 LD32_LABEL(sp, KSTACK);   // setup the stack pointer
50 FP = SP;        // and frame pointer
52 LD32(p0, EVT);      // Setup Event Vectors and Handlers
53 LD32_LABEL(r0, EHANDLE);  // Emulation Handler (Int0)
54     [ P0 ++ ] = R0;
56 LD32_LABEL(r0, RHANDLE);  // Reset Handler (Int1)
57     [ P0 ++ ] = R0;
59 LD32_LABEL(r0, NHANDLE);  // NMI Handler (Int2)
60     [ P0 ++ ] = R0;
62 LD32_LABEL(r0, XHANDLE);  // Exception Handler (Int3)
63     [ P0 ++ ] = R0;
65     [ P0 ++ ] = R0;        // IVT4 not used
67 LD32_LABEL(r0, HWHANDLE); // HW Error Handler (Int5)
68     [ P0 ++ ] = R0;
70 LD32_LABEL(r0, THANDLE);  // Timer Handler (Int6)
71     [ P0 ++ ] = R0;
73 LD32_LABEL(r0, I7HANDLE); // IVG7 Handler
74     [ P0 ++ ] = R0;
76 LD32_LABEL(r0, I8HANDLE); // IVG8 Handler
77     [ P0 ++ ] = R0;
79 LD32_LABEL(r0, I9HANDLE); // IVG9 Handler
80     [ P0 ++ ] = R0;
82 LD32_LABEL(r0, I10HANDLE);// IVG10 Handler
83     [ P0 ++ ] = R0;
85 LD32_LABEL(r0, I11HANDLE);// IVG11 Handler
86     [ P0 ++ ] = R0;
88 LD32_LABEL(r0, I12HANDLE);// IVG12 Handler
89     [ P0 ++ ] = R0;
91 LD32_LABEL(r0, I13HANDLE);// IVG13 Handler
92     [ P0 ++ ] = R0;
94 LD32_LABEL(r0, I14HANDLE);// IVG14 Handler
95     [ P0 ++ ] = R0;
97 LD32_LABEL(r0, I15HANDLE);// IVG15 Handler
98     [ P0 ++ ] = R0;
100 LD32(p0, EVT_OVERRIDE);
101     R0 = 0;
102     [ P0 ++ ] = R0;
103     R0 = -1;     // Change this to mask interrupts (*)
104     [ P0 ] = R0;   // IMASK
105 CSYNC;
107 DUMMY:
109     R0 = 0 (Z);
111 LT0 = r0;       // set loop counters to something deterministic
112 LB0 = r0;
113 LC0 = r0;
114 LT1 = r0;
115 LB1 = r0;
116 LC1 = r0;
118 ASTAT = r0;     // reset other internal regs
120 // The following code sets up the test for running in USER mode
122 LD32_LABEL(r0, STARTUSER);// One gets to user mode by doing a
123                         // ReturnFromInterrupt (RTI)
124 RETI = r0;      // We need to load the return address
126 // Comment the following line for a USER Mode test
128 JUMP    STARTSUP;   // jump to code start for SUPERVISOR mode
130 RTI;
132 STARTSUP:
133 LD32_LABEL(p1, BEGIN);
135 LD32(p0, EVT15);
136     [ P0 ] = P1;   // IVG15 (General) handler (Int 15) load with start
138 RAISE 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.
142 NOP;    // Workaround for Bug 217
143 RTI;
146 // The Main Program
148 STARTUSER:
149 LD32_LABEL(sp, USTACK);   // setup the stack pointer
150 FP = SP;            // set frame pointer
151 JUMP BEGIN;
153 //*********************************************************************
155 BEGIN:
157                 // COMMENT the following line for USER MODE tests
158     [ -- SP ] = RETI;  // enable interrupts in supervisor mode
160                 // **** YOUR CODE GOES HERE ****
164     // PUT YOUR TEST HERE!
165 // PUSH
166 LD32(p1, 0xFFE02034);       // wrt-rd     EVT13             = 0xFFE02034
167 //LD32(p2, DATA_ADDR_1);
168 loadsym P2, DATA;
169 LD32(p3, 0xab5fd490);
170 LD32(p4, 0xa581bd94);
172 LD32(r2, 0x14789232);
173     [ P1 ] = R2;
174         R0 = 0x01;
175         R1 = 0x02;
176         R2 = 0x03;
177         R3 = 0x04;
178         R4 = 0x05;
179         R5 = 0x06;
180         R6 = 0x07;
181         R7 = 0x08;
182         [ -- SP ] = ( R7:0 );
183 RAISE 2;    // RTN
184     R0 = [ P2 ++ ];
185     R1 = [ P1 ];
186 JUMP.S LABEL1;
187     P3 = R7;
188     R4 = P3;
189         [ -- SP ] = ( R7:0 );
190         R1 = 0x12;
191         R2 = 0x13;
192         R3 = 0x14;
193         R4 = 0x15;
194         R5 = 0x16;
195         R6 = 0x17;
196         R7 = 0x18;
198 LABEL1:
199 RAISE 5;    // RTI
200     R2 = [ P2 ++ ];
202     P4 = R6;
203     R3 = P4;
205         [ -- SP ] = ( R7:0 );
207         R2 = 0x23;
208         R3 = 0x24;
209         R4 = 0x25;
210         R5 = 0x26;
211         R6 = 0x27;
212         R7 = 0x28;
214 // wrt-rd     EVT5              = 0xFFE02034
215 LD32(p1, 0xFFE02034);       // wrt-rd     EVT13             = 0xFFE02034
216 RAISE 6;    // RTI
217     R4 = [ P2 ++ ];
218     R6 = [ P1 ];
219 JUMP.S LABEL2;
220     P3 = R3;
221     R5 = P3;
222         [ -- SP ] = ( R7:0 );
223 // POP
224         R0 = 0x00;
225         R1 = 0x00;
226         R2 = 0x00;
227         R3 = 0x00;
228         R4 = 0x00;
229         R5 = 0x00;
230         R6 = 0x00;
231         R7 = 0x00;
233 LABEL2:
234 CSYNC;
235 CHECKREG(r0, 0x00010203);
236 CHECKREG(r1, 0x14789232);
237 CHECKREG(r2, 0x00000023);
238 CHECKREG(r3, 0x00000024);
239 CHECKREG(r4, 0x08090A0B);
240 CHECKREG(r5, 0x00000026);
241 CHECKREG(r6, 0x14789232);
242 RAISE 7;    // RTI
243     R0 = [ P2 ++ ];
244     R1 = [ P1 ];
245     P4 = R4;
246     R2 = P4;
247         ( R7:0 ) = [ SP ++ ];
251 CHECKREG(r0, 0x00010203);
252 CHECKREG(r1, 0x14789232);
253 CHECKREG(r2, 0x04050607);
254 CHECKREG(r3, 0x00000007);
255 CHECKREG(r4, 0x00000005);
256 CHECKREG(r5, 0x00000006);
257 CHECKREG(r6, 0x00000007);
258 CHECKREG(r7, 0x00000008);
259 // wrt-rd     EVT13             = 0xFFE02034
260 LD32(p1, 0xFFE02034);
261 RAISE 8;    // RTI
262     R0 = [ P2 ++ ];
263     R1 = [ P1 ];
264 JUMP.S LABEL3;
265     P1 = R5;
266     R6 = P1;
267         ( R7:0 ) = [ SP ++ ];
268 //CHECKREG(r0, 0x000000a1);  // CHECKREG can not be skipped
269 //CHECKREG(r1, 0x000000b2);  // so they cannot appear here
270 //CHECKREG(r2, 0x000000c3);
271 //CHECKREG(r3, 0x000000d4);
272 //CHECKREG(r4, 0x000000e5);
273 //CHECKREG(r5, 0x000000f6);
274 //CHECKREG(r6, 0x00000017);
275 //CHECKREG(r7, 0x00000028);
276    R0 = 12;
277    R1 = 13;
278    R2 = 14;
279    R3 = 15;
280    R4 = 16;
281    R5 = 17;
282    R6 = 18;
283    R7 = 19;
286 LABEL3:
287 CSYNC;
288 CHECKREG(r0, 0x10111213);
289 CHECKREG(r1, 0x14789232);
290 RAISE 9;    // RTI
291     P3 = R6;
292     R7 = P3;
293         ( R7:0 ) = [ SP ++ ];
295 CHECKREG(r0, 0x00000001);
296 CHECKREG(r1, 0x00000002);
297 CHECKREG(r2, 0x00000003);
298 CHECKREG(r3, 0x00000004);
299 CHECKREG(r4, 0x00000005);
300 CHECKREG(r5, 0x00000006);
301 CHECKREG(r6, 0x00000007);
302 CHECKREG(r7, 0x00000008);
303 R0 = I0;
304 R1 = I1;
305 R2 = I2;
306 R3 = I3;
307 CHECKREG(r0, 0x00000006);
308 CHECKREG(r1, 0x00000002);
309 CHECKREG(r2, 0x00000002);
310 CHECKREG(r3, 0x00000002);
313 END:
314 dbg_pass;            // End the test
316 //*********************************************************************
319 // Handlers for Events
322 EHANDLE:            // Emulation Handler 0
323 RTE;
325 RHANDLE:            // Reset Handler 1
326 RTI;
328 NHANDLE:            // NMI Handler 2
329     I0 += 2;
330 RTN;
332 XHANDLE:            // Exception Handler 3
333     R1 = 3;
334 RTX;
336 HWHANDLE:           // HW Error Handler 5
337     I1 += 2;
338 RTI;
340 THANDLE:            // Timer Handler 6
341     I2 += 2;
342 RTI;
344 I7HANDLE:           // IVG 7 Handler
345     I3 += 2;
346 RTI;
347     //  ***********
348     R0 = [ P2 ++ ];
349     R1 = [ P1 ];
350 JUMP.S LABEL3;
351     P1 = R5;
352     R6 = P1;
353         ( R7:0 ) = [ SP ++ ];
354     //  ***********
355 I8HANDLE:           // IVG 8 Handler
356     I0 += 2;
357 RTI;
359 I9HANDLE:           // IVG 9 Handler
360     I0 += 2;
361 RTI;
362     //  ***********
363     R0 = [ P2 ++ ];
364     R1 = [ P1 ];
365 JUMP.S LABEL3;
366     P1 = R5;
367     R6 = P1;
368         ( R7:0 ) = [ SP ++ ];
369     //  ***********
371 I10HANDLE:          // IVG 10 Handler
372     R7 = 10;
373 RTI;
375 I11HANDLE:          // IVG 11 Handler
376     I0 = R0;
377     I1 = R1;
378     I2 = R2;
379     I3 = R3;
380     M0 = R4;
381     R0 = 11;
382 RTI;
384 I12HANDLE:          // IVG 12 Handler
385     R1 = 12;
386 RTI;
388 I13HANDLE:          // IVG 13 Handler
389     R2 = 13;
390 RTI;
392 I14HANDLE:          // IVG 14 Handler
393     R3 = 14;
394 RTI;
396 I15HANDLE:          // IVG 15 Handler
397     R4 = 15;
398 RTI;
400 NOP;NOP;NOP;NOP;NOP;NOP;NOP; // needed for icache bug
403 // Data Segment
406 .section MEM_DATA_ADDR_1,"aw"
407 DATA:
408 //  .space (0x10);
409 .dd 0x00010203
410 .dd 0x04050607
411 .dd 0x08090A0B
412 .dd 0x0C0D0E0F
413 .dd 0x10111213
414 .dd 0x14151617
415 .dd 0x18191A1B
416 .dd 0x1C1D1E1F
417 .dd 0x11223344
418 .dd 0x55667788
419 .dd 0x99717273
420 .dd 0x74757677
421 .dd 0x82838485
422 .dd 0x86878889
423 .dd 0x80818283
424 .dd 0x84858687
425 .dd 0x01020304
426 .dd 0x05060708
427 .dd 0x09101112
428 .dd 0x14151617
429 .dd 0x18192021
432 // Stack Segments (Both Kernel and User)
434     .space (STACKSIZE);
435 KSTACK:
437     .space (STACKSIZE);
438 USTACK:
440 .section MEM_DATA_ADDR_2,"aw"
441 .dd 0x20212223
442 .dd 0x24252627
443 .dd 0x28292A2B
444 .dd 0x2C2D2E2F
445 .dd 0x30313233
446 .dd 0x34353637
447 .dd 0x38393A3B
448 .dd 0x3C3D3E3F
449 .dd 0x91929394
450 .dd 0x95969798
451 .dd 0x99A1A2A3
452 .dd 0xA5A6A7A8
453 .dd 0xA9B0B1B2
454 .dd 0xB3B4B5B6
455 .dd 0xB7B8B9C0