68020 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. // 68020 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/68020/"
  11. };
  12. srcfiles = {}; // list of loaded files
  13. srctext = {}; // the text of the files
  14. }
  15. defn linkreg(addr)
  16. {
  17. return 0;
  18. }
  19. defn stk() // trace
  20. {
  21. _stk(*PC, *A7, 0, 0);
  22. }
  23. defn lstk() // trace with locals
  24. {
  25. _stk(*PC, *A7, 0, 1);
  26. }
  27. defn gpr() // print general purpose registers
  28. {
  29. print("R0\t", *R0, "R1\t", *R1, "R2\t", *R2, "R3\t", *R3, "\n");
  30. print("R4\t", *R4, "R5\t", *R5, "R6\t", *R6, "R7\t", *R7, "\n");
  31. print("A0\t", *A0, "A1\t", *A1, "A2\t", *A2, "A3\t", *A3, "\n");
  32. print("A4\t", *A4, "A5\t", *A5, "A6\t", *A6, "A7\t", *A7, "\n");
  33. }
  34. defn spr() // print special processor registers
  35. {
  36. local pc;
  37. local cause;
  38. pc = *PC;
  39. print("PC\t", pc, " ", fmt(pc, 'a'), " ");
  40. pfl(pc);
  41. print("SP\t", *A7, " MAGIC\t", *MAGIC, "\n");
  42. cause = *VO;
  43. print("SR\t", *SR, "VO ", cause, " ", reason(cause), "\n");
  44. }
  45. defn regs() // print all registers
  46. {
  47. spr();
  48. gpr();
  49. }
  50. defn pstop(pid)
  51. {
  52. local l;
  53. local pc;
  54. pc = *PC;
  55. print(pid,": ", reason(*VO), "\t");
  56. print(fmt(pc, 'a'), "\t", fmt(pc, 'i'), "\n");
  57. if notes then {
  58. if notes[0] != "sys: breakpoint" then {
  59. print("Notes pending:\n");
  60. l = notes;
  61. while l do {
  62. print("\t", head l, "\n");
  63. l = tail l;
  64. }
  65. }
  66. }
  67. }
  68. aggr Ureg
  69. {
  70. 'U' 0 r0;
  71. 'U' 4 r1;
  72. 'U' 8 r2;
  73. 'U' 12 r3;
  74. 'U' 16 r4;
  75. 'U' 20 r5;
  76. 'U' 24 r6;
  77. 'U' 28 r7;
  78. 'U' 32 a0;
  79. 'U' 36 a1;
  80. 'U' 40 a2;
  81. 'U' 44 a3;
  82. 'U' 48 a4;
  83. 'U' 52 a5;
  84. 'U' 56 a6;
  85. 'U' 60 sp;
  86. 'U' 64 usp;
  87. 'U' 68 magic;
  88. 'u' 72 sr;
  89. 'U' 74 pc;
  90. 'u' 78 vo;
  91. 'a' 80 microstate;
  92. };
  93. defn
  94. Ureg(addr) {
  95. complex Ureg addr;
  96. print(" r0 ", addr.r0, "\n");
  97. print(" r1 ", addr.r1, "\n");
  98. print(" r2 ", addr.r2, "\n");
  99. print(" r3 ", addr.r3, "\n");
  100. print(" r4 ", addr.r4, "\n");
  101. print(" r5 ", addr.r5, "\n");
  102. print(" r6 ", addr.r6, "\n");
  103. print(" r7 ", addr.r7, "\n");
  104. print(" a0 ", addr.a0, "\n");
  105. print(" a1 ", addr.a1, "\n");
  106. print(" a2 ", addr.a2, "\n");
  107. print(" a3 ", addr.a3, "\n");
  108. print(" a4 ", addr.a4, "\n");
  109. print(" a5 ", addr.a5, "\n");
  110. print(" a6 ", addr.a6, "\n");
  111. print(" sp ", addr.sp, "\n");
  112. print(" usp ", addr.usp, "\n");
  113. print(" magic ", addr.magic, "\n");
  114. print(" sr ", addr.sr, "\n");
  115. print(" pc ", addr.pc, "\n");
  116. print(" vo ", addr.vo, "\n");
  117. print(" microstate ", addr.microstate, "\n");
  118. };
  119. print("/sys/lib/acid/68020");