Home | History | Annotate | Line # | Download | only in bfin
      1  1.1  christos # Blackfin testcase for having RETI set correctly
      2  1.1  christos # mach: bfin
      3  1.1  christos # sim: --environment operating
      4  1.1  christos 
      5  1.1  christos #include "test.h"
      6  1.1  christos 	.include "testutils.inc"
      7  1.1  christos 
      8  1.1  christos 	# This test keeps P5 as the base of the EVT table
      9  1.1  christos 
     10  1.1  christos 	.macro set_evt lvl:req, sym:req
     11  1.1  christos 	loadsym R1, \sym;
     12  1.1  christos 	[P5 + 4 * \lvl\()] = R1;
     13  1.1  christos 	.endm
     14  1.1  christos 
     15  1.1  christos 	start
     16  1.1  christos 
     17  1.1  christos 	# First mark all EVTs as fails (they shouldn't be activated)
     18  1.1  christos 	imm32 P5, EVT0;
     19  1.1  christos 	P1 = P5;
     20  1.1  christos 	loadsym R1, fail_lvl
     21  1.1  christos 	imm32 P2, 16
     22  1.1  christos 	LSETUP (1f, 1f) LC0 = P2;
     23  1.1  christos 1:	[P1++] = R1;
     24  1.1  christos 
     25  1.1  christos 	# We'll bounce up a few
     26  1.1  christos 	set_evt 6, evt6;
     27  1.1  christos 	set_evt 7, evt7;
     28  1.1  christos 	set_evt 8, evt8;
     29  1.1  christos 	set_evt 9, evt9;
     30  1.1  christos 
     31  1.1  christos 	# Lower ourselves down so we can RAISE up
     32  1.1  christos 	set_evt 14, evt14;
     33  1.1  christos 	loadsym R1, wait;
     34  1.1  christos 	RETI = R1;
     35  1.1  christos 	RAISE 14;
     36  1.1  christos 	R7 = -1;
     37  1.1  christos 	sti R7;
     38  1.1  christos 	RTI;
     39  1.1  christos 
     40  1.1  christos wait:
     41  1.1  christos 	jump wait;
     42  1.1  christos 
     43  1.1  christos evt14:
     44  1.1  christos 	# Activate interrupt nesting early
     45  1.1  christos 	[--SP] = RETI;
     46  1.1  christos 
     47  1.1  christos 	# We activate the interrupt here ...
     48  1.1  christos 	loadsym R1, 1f;
     49  1.1  christos 	RAISE 9;
     50  1.1  christos 	# ... but we should RETI here
     51  1.1  christos 1:	JUMP fail_lvl;
     52  1.1  christos 
     53  1.1  christos evt9:
     54  1.1  christos 	R2 = RETI;
     55  1.1  christos 	CC = R1 == R2;
     56  1.1  christos 	IF !CC JUMP fail_lvl;
     57  1.1  christos 
     58  1.1  christos 	# We activate the interrupt here ...
     59  1.1  christos 	loadsym R1, 1f;
     60  1.1  christos 	RAISE 8;
     61  1.1  christos 	[--SP] = RETI;
     62  1.1  christos 	# ... but we should RETI here
     63  1.1  christos 1:	JUMP fail_lvl;
     64  1.1  christos 
     65  1.1  christos evt8:
     66  1.1  christos 	R2 = RETI;
     67  1.1  christos 	CC = R1 == R2;
     68  1.1  christos 	IF !CC JUMP fail_lvl;
     69  1.1  christos 
     70  1.1  christos 	# Activate interrupt nesting early
     71  1.1  christos 	[--SP] = RETI;
     72  1.1  christos 
     73  1.1  christos 	# We activate the interrupt here ...
     74  1.1  christos 	loadsym R1, 1f;
     75  1.1  christos 	cli R7;
     76  1.1  christos 	RAISE 7;
     77  1.1  christos 	sti R7;
     78  1.1  christos 	# ... but we should RETI here
     79  1.1  christos 1:	JUMP fail_lvl;
     80  1.1  christos 
     81  1.1  christos evt7:
     82  1.1  christos 	R2 = RETI;
     83  1.1  christos 	CC = R1 == R2;
     84  1.1  christos 	IF !CC JUMP fail_lvl;
     85  1.1  christos 
     86  1.1  christos 	# Activate interrupt nesting early
     87  1.1  christos 	[--SP] = RETI;
     88  1.1  christos 
     89  1.1  christos 	# We activate the interrupt here ...
     90  1.1  christos 	imm32 P0, IMASK
     91  1.1  christos 	R7 = [P0];
     92  1.1  christos 	R6 = 0;
     93  1.1  christos 	[P0] = R6;
     94  1.1  christos 	loadsym R1, 1f;
     95  1.1  christos 	RAISE 6;
     96  1.1  christos 	[P0] = R7;
     97  1.1  christos 	# ... but we should RETI here
     98  1.1  christos 	# don't jump to fail_lvl as the pipeline might advance
     99  1.1  christos 	# the PC to the fail_lvl point before the ivg actually
    100  1.1  christos 	# gets a chance to fire
    101  1.1  christos 1:	JUMP 1b;
    102  1.1  christos 
    103  1.1  christos evt6:
    104  1.1  christos 	R2 = RETI;
    105  1.1  christos 	CC = R1 == R2;
    106  1.1  christos 	IF !CC JUMP fail_lvl;
    107  1.1  christos 
    108  1.1  christos 	dbg_pass
    109  1.1  christos 
    110  1.1  christos fail_lvl:
    111  1.1  christos 	dbg_fail;
    112