1// assert that we can issue a software exception
2// and that the expt number is passed correctly through
3// SEQSTAT.
4# mach: bfin
5# sim: --environment operating
6
7	.include "testutils.inc"
8
9	start
10.ifndef BFIN_HOST
11	imm32 p0, 0xFFE02000;	/* EVT0 */
12	P1 = re (Z);		// load a pointer to ihandler interrupt 1
13	P1.H = re;
14	[ P0 + (4*3) ] = P1;
15
16	R0 = -1;	/* unmask all interrupts */
17	imm32 p1, 0xFFE02104;
18	[P1] = R0;
19
20	R0 = start_uspace (Z);
21	R0.H = start_uspace;
22	RETI = R0;
23	RTI;
24start_uspace:
25	EXCPT 10;
26
27	DBGA ( R1.L , 0x1238 );
28
29	dbg_pass;
30
31	// ihandler
32re:
33	R0 = SEQSTAT;
34	R0 <<= (32-6);
35	R0 >>= (32-6);
36	R2 = 0x20;
37	CC = R0 < R2;
38	IF !CC JUMP _error;
39	DBGA ( R0.L , 0xa );
40	R1 = 0x1234 (X);
41	R1 += 1;
42	R1 += 1;
43	R1 += 1;
44	R1 += 1;
45	RTX;
46
47_error:
48	DBGA ( R0.L , EXCPT_PROTVIOL );
49	dbg_fail;
50
51.endif
52