ld: Move the .note.build-id section to near the start of the memory map.
[binutils-gdb.git] / sim / testsuite / bfin / se_excpt_ifprotviol.S
blob50207fc3bbeb3dcf68e5d048a5a65488c10d66dd
1 //Original:/proj/frio/dv/testcases/seq/se_excpt_ifprotviol/se_excpt_ifprotviol.dsp
2 // Description: EXCPT instruction and IF Prot Viol priority
3 # mach: bfin
4 # sim: --environment operating
6 #include "test.h"
7 .include "testutils.inc"
8 start
10 include(gen_int.inc)
11 include(selfcheck.inc)
12 include(std.inc)
13 include(mmrs.inc)
14 include(symtable.inc)
16 #ifndef STACKSIZE
17 #define STACKSIZE 0x100   // change for how much stack you need
18 #endif
19 #ifndef ITABLE
20 #define ITABLE 0xF0000000
21 #endif
23 GEN_INT_INIT(ITABLE) // set location for interrupt table
26 // Reset/Bootstrap Code
27 //   (Here we should set the processor operating modes, initialize registers,
28 //    etc.)
31 BOOT:
32 INIT_R_REGS(0);     // initialize general purpose regs
34 INIT_P_REGS(0);     // initialize the pointers
36 INIT_I_REGS(0);     // initialize the dsp address regs
37 INIT_M_REGS(0);
38 INIT_L_REGS(0);
39 INIT_B_REGS(0);
41 CLI R1;           // inhibit events during MMR writes
43 LD32_LABEL(sp, USTACK);   // setup the user stack pointer
44 USP = SP;
46 LD32_LABEL(sp, KSTACK);   // setup the kernel stack pointer
47 FP = SP;        // and frame pointer
49 LD32(p0, EVT0);      // Setup Event Vectors and Handlers
51     P0 += 4;            // EVT0 not used (Emulation)
53     P0 += 4;            // EVT1 not used (Reset)
55 LD32_LABEL(r0, NHANDLE);  // NMI Handler (Int2)
56     [ P0 ++ ] = R0;
58 LD32_LABEL(r0, XHANDLE);  // Exception Handler (Int3)
59     [ P0 ++ ] = R0;
61     P0 += 4;            // EVT4 not used (Global Interrupt Enable)
63 LD32_LABEL(r0, HWHANDLE); // HW Error Handler (Int5)
64     [ P0 ++ ] = R0;
66 LD32_LABEL(r0, THANDLE);  // Timer Handler (Int6)
67     [ P0 ++ ] = R0;
69 LD32_LABEL(r0, I7HANDLE); // IVG7 Handler
70     [ P0 ++ ] = R0;
72 LD32_LABEL(r0, I8HANDLE); // IVG8 Handler
73     [ P0 ++ ] = R0;
75 LD32_LABEL(r0, I9HANDLE); // IVG9 Handler
76     [ P0 ++ ] = R0;
78 LD32_LABEL(r0, I10HANDLE);// IVG10 Handler
79     [ P0 ++ ] = R0;
81 LD32_LABEL(r0, I11HANDLE);// IVG11 Handler
82     [ P0 ++ ] = R0;
84 LD32_LABEL(r0, I12HANDLE);// IVG12 Handler
85     [ P0 ++ ] = R0;
87 LD32_LABEL(r0, I13HANDLE);// IVG13 Handler
88     [ P0 ++ ] = R0;
90 LD32_LABEL(r0, I14HANDLE);// IVG14 Handler
91     [ P0 ++ ] = R0;
93 LD32_LABEL(r0, I15HANDLE);// IVG15 Handler
94     [ P0 ++ ] = R0;
96 LD32(p0, EVT_OVERRIDE);
97     R0 = 0;
98     [ P0 ++ ] = R0;
100     R1 = -1;     // Change this to mask interrupts (*)
101 CSYNC;       // wait for MMR writes to finish
102 STI R1;      // sync and reenable events (implicit write to IMASK)
104 DUMMY:
106     R0 = 0 (Z);
108 LT0 = r0;       // set loop counters to something deterministic
109 LB0 = r0;
110 LC0 = r0;
111 LT1 = r0;
112 LB1 = r0;
113 LC1 = r0;
115 ASTAT = r0;     // reset other internal regs
116 SYSCFG = r0;
117 RETS = r0;      // prevent X's breaking LINK instruction
119 RETI = r0;      // prevent Xs later on
120 RETX = r0;
121 RETN = r0;
122 RETE = r0;
125 // The following code sets up the test for running in USER mode
127 LD32_LABEL(r0, STARTUSER);// One gets to user mode by doing a
128                         // ReturnFromInterrupt (RTI)
129 RETI = r0;      // We need to load the return address
131 // Comment the following line for a USER Mode test
133 //    JUMP    STARTSUP;   // jump to code start for SUPERVISOR mode
135 RTI;
137 STARTSUP:
138 LD32_LABEL(p1, BEGIN);
140 LD32(p0, EVT15);
142 CLI R1;   // inhibit events during write to MMR
143     [ P0 ] = P1;  // IVG15 (General) handler (Int 15) load with start
144 CSYNC;      // wait for it
145 STI R1;     // reenable events with proper imask
147 RAISE 15;       // after we RTI, INT 15 should be taken
149 RTI;
152 // The Main Program
155 STARTUSER:
157 LD32_LABEL(sp, USTACK);   // setup the user stack pointer
158 FP = SP;
159 LINK 0;     // change for how much stack frame space you need.
161 JUMP BEGIN;
163 //*********************************************************************
165 BEGIN:
167                 // COMMENT the following line for USER MODE tests
168 //    [--sp] = RETI;  // enable interrupts in supervisor mode
170     R0 = 0;
171     R1 = -1;
174 EXCPT 2;    // the RAISE should not prevent the EXCPT from being taken
175 RAISE 15;
177 CHECK_INIT_DEF(p0); //CHECK_INIT(p0, 0xFF7FFFFC);
179 CHECKREG(r5, 2); // check the flag
181 END:
182 dbg_pass;            // End the test
184 //*********************************************************************
187 // Handlers for Events
190 NHANDLE:            // NMI Handler 2
191 RTN;
193 XHANDLE:            // Exception Handler 3
195     [ -- SP ] = ASTAT; // save what we damage
196     [ -- SP ] = ( R7:6 );
197     R7 = SEQSTAT;
198     R7 <<= 26;
199     R7 >>= 26;      // only want EXCAUSE
200     R6 = 0x02;      // EXCAUSE 0x02 means EXCPT 2 instruction
201 CC = r7 == r6;
202 IF CC JUMP EXCPT2;
204     R6 = 0x2E;      // EXCAUSE 0x2E means Illegal Use Supervisor Resource
205 CC = r7 == r6;
206 IF CC JUMP IFPROTVIOL;
208 JUMP.S OUT;       // if the EXCAUSE is wrong the test will infinite loop
210 EXCPT2:
211     R5 = 1;         // Set a Flag
212 JUMP.S OUT;
214 IFPROTVIOL:
215     R7 = RETX;      // Fix up return address
217     R7 += 2;        // skip offending 16 bit instruction
219 RETX = r7;      // and put back in RETX
221     R5 <<= 1;        // Alter Global Flag
223 OUT:
224     ( R7:6 ) = [ SP ++ ];
225 ASTAT = [sp++];
226 RTX;
228 HWHANDLE:           // HW Error Handler 5
229 RTI;
231 THANDLE:            // Timer Handler 6
232 RTI;
234 I7HANDLE:           // IVG 7 Handler
235 RTI;
237 I8HANDLE:           // IVG 8 Handler
238 RTI;
240 I9HANDLE:           // IVG 9 Handler
241 RTI;
243 I10HANDLE:          // IVG 10 Handler
244 RTI;
246 I11HANDLE:          // IVG 11 Handler
247 RTI;
249 I12HANDLE:          // IVG 12 Handler
250 RTI;
252 I13HANDLE:          // IVG 13 Handler
253 RTI;
255 I14HANDLE:          // IVG 14 Handler
256 RTI;
258 I15HANDLE:          // IVG 15 Handler
259 RTI;
262     // padding for the icache
264 EXCPT 0; EXCPT 0; EXCPT 0; EXCPT 0; EXCPT 0; EXCPT 0; EXCPT 0;
267 // Data Segment
270 .data
271 DATA:
272     .space (0x10);
274 // Stack Segments (Both Kernel and User)
276     .space (STACKSIZE);
277 KSTACK:
279     .space (STACKSIZE);
280 USTACK: