daily update
[external/binutils.git] / sim / testsuite / sim / bfin / cec-exact-exception.S
1 # Blackfin testcase for aborting an excepting insn immediately
2 # mach: bfin
3 # sim: --environment operating
4
5 #include "test.h"
6         .include "testutils.inc"
7
8         # This test keeps P5 as the base of the EVT table
9
10         .macro set_evt lvl:req, sym:req
11         loadsym R1, \sym;
12         [P5 + 4 * \lvl\()] = R1;
13         .endm
14
15         start
16
17         # Set up exception handler
18         imm32 P4, EVT3;
19         loadsym R1, _evx;
20         [P4] = R1;
21
22         # Lower ourselves to userspace
23         loadsym R1, _user;
24         RETI = R1;
25         RTI;
26
27 _user:
28         imm32 R0, 0x12345678;
29         R1 = R0;
30         imm32 P0, 0xffffffff;
31         P1 = P0;
32 _user_fail:
33         # Sometimes this even causes immediate double faults when
34         # exceptions are not exact since this may trigger multiple
35         R0 = [P0++];
36
37         JUMP fail_lvl;
38
39 _evx:
40         # RETX should be pointing to the right place
41         loadsym R6, _user_fail;
42         R7 = RETX;
43         CC = R6 == R7;
44         IF !CC JUMP fail_lvl;
45
46         # R0 and P0 should be unchanged
47         CC = R1 == R0;
48         IF !CC JUMP fail_lvl;
49         CC = P1 == P0;
50         IF !CC JUMP fail_lvl;
51
52         dbg_pass
53 fail_lvl:
54         dbg_fail