c_interr_excpt.S 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. //Original:/proj/frio/dv/testcases/core/c_interr_excpt/c_interr_excpt.dsp
  2. // Spec Reference: interr excpt
  3. # mach: bfin
  4. # sim: --environment operating
  5. #include "test.h"
  6. .include "testutils.inc"
  7. start
  8. include(std.inc)
  9. include(selfcheck.inc)
  10. include(gen_int.inc)
  11. INIT_R_REGS(0);
  12. INIT_P_REGS(0);
  13. INIT_I_REGS(0); // initialize the dsp address regs
  14. INIT_M_REGS(0);
  15. INIT_L_REGS(0);
  16. INIT_B_REGS(0);
  17. //CHECK_INIT(p5, 0xe0000000);
  18. include(symtable.inc)
  19. CHECK_INIT_DEF(p5);
  20. #ifndef STACKSIZE
  21. #define STACKSIZE 0x10
  22. #endif
  23. #ifndef EVT
  24. #define EVT 0xFFE02000
  25. #endif
  26. #ifndef EVT15
  27. #define EVT15 0xFFE0203C
  28. #endif
  29. #ifndef EVT_OVERRIDE
  30. #define EVT_OVERRIDE 0xFFE02100
  31. #endif
  32. #ifndef ITABLE
  33. #define ITABLE 0xF0000000
  34. #endif
  35. GEN_INT_INIT(ITABLE) // set location for interrupt table
  36. //
  37. // Reset/Bootstrap Code
  38. // (Here we should set the processor operating modes, initialize registers,
  39. // etc.)
  40. //
  41. BOOT:
  42. LD32_LABEL(sp, KSTACK); // setup the stack pointer
  43. FP = SP; // and frame pointer
  44. LD32(p0, EVT); // Setup Event Vectors and Handlers
  45. LD32_LABEL(r0, EHANDLE); // Emulation Handler (Int0)
  46. [ P0 ++ ] = R0;
  47. LD32_LABEL(r0, RHANDLE); // Reset Handler (Int1)
  48. [ P0 ++ ] = R0;
  49. LD32_LABEL(r0, NHANDLE); // NMI Handler (Int2)
  50. [ P0 ++ ] = R0;
  51. LD32_LABEL(r0, XHANDLE); // Exception Handler (Int3)
  52. [ P0 ++ ] = R0;
  53. [ P0 ++ ] = R0; // IVT4 not used
  54. LD32_LABEL(r0, HWHANDLE); // HW Error Handler (Int5)
  55. [ P0 ++ ] = R0;
  56. LD32_LABEL(r0, THANDLE); // Timer Handler (Int6)
  57. [ P0 ++ ] = R0;
  58. LD32_LABEL(r0, I7HANDLE); // IVG7 Handler
  59. [ P0 ++ ] = R0;
  60. LD32_LABEL(r0, I8HANDLE); // IVG8 Handler
  61. [ P0 ++ ] = R0;
  62. LD32_LABEL(r0, I9HANDLE); // IVG9 Handler
  63. [ P0 ++ ] = R0;
  64. LD32_LABEL(r0, I10HANDLE);// IVG10 Handler
  65. [ P0 ++ ] = R0;
  66. LD32_LABEL(r0, I11HANDLE);// IVG11 Handler
  67. [ P0 ++ ] = R0;
  68. LD32_LABEL(r0, I12HANDLE);// IVG12 Handler
  69. [ P0 ++ ] = R0;
  70. LD32_LABEL(r0, I13HANDLE);// IVG13 Handler
  71. [ P0 ++ ] = R0;
  72. LD32_LABEL(r0, I14HANDLE);// IVG14 Handler
  73. [ P0 ++ ] = R0;
  74. LD32_LABEL(r0, I15HANDLE);// IVG15 Handler
  75. [ P0 ++ ] = R0;
  76. LD32(p0, EVT_OVERRIDE);
  77. R0 = 0;
  78. [ P0 ++ ] = R0;
  79. R0 = -1; // Change this to mask interrupts (*)
  80. [ P0 ] = R0; // IMASK
  81. DUMMY:
  82. R0 = 0 (Z);
  83. LT0 = r0; // set loop counters to something deterministic
  84. LB0 = r0;
  85. LC0 = r0;
  86. LT1 = r0;
  87. LB1 = r0;
  88. LC1 = r0;
  89. ASTAT = r0; // reset other internal regs
  90. SYSCFG = r0;
  91. RETS = r0; // prevent X's breaking LINK instruction
  92. // The following code sets up the test for running in USER mode
  93. LD32_LABEL(r0, STARTUSER);// One gets to user mode by doing a
  94. // ReturnFromInterrupt (RTI)
  95. RETI = r0; // We need to load the return address
  96. // Comment the following line for a USER Mode test
  97. JUMP STARTSUP; // jump to code start for SUPERVISOR mode
  98. RTI;
  99. STARTSUP:
  100. LD32_LABEL(p1, BEGIN);
  101. LD32(p0, EVT15);
  102. [ P0 ] = P1; // IVG15 (General) handler (Int 15) load with start
  103. CSYNC;
  104. RAISE 15; // after we RTI, INT 15 should be taken
  105. RTI;
  106. //
  107. // The Main Program
  108. //
  109. STARTUSER:
  110. LD32_LABEL(sp, USTACK); // setup the stack pointer
  111. FP = SP; // set frame pointer
  112. JUMP BEGIN;
  113. //*********************************************************************
  114. BEGIN:
  115. // COMMENT the following line for USER MODE tests
  116. [ -- SP ] = RETI; // enable interrupts in supervisor mode
  117. // **** YOUR CODE GOES HERE ****
  118. // PUT YOUR TEST HERE!
  119. // Can't Raise 0, 3, or 4
  120. // Raise 1 requires some intelligence so the test
  121. // doesn't loop forever - use SFTRESET bit in SEQSTAT (TBD)
  122. R0 = 1;
  123. R1 = 2;
  124. R2 = 3;
  125. R3 = 4;
  126. EXCPT 1; // RTX
  127. EXCPT 2; // RTX
  128. EXCPT 3; // RTX
  129. EXCPT 4; // RTX
  130. EXCPT 5; // RTX
  131. EXCPT 5; // RTX
  132. EXCPT 6; // RTX
  133. EXCPT 7; // RTX
  134. EXCPT 8; // RTX
  135. EXCPT 9; // RTX
  136. EXCPT 10; // RTX
  137. EXCPT 11; // RTX
  138. EXCPT 12; // RTX
  139. EXCPT 13; // RTX
  140. EXCPT 14; // RTX
  141. EXCPT 15; // RTX
  142. CHECKREG(r0, 0x33333333);
  143. CHECKREG(r1, 0xCCCCCCCD);
  144. CHECKREG(r2, 0x00000000);
  145. CHECKREG(r3, 0x33333333);
  146. CHECKREG(r4, 0x00000000);
  147. CHECKREG(r5, 0x00000000);
  148. CHECKREG(r6, 0x00000000);
  149. CHECKREG(r7, 0x00000000);
  150. END:
  151. dbg_pass; // End the test
  152. //*********************************************************************
  153. //
  154. // Handlers for Events
  155. //
  156. EHANDLE: // Emulation Handler 0
  157. RTE;
  158. RHANDLE: // Reset Handler 1
  159. RTI;
  160. NHANDLE: // NMI Handler 2
  161. R0 = 2;
  162. RTN;
  163. XHANDLE: // Exception Handler 3
  164. R0 = R1 + R2;
  165. R1 = R2 + R3;
  166. R2 = R0 + R1;
  167. R3 = R0 + R2;
  168. RTX;
  169. HWHANDLE: // HW Error Handler 5
  170. R2 = 5;
  171. RTI;
  172. THANDLE: // Timer Handler 6
  173. R3 = 6;
  174. RTI;
  175. I7HANDLE: // IVG 7 Handler
  176. R4 = 7;
  177. RTI;
  178. I8HANDLE: // IVG 8 Handler
  179. R5 = 8;
  180. RTI;
  181. I9HANDLE: // IVG 9 Handler
  182. R6 = 9;
  183. RTI;
  184. I10HANDLE: // IVG 10 Handler
  185. R7 = 10;
  186. RTI;
  187. I11HANDLE: // IVG 11 Handler
  188. R0 = 11;
  189. RTI;
  190. I12HANDLE: // IVG 12 Handler
  191. R1 = 12;
  192. RTI;
  193. I13HANDLE: // IVG 13 Handler
  194. R2 = 13;
  195. RTI;
  196. I14HANDLE: // IVG 14 Handler
  197. R3 = 14;
  198. RTI;
  199. I15HANDLE: // IVG 15 Handler
  200. R4 = 15;
  201. RTI;
  202. NOP;NOP;NOP;NOP;NOP;NOP;NOP; // needed for icache bug
  203. //
  204. // Data Segment
  205. //
  206. //.data 0xF0000000
  207. .data
  208. DATA:
  209. .space (0x10);
  210. // Stack Segments (Both Kernel and User)
  211. .space (STACKSIZE);
  212. KSTACK:
  213. .space (STACKSIZE);
  214. USTACK: