1 //Original:/proj/frio/dv/testcases/seq/se_excpt_ssstep/se_excpt_ssstep.dsp
2 // Description: EXCPT instruction vs Single Step Exception Priority
4 # sim: --environment operating
7 .include "testutils.inc"
11 // Constants and Defines
15 include(selfcheck.inc)
21 #define STACKSIZE 0x10
24 #define EVT 0xFFE02000
27 #define EVT15 0xFFE0203C
30 #define EVT_OVERRIDE 0xFFE02100
33 #define ITABLE 0xF0000000
36 GEN_INT_INIT(ITABLE) // set location for interrupt table
39 // Reset/Bootstrap Code
40 // (Here we should set the processor operating modes, initialize registers,
45 INIT_R_REGS(0); // initialize general purpose regs
47 INIT_P_REGS(0); // initialize the pointers
49 INIT_I_REGS(0); // initialize the dsp address regs
54 LD32_LABEL(sp, KSTACK); // setup the stack pointer
55 FP = SP; // and frame pointer
57 LD32(p0, EVT); // Setup Event Vectors and Handlers
59 LD32_LABEL(r0, EHANDLE); // Emulation Handler (Int0)
62 LD32_LABEL(r0, RHANDLE); // Reset Handler (Int1)
65 LD32_LABEL(r0, NHANDLE); // NMI Handler (Int2)
68 LD32_LABEL(r0, XHANDLE); // Exception Handler (Int3)
71 [ P0 ++ ] = R0; // IVT4 not used
73 LD32_LABEL(r0, HWHANDLE); // HW Error Handler (Int5)
76 LD32_LABEL(r0, THANDLE); // Timer Handler (Int6)
79 LD32_LABEL(r0, I7HANDLE); // IVG7 Handler
82 LD32_LABEL(r0, I8HANDLE); // IVG8 Handler
85 LD32_LABEL(r0, I9HANDLE); // IVG9 Handler
88 LD32_LABEL(r0, I10HANDLE);// IVG10 Handler
91 LD32_LABEL(r0, I11HANDLE);// IVG11 Handler
94 LD32_LABEL(r0, I12HANDLE);// IVG12 Handler
97 LD32_LABEL(r0, I13HANDLE);// IVG13 Handler
100 LD32_LABEL(r0, I14HANDLE);// IVG14 Handler
103 LD32_LABEL(r0, I15HANDLE);// IVG15 Handler
106 LD32(p0, EVT_OVERRIDE);
109 R0 = -1; // Change this to mask interrupts (*)
110 [ P0 ] = R0; // IMASK
116 LT0 = r0; // set loop counters to something deterministic
123 ASTAT = r0; // reset other internal regs
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
133 SYSCFG = r0; // Enable Supervisor Single Step
135 CHECK_INIT_DEF(p2); //CHECK_INIT(p2, 0x2000);
138 // Comment the following line for a USER Mode test
140 // JUMP STARTSUP; // jump to code start for SUPERVISOR mode
145 LD32_LABEL(p1, BEGIN);
148 [ P0 ] = P1; // IVG15 (General) handler (Int 15) load with start
150 RAISE 15; // after we RTI, INT 15 should be taken
152 NOP; // Workaround for Bug 217
160 LD32_LABEL(sp, USTACK); // setup the stack pointer
161 FP = SP; // set frame pointer
164 //*********************************************************************
168 // COMMENT the following line for USER MODE tests
169 // [--sp] = RETI; // enable interrupts in supervisor mode
171 // **** YOUR CODE GOES HERE ****
177 EXCPT 15; // single step shouldn't happen for this.
184 EXCPT 3; // turn off single step via handler
186 CHECKREG(r4, 1); // one EXCPT 15 instruction
187 CHECKREG(r5, 14); // 14 instructions are executed before we disable single step
190 // PUT YOUR TEST HERE!
194 dbg_pass; // End the test
196 //*********************************************************************
199 // Handlers for Events
202 EHANDLE: // Emulation Handler 0
205 RHANDLE: // Reset Handler 1
208 NHANDLE: // NMI Handler 2
211 XHANDLE: // Exception Handler 3
212 [ -- SP ] = ASTAT; // save what we damage
213 [ -- SP ] = ( R7:6 );
216 R7 >>= 26; // only want EXCAUSE
217 R6 = 0x10; // EXCAUSE 0x10 means Single Step
219 IF CC JUMP SINGLESTEP (BP); // Go to Single Step Handler
221 R6 = 15; // EXCAUSE 15 means EXCPT 15 instruction
223 IF CC JUMP EXCPT15 (BP);
225 SYSCFG = r0; // otherwise must be an EXCPT, so turn off singlestep
230 R4 += 1; // R4 counts EXCPT 15s
234 R5 += 1; // R5 counts single step events
237 ( R7:6 ) = [ SP ++ ];
241 HWHANDLE: // HW Error Handler 5
244 THANDLE: // Timer Handler 6
247 I7HANDLE: // IVG 7 Handler
250 I8HANDLE: // IVG 8 Handler
253 I9HANDLE: // IVG 9 Handler
256 I10HANDLE: // IVG 10 Handler
259 I11HANDLE: // IVG 11 Handler
262 I12HANDLE: // IVG 12 Handler
265 I13HANDLE: // IVG 13 Handler
268 I14HANDLE: // IVG 14 Handler
271 I15HANDLE: // IVG 15 Handler
274 NOP;NOP;NOP;NOP;NOP;NOP;NOP; // needed for icache bug
284 // Stack Segments (Both Kernel and User)