1# Blackfin testcase for the CEC (handling exceptions from usermode) 2# mach: bfin 3# sim: --environment operating 4 5 .include "testutils.inc" 6 7 start 8.ifndef BFIN_HOST 9 // load address of exception handler 10 imm32 p0, 0xFFE02000; /* EVT0 */ 11 R0 = exception_handler (Z); 12 R0.H = exception_handler; 13 [ P0 + (4*3) ] = R0; 14 // Jump to User mode and enable exceptions 15 R0 = UserCode (Z); 16 R0.H = UserCode; 17 RETI = R0; 18 RTI; 19 20UserCode: 21 R4 = 0xec39 (Z); 22 R0 = 0xcafe (Z); 23 L3 = 0xf41f (Z); 24 L3.H = 0x1ce9; 25 I3 = 0xfe10 (Z); 26 I3.H = 0x20a9; 27 B3 = 0x4552 (Z); 28 B3.H = 0x15f0; 29 30 // should except - r4 dep 31 // R4 = R4 >> 25 || W [ I3 ++ ] = R0.H || R4 = [ I3 ]; 32.Lskip_start: 33 .rep 8 34 .byte 0xff 35 .endr 36 dbg_fail; 37.Lskip_end: 38 NOP; 39 NOP; 40 NOP; 41 NOP; 42 NOP; 43 dbg_pass; 44 45exception_handler: 46 // just skip over excepting instructions 47 R0 = RETX; 48 R1.L = .Lskip_start; 49 R1.H = .Lskip_start; 50 R2.L = .Lskip_end; 51 R2.H = .Lskip_end; 52 R2 = R2 - R1; 53 R0 = R0 + R2; 54 RETX = R0; 55 RTX; 56.endif 57