Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
//Original:/proj/frio/dv/testcases/seq/se_illegalcombination/se_illegalcombination.dsp
// Description: Multi-issue Illegal Combinations
# mach: bfin
# sim: --environment operating
# xfail: "missing a few checks; hardware doesnt seem to match PRM?" bfin-*

#include "test.h"
.include "testutils.inc"
start

//
// Constants and Defines
//

include(gen_int.inc)
include(selfcheck.inc)
include(std.inc)
include(mmrs.inc)
include(symtable.inc)

#ifndef STACKSIZE
#define STACKSIZE 0x100   // change for how much stack you need
#endif
#ifndef ITABLE
#define ITABLE 0xF0000000
#endif

GEN_INT_INIT(ITABLE) // set location for interrupt table

//
// Reset/Bootstrap Code
//   (Here we should set the processor operating modes, initialize registers,
//    etc.)
//

BOOT:
INIT_R_REGS(0);     // initialize general purpose regs

INIT_P_REGS(0);     // initialize the pointers

INIT_I_REGS(0);     // initialize the dsp address regs
INIT_M_REGS(0);
INIT_L_REGS(0);
INIT_B_REGS(0);

CLI R1;           // inhibit events during MMR writes

LD32_LABEL(sp, USTACK);   // setup the user stack pointer
USP = SP;

LD32_LABEL(sp, KSTACK);   // setup the kernel stack pointer
FP = SP;        // and frame pointer

LD32(p0, EVT0);      // Setup Event Vectors and Handlers

    P0 += 4;            // EVT0 not used (Emulation)

    P0 += 4;            // EVT1 not used (Reset)

LD32_LABEL(r0, NHANDLE);  // NMI Handler (Int2)
    [ P0 ++ ] = R0;

LD32_LABEL(r0, XHANDLE);  // Exception Handler (Int3)
    [ P0 ++ ] = R0;

    P0 += 4;            // EVT4 not used (Global Interrupt Enable)

LD32_LABEL(r0, HWHANDLE); // HW Error Handler (Int5)
    [ P0 ++ ] = R0;

LD32_LABEL(r0, THANDLE);  // Timer Handler (Int6)
    [ P0 ++ ] = R0;

LD32_LABEL(r0, I7HANDLE); // IVG7 Handler
    [ P0 ++ ] = R0;

LD32_LABEL(r0, I8HANDLE); // IVG8 Handler
    [ P0 ++ ] = R0;

LD32_LABEL(r0, I9HANDLE); // IVG9 Handler
    [ P0 ++ ] = R0;

LD32_LABEL(r0, I10HANDLE);// IVG10 Handler
    [ P0 ++ ] = R0;

LD32_LABEL(r0, I11HANDLE);// IVG11 Handler
    [ P0 ++ ] = R0;

LD32_LABEL(r0, I12HANDLE);// IVG12 Handler
    [ P0 ++ ] = R0;

LD32_LABEL(r0, I13HANDLE);// IVG13 Handler
    [ P0 ++ ] = R0;

LD32_LABEL(r0, I14HANDLE);// IVG14 Handler
    [ P0 ++ ] = R0;

LD32_LABEL(r0, I15HANDLE);// IVG15 Handler
    [ P0 ++ ] = R0;

LD32(p0, EVT_OVERRIDE);
    R0 = 0;
    [ P0 ++ ] = R0;

    R1 = -1;     // Change this to mask interrupts (*)
CSYNC;       // wait for MMR writes to finish
STI R1;      // sync and reenable events (implicit write to IMASK)

DUMMY:

    A0 = 0;         // reset accumulators
    A1 = 0;

    R0 = 0 (Z);

LT0 = r0;       // set loop counters to something deterministic
LB0 = r0;
LC0 = r0;
LT1 = r0;
LB1 = r0;
LC1 = r0;

ASTAT = r0;     // reset other internal regs
SYSCFG = r0;
RETS = r0;      // prevent X's breaking LINK instruction

// The following code sets up the test for running in USER mode

LD32_LABEL(r0, STARTUSER);// One gets to user mode by doing a
                        // ReturnFromInterrupt (RTI)
RETI = r0;      // We need to load the return address

// Comment the following line for a USER Mode test

JUMP    STARTSUP;   // jump to code start for SUPERVISOR mode

RTI;

STARTSUP:
LD32_LABEL(p1, BEGIN);

LD32(p0, EVT15);

CLI R1;   // inhibit events during write to MMR
    [ P0 ] = P1;  // IVG15 (General) handler (Int 15) load with start
CSYNC;      // wait for it
STI R1;     // reenable events with proper imask

RAISE 15;       // after we RTI, INT 15 should be taken

RTI;

//
// The Main Program
//

STARTUSER:

LINK 0;     // change for how much stack frame space you need.

JUMP BEGIN;

//*********************************************************************

BEGIN:

                // COMMENT the following line for USER MODE tests
    [ -- SP ] = RETI;  // enable interrupts in supervisor mode

                // **** YOUR CODE GOES HERE ****

    // PUT YOUR TEST HERE!

// Slot 0 can only be LDST LOAD with search instruction (2 instrs)


 .dw 0xcc0d	//(R0,R1)=SEARCH R2(GT)||[P0]=R3||NOP;
 .dw 0x0210
 .dw 0x9303
 .dw 0x0000
// (r0,r1) = search r2 gt, nop, r3 = [i0]; // nop supposedly ok
( R0 , R1 ) = SEARCH R2 (GT) || R4 = [ P0 ++ P1 ] || NOP;

// only nop or dspLDST allowed in slot 1 (1 instr)

  // a0 = r0, nop, [p0] = r3;
  .dw 0xCC09;   // can't assemble
  .dw 0x2000;
  .dw 0x0000;
  .dw 0x9303;

// Slot 0 illegal opcodes (1 instr)

  // a0 = r0, raise 15, nop;
  .dw 0xCC09;   // can't assemble
  .dw 0x2000;
  .dw 0x009F;
  .dw 0x0000;

// multiissue with two stores (8 instrs)


 .dw 0xcc09	//A0=R0||W[P3]=R5.L||[I0]=R4;
 .dw 0x2000
 .dw 0x8b5b
 .dw 0x9f04

 .dw 0xcc09	//A0=R0||[I2]=R2||[I0]=R4;
 .dw 0x2000
 .dw 0x9f12
 .dw 0x9f04

 .dw 0xcc09	//A0=R0||[P3]=R0||[I0]=R4;
 .dw 0x2000
 .dw 0x9318
 .dw 0x9f04

 .dw 0xcc09	//A0=R0||[P3]=P0||[I0]=R4;
 .dw 0x2000
 .dw 0x9358
 .dw 0x9f04

 .dw 0xcc09	//A0=R0||[FP+-36]=R0||[I0]=R4;
 .dw 0x2000
 .dw 0xbb70
 .dw 0x9f04

 .dw 0xcc09	//A0=R0||[FP+-48]=P0||[I0]=R4;
 .dw 0x2000
 .dw 0xbb48
 .dw 0x9f04

 .dw 0xcc09	//A0=R0||[P3+0x20]=R1||[I0]=R4;
 .dw 0x2000
 .dw 0xb219
 .dw 0x9f04

 .dw 0xcc09	//A0=R0||[P3+0x20]=P1||[I0]=R4;
 .dw 0x2000
 .dw 0xbe19
 .dw 0x9f04

// multiissue two instructions can't modify same ireg (6 instrs)


 .dw 0xcc09	//A0=R0||I0+=M1(BREV)||R1.L=W[I0++];
 .dw 0x2000
 .dw 0x9ee4
 .dw 0x9c21

 .dw 0xcc09	//A0=R0||I1-=M3||R0=[I1++M3];
 .dw 0x2000
 .dw 0x9e7d
 .dw 0x9de8

 .dw 0xcc09	//A0=R0||I2+=2||W[I2++]=R0.L;
 .dw 0x2000
 .dw 0x9f62
 .dw 0x9e30

 .dw 0xcc09	//A0=R0||I3-=4||[I3++M1]=R7;
 .dw 0x2000
 .dw 0x9f6f
 .dw 0x9fbf

 .dw 0xcc09	//A0=R0||R1.L=W[I1++]||W[I1++]=R2.L;
 .dw 0x2000
 .dw 0x9c29
 .dw 0x9e2a

 .dw 0xcc09	//A0=R0||[I2++M3]=R7||R6=[I2++M0];
 .dw 0x2000
 .dw 0x9ff7
 .dw 0x9d96

// multiissue two instructions can't load same dreg (9 instrs)


 .dw 0xcc09	//A0=R0||R0.L=W[P0++P2]||R0=[I0++];
 .dw 0x2000
 .dw 0x8210
 .dw 0x9c00

 .dw 0xcc09	//A0=R0||R1=W[P0++P3](X)||R1.L=W[I2];
 .dw 0x2000
 .dw 0x8e58
 .dw 0x9d31

 .dw 0xcc09	//A0=R0||R2=W[P0++P3](X)||R2=[I1++M3];
 .dw 0x2000
 .dw 0x8e98
 .dw 0x9dea

 .dw 0xcc09	//A0=R0||R3=[I0++]||R3=[I1++];
 .dw 0x2000
 .dw 0x9c03
 .dw 0x9c0b

 .dw 0xcc09	//A0=R0||R4.L=W[I2]||R4.L=W[I3];
 .dw 0x2000
 .dw 0x9d34
 .dw 0x9d3c

 .dw 0xcc09	//A0=R0||R5=[I1++M3]||R5.L=W[I2++];
 .dw 0x2000
 .dw 0x9ded
 .dw 0x9c35

 .dw 0xcc09	//A0=R0||R6=[P0]||R6=[I0++];
 .dw 0x2000
 .dw 0x9106
 .dw 0x9c06

 .dw 0xcc09	//A0=R0||R7=[FP+-56]||R7.L=W[I1];
 .dw 0x2000
 .dw 0xb927
 .dw 0x9d2f

 .dw 0xcc09	//A0=R0||R0=W[P1+0x1e](X)||R0=[I0++];
 .dw 0x2000
 .dw 0xabc8
 .dw 0x9c00

// dsp32alu instructions with one dest and slot 0 multi with same dest (1 ins)


 .dw 0xcc00	//R0=R2+|+R3||R0=W[P1+0x1e](X)||NOP;
 .dw 0x0013
 .dw 0xabc8
 .dw 0x0000
        // other slot 0 dreg cases already covered

// dsp32alu one dest and slot 1 multi with same dest (1 ins)


 .dw 0xcc18	//R1=BYTEPACK(R4,R5)||NOP||R1.L=W[I2];
 .dw 0x0225
 .dw 0x0000
 .dw 0x9d31
        // other slot 1 dreg dest cases already covered

// dsp32alu dual dests and slot 0 multi with either same dest (2 instrs)


 .dw 0xcc18	//(R2,R3)=BYTEUNPACKR1:0||R2=W[P0++P3](X)||NOP;
 .dw 0x4680
 .dw 0x8e98
 .dw 0x0000

 .dw 0xcc01	//R2=R2+|+R3,R3=R2-|-R3||R3=[P3]||NOP;
 .dw 0x0693
 .dw 0x911b
 .dw 0x0000

// dsp32alu dual dests and slot 1 multi with either same dest (2 instrs)


 .dw 0xcc18	//(R4,R5)=BYTEUNPACKR1:0||NOP||R4=[I1++M3];
 .dw 0x4b00
 .dw 0x0000
 .dw 0x9dec

 .dw 0xcc01	//R4=R2+|+R3,R5=R2-|-R3||NOP||R5.L=W[I2++];
 .dw 0x0b13
 .dw 0x0000
 .dw 0x9c35

// dsp32shift one dest and slot 0 multi with same dest (1 instruction)


 .dw 0xce0d	//R6=ALIGN8(R4,R5)||R6=[P0]||NOP;
 .dw 0x0c2c
 .dw 0x9106
 .dw 0x0000

// dsp32shift one dest and slot 1 multi with same dest (1 instruction)


 .dw 0xce00	//R7.L=ASHIFTR0.HBYR7.L||NOP||R7.L=W[I1];
 .dw 0x1e38
 .dw 0x0000
 .dw 0x9d2f

// dsp32shift two dests and slot 0 multi with either same dest (2 instrs)


 .dw 0xce08	//BITMUX(R0,R1,A0)(ASR)||R0.L=W[P0++P2]||NOP;
 .dw 0x0001
 .dw 0x8210
 .dw 0x0000

 .dw 0xce08	//BITMUX(R2,R3,A0)(ASL)||R3=[I0++]||NOP;
 .dw 0x4013
 .dw 0x9c03
 .dw 0x0000

// dsp32shift two dests and slot 1 multi with either same dest (2 instrs)


 .dw 0xce08	//BITMUX(R4,R5,A0)(ASR)||NOP||R4.H=W[I3];
 .dw 0x0025
 .dw 0x0000
 .dw 0x9d5c

 .dw 0xce08	//BITMUX(R6,R7,A0)(ASL)||NOP||R7.L=W[I1];
 .dw 0x4037
 .dw 0x0000
 .dw 0x9d2f

// dsp32shiftimm one dest and slot 0 with same dest (1 instr)


 .dw 0xce80	//R1.L=R0.H<<0x7||R1=W[P0++P3](X)||NOP;
 .dw 0x1238
 .dw 0x8e58
 .dw 0x0000

// dsp32shiftimm one dest and slot 1 with same dest (1 instr)


 .dw 0xce81	//R5=R2<<0x9(V)||NOP||R5.L=W[I2++];
 .dw 0x0a4a
 .dw 0x0000
 .dw 0x9c35

// dsp32mac one dest and slot 0 multi with same dest (1 inst)


 .dw 0xc805	//A0+=R1.H*R0.L,R6.H=(A1+=R1.L*R0.H)||R6=W[P0++P3](X)||NOP;
 .dw 0x4d88
 .dw 0x8f98
 .dw 0x0000

// dsp32mult one dest and slot 0 multi with same dest (1 inst)


 .dw 0xca04	//R7.H=R3.L*R4.H||R7=[FP+-56]||NOP;
 .dw 0x41dc
 .dw 0xb927
 .dw 0x0000

// dsp32 mac one dest and slot 1 multi with same dest (1 inst)


 .dw 0xc805	//A0+=R1.H*R0.L,R0.H=(A1+=R1.L*R0.H)||NOP||R0=[I0++];
 .dw 0x4c08
 .dw 0x0000
 .dw 0x9c00

// dsp32mult one dest and slot 1 multi with same dest (1 inst)


 .dw 0xca04	//R1.H=R3.L*R4.H||NOP||R1.H=W[I1];
 .dw 0x405c
 .dw 0x0000
 .dw 0x9d49

// dsp32mac write to register pair and slot 0 same dest - even (1 instr)


 .dw 0xc80d	//R3=(A1+=R1.L*R0.H),R2=(A0+=R1.H*R0.L)||R2=W[P0++P3](X)||NOP;
 .dw 0x6c88
 .dw 0x8e98
 .dw 0x0000

// dsp32mult write to register pair and slot 0 same dest - even (1 instr)


 .dw 0xca0c	//R5=R1.L*R0.H,R4=R1.H*R0.L||R4=[P0++P1]||NOP;
 .dw 0x6508
 .dw 0x8108
 .dw 0x0000

// dsp32mac write to register pair and slot 1 same dest - even (1 instr)


 .dw 0xc80d	//R3=(A1+=R1.L*R0.H),R2=(A0+=R1.H*R0.L)||NOP||R2=[I1++M3];
 .dw 0x6c88
 .dw 0x0000
 .dw 0x9dea

// dsp32mult write to register pair and slot 1 same dest - even (1 instr)


 .dw 0xca0c	//R5=R1.L*R0.H,R4=R1.H*R0.L||NOP||R4=[I1++M3];
 .dw 0x6508
 .dw 0x0000
 .dw 0x9dec

// dsp32mac write to register pair and slot 0 same dest - odd (1 instr)


 .dw 0xc80d	//A0+=R1.H*R0.L,R3=(A1+=R1.L*R0.H)||R3=W[P0++P3](X)||NOP;
 .dw 0x4c88
 .dw 0x8ed8
 .dw 0x0000

// dsp32mult write to register pair and slot 0 same dest - odd (1 instr)


 .dw 0xca0c	//R5=R1.L*R0.H,R4=R1.H*R0.L||R5=[P0++P1]||NOP;
 .dw 0x6508
 .dw 0x8148
 .dw 0x0000

// dsp32mac write to register pair and slot 1 same dest - odd (1 instr)


 .dw 0xc80d	//A0+=R1.H*R0.L,R3=(A1+=R1.L*R0.H)||NOP||R3=[I1++M3];
 .dw 0x4c88
 .dw 0x0000
 .dw 0x9deb

// dsp32mult write to register pair and slot 1 same dest - odd (1 instr)


 .dw 0xca0c	//R5=R1.L*R0.H,R4=R1.H*R0.L||NOP||R5=[I1++M3];
 .dw 0x6508
 .dw 0x0000
 .dw 0x9ded

// CHECKER

CHECK_INIT_DEF(p0); //CHECK_INIT(p0, 0xFF7FFFFC);
                    // Xhandler counts all EXCAUSE = 0x22;
CHECKREG(r5, 53); // count of all Illegal Combination Exceptions.

END:
dbg_pass;            // End the test

//*********************************************************************

//
// Handlers for Events
//

NHANDLE:            // NMI Handler 2
RTN;

XHANDLE:            // Exception Handler 3
                    // 16 bit illegal opcode handler - skips bad instruction

    [ -- SP ] = ASTAT; // save what we damage
    [ -- SP ] = ( R7:6 );
    R7 = SEQSTAT;
    R7 <<= 26;
    R7 >>= 26;      // only want EXCAUSE
    R6 = 0x22;      // EXCAUSE 0x22 means I-Fetch Undefined Instruction
CC = r7 == r6;
IF CC JUMP ILLEGALCOMBINATION;   // If EXCAUSE != 0x22 then leave

dbg_fail;
JUMP.S OUT;       // if the EXCAUSE is wrong the test will infinite loop

ILLEGALCOMBINATION:
    R7 = RETX;      // Fix up return address

    R7 += 8;        // skip offending 64 bit instruction

RETX = r7;      // and put back in RETX

    R5 += 1;        // Increment global counter

OUT:
    ( R7:6 ) = [ SP ++ ];
ASTAT = [sp++];

RTX;

HWHANDLE:           // HW Error Handler 5
RTI;

THANDLE:            // Timer Handler 6
RTI;

I7HANDLE:           // IVG 7 Handler
RTI;

I8HANDLE:           // IVG 8 Handler
RTI;

I9HANDLE:           // IVG 9 Handler
RTI;

I10HANDLE:          // IVG 10 Handler
RTI;

I11HANDLE:          // IVG 11 Handler
RTI;

I12HANDLE:          // IVG 12 Handler
RTI;

I13HANDLE:          // IVG 13 Handler
RTI;

I14HANDLE:          // IVG 14 Handler
RTI;

I15HANDLE:          // IVG 15 Handler
RTI;


    // padding for the icache

EXCPT 0; EXCPT 0; EXCPT 0; EXCPT 0; EXCPT 0; EXCPT 0; EXCPT 0;

//
// Data Segment
//

.data
DATA:
    .space (0x10);

// Stack Segments (Both Kernel and User)

    .space (STACKSIZE);
KSTACK:

    .space (STACKSIZE);
USTACK: