1
0

sparc64 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. // Sparc64 support
  2. defn acidinit() // Called after all the init modules are loaded
  3. {
  4. bplist = {};
  5. bpfmt = 'X';
  6. srcpath = {
  7. "./",
  8. "/sys/src/libc/port/",
  9. "/sys/src/libc/9sys/",
  10. "/sys/src/libc/sparc64/"
  11. };
  12. srcfiles = {}; // list of loaded files
  13. srctext = {}; // the text of the files
  14. }
  15. defn linkreg(addr)
  16. {
  17. complex Ureg addr;
  18. return addr.r15\X;
  19. }
  20. defn stk() // trace
  21. {
  22. _stk(*PC, *SP, linkreg(0), 0);
  23. }
  24. defn lstk() // trace with locals
  25. {
  26. _stk(*PC, *SP, linkreg(0), 1);
  27. }
  28. defn gpr() // print general purpose registers
  29. {
  30. print("SP\t", *SP, "R2\t", *R2, "R3\t", *R3, "\n");
  31. print("R4\t", *R4, "R5\t", *R5, "R6\t", *R6, "\n");
  32. print("R7\t", *R7, "R8\t", *R8, "R9\t", *R9, "\n");
  33. print("R10\t", *R10, "R11\t", *R11, "R12\t", *R12, "\n");
  34. print("R13\t", *R13, "R14\t", *R14, "R15\t", *R15, "\n");
  35. print("R16\t", *R16, "R17\t", *R17, "R18\t", *R18, "\n");
  36. print("R19\t", *R19, "R20\t", *R20, "R21\t", *R21, "\n");
  37. print("R22\t", *R22, "R23\t", *R23, "R24\t", *R24, "\n");
  38. print("R25\t", *R25, "R26\t", *R26, "R27\t", *R27, "\n");
  39. print("R28\t", *R28, "R29\t", *R29, "R30\t", *R30, "\n");
  40. print("R31\t", *R31, "\n");
  41. }
  42. defn spr() // print special processor registers
  43. {
  44. local pc;
  45. local link;
  46. local cause;
  47. pc = *PC;
  48. npc = *NPC;
  49. print("PC\t", pc, " ", fmt(pc, 'a'), " ");
  50. pfl(pc);
  51. print("NPC\t", npc, " ", fmt(npc, 'a'), " ");
  52. pfl(npc);
  53. print("PSTATE\t", *PSTATE, "\n");
  54. link = *R15;
  55. print("SP\t", *SP, "\tLINK\t\t", link, " ", fmt(link, 'a'));
  56. pfl(link);
  57. cause = *TT;
  58. print("Y\t", *Y, "\tCAUSE\t", cause, " ", reason(cause), "\n");
  59. }
  60. defn Fpr()
  61. {
  62. print("F0\t", *fmt(F0, 'G'), "\tF2\t", *fmt(F2, 'G'), "\n");
  63. print("F4\t", *fmt(F4, 'G'), "\tF6\t", *fmt(F6, 'G'), "\n");
  64. print("F8\t", *fmt(F8, 'G'), "\tF10\t", *fmt(F10, 'G'), "\n");
  65. print("F12\t", *fmt(F12, 'G'), "\tF14\t", *fmt(F14, 'G'), "\n");
  66. print("F16\t", *fmt(F16, 'G'), "\tF18\t", *fmt(F18, 'G'), "\n");
  67. print("F20\t", *fmt(F20, 'G'), "\tF22\t", *fmt(F22, 'G'), "\n");
  68. print("F24\t", *fmt(F24, 'G'), "\tF26\t", *fmt(F26, 'G'), "\n");
  69. print("F28\t", *fmt(F28, 'G'), "\tF30\t", *fmt(F30, 'G'), "\n");
  70. }
  71. defn fpr()
  72. {
  73. print("F0\t", *fmt(F0, 'g'), "\tF1\t", *fmt(F1, 'g'), "\n");
  74. print("F2\t", *fmt(F2, 'g'), "\tF3\t", *fmt(F3, 'g'), "\n");
  75. print("F4\t", *fmt(F4, 'g'), "\tF5\t", *fmt(F5, 'g'), "\n");
  76. print("F6\t", *fmt(F6, 'g'), "\tF7\t", *fmt(F7, 'g'), "\n");
  77. print("F8\t", *fmt(F8, 'g'), "\tF9\t", *fmt(F9, 'g'), "\n");
  78. print("F10\t", *fmt(F10, 'g'), "\tF11\t", *fmt(F11, 'g'), "\n");
  79. print("F12\t", *fmt(F12, 'g'), "\tF13\t", *fmt(F13, 'g'), "\n");
  80. print("F14\t", *fmt(F14, 'g'), "\tF15\t", *fmt(F15, 'g'), "\n");
  81. print("F16\t", *fmt(F16, 'g'), "\tF17\t", *fmt(F17, 'g'), "\n");
  82. print("F18\t", *fmt(F18, 'g'), "\tF19\t", *fmt(F19, 'g'), "\n");
  83. print("F20\t", *fmt(F20, 'g'), "\tF21\t", *fmt(F21, 'g'), "\n");
  84. print("F22\t", *fmt(F22, 'g'), "\tF23\t", *fmt(F23, 'g'), "\n");
  85. print("F24\t", *fmt(F24, 'g'), "\tF25\t", *fmt(F25, 'g'), "\n");
  86. print("F26\t", *fmt(F26, 'g'), "\tF27\t", *fmt(F27, 'g'), "\n");
  87. print("F28\t", *fmt(F28, 'g'), "\tF29\t", *fmt(F29, 'g'), "\n");
  88. print("F30\t", *fmt(F30, 'g'), "\tF31\t", *fmt(F31, 'g'), "\n");
  89. }
  90. defn regs() // print all registers
  91. {
  92. spr();
  93. gpr();
  94. }
  95. defn pstop(pid)
  96. {
  97. local l;
  98. local pc;
  99. pc = *PC;
  100. print(pid,": ", reason(*TT), "\t");
  101. print(fmt(pc, 'a'), "\t", fmt(pc, 'i'), "\n");
  102. if notes then {
  103. if notes[0] != "sys: breakpoint" then {
  104. print("Notes pending:\n");
  105. l = notes;
  106. while l do {
  107. print("\t", head l, "\n");
  108. l = tail l;
  109. }
  110. }
  111. }
  112. }
  113. aggr Ureg
  114. {
  115. 'U' 0 r0;
  116. {
  117. 'U' 4 sp;
  118. 'U' 4 usp;
  119. 'U' 4 r1;
  120. };
  121. 'U' 8 r2;
  122. 'U' 12 r3;
  123. 'U' 16 r4;
  124. 'U' 20 r5;
  125. 'U' 24 r6;
  126. 'U' 28 r7;
  127. 'U' 32 r8;
  128. 'U' 36 r9;
  129. 'U' 40 r10;
  130. 'U' 44 r11;
  131. 'U' 48 r12;
  132. 'U' 52 r13;
  133. 'U' 56 r14;
  134. 'U' 60 r15;
  135. 'U' 64 r16;
  136. 'U' 68 r17;
  137. 'U' 72 r18;
  138. 'U' 76 r19;
  139. 'U' 80 r20;
  140. 'U' 84 r21;
  141. 'U' 88 r22;
  142. 'U' 92 r23;
  143. 'U' 96 r24;
  144. 'U' 100 r25;
  145. 'U' 104 r26;
  146. 'U' 108 r27;
  147. 'U' 112 r28;
  148. 'U' 116 r29;
  149. 'U' 120 r30;
  150. 'U' 124 r31;
  151. 'U' 128 y;
  152. 'U' 132 tt;
  153. 'U' 136 pstate;
  154. 'U' 140 npc;
  155. 'U' 144 pc;
  156. 'U' 148 pad;
  157. };
  158. defn
  159. Ureg(addr) {
  160. complex Ureg addr;
  161. print(" r0 ", addr.r0, "\n");
  162. print(" sp ", addr.sp, "\n");
  163. print(" r2 ", addr.r2, "\n");
  164. print(" r3 ", addr.r3, "\n");
  165. print(" r4 ", addr.r4, "\n");
  166. print(" r5 ", addr.r5, "\n");
  167. print(" r6 ", addr.r6, "\n");
  168. print(" r7 ", addr.r7, "\n");
  169. print(" r8 ", addr.r8, "\n");
  170. print(" r9 ", addr.r9, "\n");
  171. print(" r10 ", addr.r10, "\n");
  172. print(" r11 ", addr.r11, "\n");
  173. print(" r12 ", addr.r12, "\n");
  174. print(" r13 ", addr.r13, "\n");
  175. print(" r14 ", addr.r14, "\n");
  176. print(" r15 ", addr.r15, "\n");
  177. print(" r16 ", addr.r16, "\n");
  178. print(" r17 ", addr.r17, "\n");
  179. print(" r18 ", addr.r18, "\n");
  180. print(" r19 ", addr.r19, "\n");
  181. print(" r20 ", addr.r20, "\n");
  182. print(" r21 ", addr.r21, "\n");
  183. print(" r22 ", addr.r22, "\n");
  184. print(" r23 ", addr.r23, "\n");
  185. print(" r24 ", addr.r24, "\n");
  186. print(" r25 ", addr.r25, "\n");
  187. print(" r26 ", addr.r26, "\n");
  188. print(" r27 ", addr.r27, "\n");
  189. print(" r28 ", addr.r28, "\n");
  190. print(" r29 ", addr.r29, "\n");
  191. print(" r30 ", addr.r30, "\n");
  192. print(" r31 ", addr.r31, "\n");
  193. print(" y ", addr.y, "\n");
  194. print(" tt ", addr.tt, "\n");
  195. print(" pstate ", addr.pstate, "\n");
  196. print(" npc ", addr.npc, "\n");
  197. print(" pc ", addr.pc, "\n");
  198. print(" pad ", addr.pad, "\n");
  199. };
  200. sizeofUreg = 152;
  201. print("/sys/lib/acid/sparc64");