1// power64 2// incomplete until there are processes to debug 3 4defn acidinit() // Called after all the init modules are loaded 5{ 6 bplist = {}; 7 bpfmt = 'X'; 8 9 srcpath = { 10 "./", 11 "/sys/src/libc/port/", 12 "/sys/src/libc/9sys/", 13 "/sys/src/libc/power64/" 14 }; 15 16 srcfiles = {}; // list of loaded files 17 srctext = {}; // the text of the files 18} 19 20defn stk() // trace 21{ 22 _stk(*PC, *SP, linkreg(0), 0); 23} 24 25defn lstk() // trace with locals 26{ 27 _stk(*PC, *SP, linkreg(0), 1); 28} 29 30defn gpr() // print general purpose registers 31{ 32 print("R0 ", *R0, "\n"); 33 print("SP ", *SP, "\n"); 34 print("R2 ", *R2, "\n"); 35 print("R3 ", *R3, "\n"); 36 print("R4 ", *R4, "\n"); 37 print("R5 ", *R5, "\n"); 38 print("R6 ", *R6, "\n"); 39 print("R7 ", *R7, "\n"); 40 print("R8 ", *R8, "\n"); 41 print("R9 ", *R9, "\n"); 42 print("R10 ", *R10, "\n"); 43 print("R11 ", *R11, "\n"); 44 print("R12 ", *R12, "\n"); 45 print("R13 ", *R13, "\n"); 46 print("R14 ", *R14, "\n"); 47 print("R15 ", *R15, "\n"); 48 print("R16 ", *R16, "\n"); 49 print("R17 ", *R17, "\n"); 50 print("R18 ", *R18, "\n"); 51 print("R19 ", *R19, "\n"); 52 print("R20 ", *R20, "\n"); 53 print("R21 ", *R21, "\n"); 54 print("R22 ", *R22, "\n"); 55 print("R23 ", *R23, "\n"); 56 print("R24 ", *R24, "\n"); 57 print("R25 ", *R25, "\n"); 58 print("R26 ", *R26, "\n"); 59 print("R27 ", *R27, "\n"); 60 print("R28 ", *R28, "\n"); 61 print("R29 ", *R29, "\n"); 62 print("R30 ", *R30, "\n"); 63 print("R31 ", *R31, "\n"); 64} 65 66defn Fpr() 67{ 68 fpr(); 69} 70 71defn 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 91defn spr() // print special processor registers 92{ 93 local pc, link, cause; 94 95 pc = *PC; 96 print("PC\t", pc, " ", fmt(pc, 'a'), " "); 97 pfl(pc); 98 99 link = *R31; 100 print("SP\t", *SP, "\tLINK\t", link, " ", fmt(link, 'a'), " "); 101 pfl(link); 102 103 cause = *CAUSE; 104 print("SRR1\t", *SRR1, "\tCAUSE\t", cause, " ", reason(cause), "\n"); 105 print("LR\t", *LR, "\tCR\t", *CR, "\n"); 106 107 print("XER\t", *XER, "\tCTR\t", *CTR, "\n"); 108} 109 110defn regs() // print all registers 111{ 112 spr(); 113 gpr(); 114} 115 116defn pstop(pid) 117{ 118 local l, pc; 119 120 pc = *PC; 121 122 print(pid,": ", reason(*CAUSE), "\t"); 123 print(fmt(pc, 'a'), "\t", fmt(pc, 'i'), "\n"); 124 125 if notes then { 126 if notes[0] != "sys: breakpoint" then { 127 print("Notes pending:\n"); 128 l = notes; 129 while l do { 130 print("\t", head l, "\n"); 131 l = tail l; 132 } 133 } 134 } 135} 136 137defn linkreg(addr) 138{ 139 return *LR; 140} 141 142print("/sys/lib/acid/power64"); 143