1
0

arm 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. // ARM 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/arm/"
  11. };
  12. srcfiles = {}; // list of loaded files
  13. srctext = {}; // the text of the files
  14. }
  15. defn linkreg(addr)
  16. {
  17. return *R14;
  18. }
  19. defn stk() // trace
  20. {
  21. _stk(*PC, *SP, linkreg(0), 0);
  22. }
  23. defn lstk() // trace with locals
  24. {
  25. _stk(*PC, *SP, linkreg(0), 1);
  26. }
  27. defn gpr() // print general purpose registers
  28. {
  29. print("R0\t", *R0, " R1\t", *R1, " R2\t", *R2, "\n");
  30. print("R3\t", *R3, " R4\t", *R4, " R5\t", *R5, "\n");
  31. print("R6\t", *R6, " R7\t", *R7, " R8\t", *R8, "\n");
  32. print("R9\t", *R9, " R10\t", *R10, " R11\t", *R11, "\n");
  33. print("R12\t", *R12, " R13\t", *R13, " R14\t", *R14, "\n");
  34. print("R15\t", *R15, "\n");
  35. }
  36. defn regs() // print all registers
  37. {
  38. gpr();
  39. }
  40. defn pstop(pid)
  41. {
  42. local l;
  43. local pc;
  44. pc = *PC;
  45. print(pid,": ", reason(*TYPE), "\t");
  46. print(fmt(pc, 'a'), "\t", fmt(pc, 'i'), "\n");
  47. if notes then {
  48. if notes[0] != "sys: breakpoint" then {
  49. print("Notes pending:\n");
  50. l = notes;
  51. while l do {
  52. print("\t", head l, "\n");
  53. l = tail l;
  54. }
  55. }
  56. }
  57. }
  58. sizeofUreg=72;
  59. aggr Ureg
  60. {
  61. 'U' 0 r0;
  62. 'U' 4 r1;
  63. 'U' 8 r2;
  64. 'U' 12 r3;
  65. 'U' 16 r4;
  66. 'U' 20 r5;
  67. 'U' 24 r6;
  68. 'U' 28 r7;
  69. 'U' 32 r8;
  70. 'U' 36 r9;
  71. 'U' 40 r10;
  72. 'U' 44 r11;
  73. 'U' 48 r12;
  74. 'U' 52 r13;
  75. 'U' 56 r14;
  76. 'U' 60 type;
  77. 'U' 64 psr;
  78. 'U' 68 pc;
  79. };
  80. defn
  81. Ureg(addr) {
  82. complex Ureg addr;
  83. print(" r0 ", addr.r0, "\n");
  84. print(" r1 ", addr.r1, "\n");
  85. print(" r2 ", addr.r2, "\n");
  86. print(" r3 ", addr.r3, "\n");
  87. print(" r4 ", addr.r4, "\n");
  88. print(" r5 ", addr.r5, "\n");
  89. print(" r6 ", addr.r6, "\n");
  90. print(" r7 ", addr.r7, "\n");
  91. print(" r8 ", addr.r8, "\n");
  92. print(" r9 ", addr.r9, "\n");
  93. print(" r10 ", addr.r10, "\n");
  94. print(" r11 ", addr.r11, "\n");
  95. print(" r12 ", addr.r12, "\n");
  96. print(" r13 ", addr.r13, "\n");
  97. print(" r14 ", addr.r14, "\n");
  98. print(" type ", addr.type, "\n");
  99. print(" psr ", addr.psr, "\n");
  100. print(" pc ", addr.pc, "\n");
  101. };
  102. print("/sys/lib/acid/arm");