Go to the source code of this file.
Defines | |
| #define | DMFC0(RT, RD, SEL) ((0x402<<20)|((RT)<<16)|((RD)<<11)|SEL) |
| #define | DMTC0(RT, RD, SEL) ((0x40a<<20)|((RT)<<16)|((RD)<<11)|SEL) |
| #define | MFC0(RT, RD, SEL) ((0x400<<20)|((RT)<<16)|((RD)<<11)|SEL) |
| #define | MTC0(RT, RD, SEL) ((0x408<<20)|((RT)<<16)|((RD)<<11)|SEL) |
Functions | |
| static int | __cp0syscall1 (int type, unsigned long long addr, union commondata *mydata) |
| static int | __cp0syscall2 (int type, unsigned long long addr, union commondata *mydata) |
| static int | cmd_cont (int argc, char **argv) |
| static int | cmd_goback (int argc, char **argv) |
| static int | cmd_restore (int argc, char **argv) |
| static int | cmd_save (int argc, char **argv) |
| static | cmd_set (int argc, char **argv) |
| mycmd_init (goback, cmd_goback,"goback [address]","go back to 0xff200200 default") | |
| mycmd_init (cont, cmd_cont,"cont ","quit jtag and cont") | |
| mycmd_init (cp0s, mycp0s,"cp0s","cp0 regs") | |
| mycmd_init (restore, cmd_restore,"restore","restore regs") | |
| mycmd_init (save, cmd_save,"save","save regs") | |
| mycmd_init (set, cmd_set,"set [reg] [val]","set regs") | |
| static int | mycp0s (int argc, char **argv) |
Variables | |
| static int | cp0s_sel = 0 |
| int | ejtag_in_debug_mode |
| char * | regname [] |
| unsigned int | ui_datamem [] |
| #define DMFC0 | ( | RT, | |||
| RD, | |||||
| SEL | ) | ((0x402<<20)|((RT)<<16)|((RD)<<11)|SEL) |
| #define DMTC0 | ( | RT, | |||
| RD, | |||||
| SEL | ) | ((0x40a<<20)|((RT)<<16)|((RD)<<11)|SEL) |
| #define MFC0 | ( | RT, | |||
| RD, | |||||
| SEL | ) | ((0x400<<20)|((RT)<<16)|((RD)<<11)|SEL) |
| #define MTC0 | ( | RT, | |||
| RD, | |||||
| SEL | ) | ((0x408<<20)|((RT)<<16)|((RD)<<11)|SEL) |
| static int __cp0syscall1 | ( | int | type, | |
| unsigned long long | addr, | |||
| union commondata * | mydata | |||
| ) | [static] |
Definition at line 19 of file reg.c.
References cp0s_sel, commondata.data8, fMIPS32_ExecuteDebugModule(), MFC0, tgt_compile, and ui_datamem.
Referenced by mycp0s().
00020 { 00021 long data8; 00022 unsigned int codebuf[12]= tgt_compile(\ 00023 ".set noat;\n" \ 00024 "1:\n" \ 00025 "mtc0 $15, $31;\n" \ 00026 "lui $15,0xFF20;\n" \ 00027 "sw $2, 0x1fc($15);\n" \ 00028 "mfc0 $2,$31;\n" \ 00029 "sw $2, ($15);\n" \ 00030 "lw $2, 0x1fc($15);\n" \ 00031 "mfc0 $15, $31;\n" \ 00032 "b 1b;\n" \ 00033 "nop;\n"); 00034 00035 if(type!=8)return -1; 00036 memset(mydata->data8,0,8); 00037 addr=addr&0x1f; 00038 //codebuf[3]=DMFC0(2,addr,cp0s_sel); 00039 codebuf[3]=MFC0(2,addr,cp0s_sel); 00040 00041 fMIPS32_ExecuteDebugModule(codebuf,40,1); 00042 00043 *(long *)mydata->data8=ui_datamem[0]; 00044 00045 return 0; 00046 }
| static int __cp0syscall2 | ( | int | type, | |
| unsigned long long | addr, | |||
| union commondata * | mydata | |||
| ) | [static] |
Definition at line 48 of file reg.c.
References cp0s_sel, commondata.data8, fMIPS32_ExecuteDebugModule(), MTC0, tgt_compile, and ui_datamem.
Referenced by mycp0s().
00049 { 00050 unsigned int codebuf[12]= tgt_compile(\ 00051 ".set noat;\n" \ 00052 "1:\n" \ 00053 "mtc0 $15, $31;\n" \ 00054 "lui $15,0xFF20;\n" \ 00055 "sw $2, 0x1fc($15);\n" \ 00056 "lw $2, ($15);\n" \ 00057 "mtc0 $2,$31;\n" \ 00058 "lw $2, 0x1fc($15);\n" \ 00059 "mfc0 $15, $31;\n" \ 00060 "b 1b;\n" \ 00061 "nop;\n"); 00062 if(type!=8)return -1; 00063 addr=addr&0x1f; 00064 //codebuf[4]=DMTC0(2,addr,cp0s_sel); 00065 codebuf[4]=MTC0(2,addr,cp0s_sel); 00066 00067 ui_datamem[0]=*(long *)mydata->data8; 00068 fMIPS32_ExecuteDebugModule(codebuf,40,1); 00069 00070 00071 return 0; 00072 }
| static int cmd_cont | ( | int | argc, | |
| char ** | argv | |||
| ) | [static] |
Definition at line 248 of file reg.c.
References ejtag_in_debug_mode, and jtag_quit().
00249 { 00250 jtag_quit(); 00251 ejtag_in_debug_mode = 0; 00252 return 0; 00253 }
| static int cmd_goback | ( | int | argc, | |
| char ** | argv | |||
| ) | [static] |
Definition at line 255 of file reg.c.
References feed_acc(), fMIPS32_Init(), force_acc(), get_acc(), and tgt_compile.
00256 { 00257 int op,address,data,state=3,address0=0; 00258 unsigned int destaddr=0xff200200; 00259 int buf[8]=tgt_compile(\ 00260 "mtc0 $15, $31;\n" \ 00261 "lui $15,0;\n" \ 00262 "or $15,0;\n" \ 00263 "jr $15;\n" \ 00264 "nop;\n"); 00265 00266 int buf1[4]=tgt_compile("mfc0 $15,$31;\n"); 00267 00268 if (argc > 1) 00269 destaddr = strtoul(argv[1],0,0); 00270 00271 if(destaddr>0xff200000) destaddr -= 4; 00272 00273 buf[2] |= destaddr&0xffff; 00274 buf[1] |= (destaddr>>16)&0xffff; 00275 00276 fMIPS32_Init(); 00277 00278 while(1) 00279 { 00280 int ret; 00281 ret=get_acc(&op,&address,&data); 00282 if(!(ret&1)){force_acc();fprintf(stderr,"conneting\n");state=0;continue;} 00283 if(state<1){fprintf(stderr,"conneted\n");state=1;} 00284 00285 if(!(ret&2)){fprintf(stderr,"waiting\n");state=1;continue;} 00286 if (state<2) {fprintf(stderr,"acc\n"); state=2;} 00287 if(!address0)address0=address; 00288 00289 if(address >=address0 && address < address0+20)feed_acc(buf[(address-address0)/4]); 00290 else if(address != destaddr) feed_acc(0); 00291 else { feed_acc(buf1[0]);break;} 00292 } 00293 00294 00295 return 0; 00296 }
| static int cmd_restore | ( | int | argc, | |
| char ** | argv | |||
| ) | [static] |
Definition at line 7 of file reg.c.
References context_reg, and context_restore().
00008 { 00009 context_restore(context_reg); 00010 return 0; 00011 }
| static int cmd_save | ( | int | argc, | |
| char ** | argv | |||
| ) | [static] |
Definition at line 1 of file reg.c.
References context_reg, and context_save().
00002 { 00003 context_save(context_reg); 00004 return 0; 00005 }
| static cmd_set | ( | int | argc, | |
| char ** | argv | |||
| ) | [static] |
Definition at line 92 of file reg.c.
References aui_readregisters_code, dMIPS32_NUM_DEBUG_REGISTERS, fMIPS32_ExecuteDebugModule(), help_addr, regname, tgt_compile, tgt_exec, ui_datamem, ui_fifomem, uififo_raddr, and uififo_waddr.
00093 { 00094 if(argc==1) 00095 { 00096 int i=0; 00097 uififo_raddr=0; 00098 uififo_waddr=0; 00099 memset(ui_fifomem,0,38*4); 00100 fMIPS32_ExecuteDebugModule(aui_readregisters_code,0x80000,1); 00101 00102 for(i=0;i<dMIPS32_NUM_DEBUG_REGISTERS;i++) 00103 { 00104 if((i&3)==0)printf("\n"); 00105 printf("%s:0x%x ",regname[i],ui_fifomem[i]); 00106 } 00107 printf("\n"); 00108 printf("helpaddr=0x%x\n",help_addr); 00109 return 0; 00110 } 00111 else if(argv[1][0]==':') 00112 { 00113 int regnum; 00114 if(argv[1][1]>='0' && argv[1][1]<='9') 00115 regnum=strtoul(&argv[1][1],0,0); 00116 else { 00117 int i; 00118 regnum=0; 00119 for(i=0;i<sizeof(regname)/sizeof(regname[0]);i++) 00120 if(!strcmp(regname[i],&argv[1][1])){ 00121 regnum=i; 00122 break; 00123 } 00124 } 00125 00126 if(argc==2) 00127 { 00128 // Go read all the registers from the processor 00129 00130 if(regnum<31) 00131 { 00132 int reg32code[]=tgt_compile(\ 00133 "sw $0,($31);\n" \ 00134 "sw $1,($31);\n" \ 00135 ); 00136 reg32code[1]=reg32code[0]+regnum*0x10000; 00137 tgt_exec(\ 00138 "mtc0 $31, $31;\n" \ 00139 "lui $31,0xFF20;\n" \ 00140 ,8); 00141 fMIPS32_ExecuteDebugModule(®32code[1],4,1); 00142 tgt_exec("mfc0 $31, $31;\n",4); 00143 } 00144 else if(regnum==31) 00145 tgt_exec(\ 00146 "mtc0 $2, $31;\n" \ 00147 "lui $2,0xFF20;\n" \ 00148 "sw $31, ($2);\n" \ 00149 "mfc0 $2, $31;\n" \ 00150 ,16); 00151 else if(regnum<38) //sr 00152 { 00153 int cpxbuf[]=tgt_compile(\ 00154 "mfc0 $2, $12;\n" \ 00155 "mflo $2;\n" \ 00156 "mfhi $2;\n" \ 00157 "mfc0 $2, $8;\n" \ 00158 "mfc0 $2, $13;\n" \ 00159 "mfc0 $2, $24;\n" \ 00160 ); 00161 00162 tgt_exec(\ 00163 "mtc0 $15, $31;\n" \ 00164 "lui $15,0xFF20;\n" \ 00165 "sw $2, 4($15);\n" \ 00166 ,12); 00167 fMIPS32_ExecuteDebugModule(&cpxbuf[regnum-32],4,1); 00168 tgt_exec(\ 00169 "sw $2, ($15);\n" \ 00170 "lw $2, 4($15);\n" \ 00171 "mfc0 $15, $31;\n" \ 00172 ,12); 00173 } 00174 else 00175 ui_datamem[0]=0; 00176 00177 printf("%s=0x%x\n",argv[1],ui_datamem[0]); 00178 00179 } 00180 else 00181 { 00182 ui_datamem[0]=strtoul(argv[2],0,0); 00183 00184 00185 if(regnum<31) 00186 { 00187 int reg32code[]=tgt_compile(\ 00188 "lw $0,($31);\n" \ 00189 "lw $1,($31);\n" \ 00190 ); 00191 reg32code[1]=reg32code[0]+regnum*0x10000; 00192 tgt_exec(\ 00193 "mtc0 $31, $31;\n" \ 00194 "lui $31,0xFF20;\n" \ 00195 ,8); 00196 fMIPS32_ExecuteDebugModule(®32code[1],4,1); 00197 tgt_exec("mfc0 $31, $31;\n",4); 00198 } 00199 else if(regnum==31) 00200 tgt_exec(\ 00201 "mtc0 $2, $31;\n" \ 00202 "lui $2,0xFF20;\n" \ 00203 "lw $31, ($2);\n" \ 00204 "mfc0 $2, $31;\n" \ 00205 ,16); 00206 else if(regnum<38) //sr 00207 { 00208 int cpxbuf[]=tgt_compile(\ 00209 "mtc0 $2, $12;\n" \ 00210 "mtlo $2;\n" \ 00211 "mthi $2;\n" \ 00212 "mtc0 $2, $8;\n" \ 00213 "mtc0 $2, $13;\n" \ 00214 "mtc0 $2, $24;\n" \ 00215 ); 00216 00217 tgt_exec(\ 00218 "mtc0 $15, $31;\n" \ 00219 "lui $15,0xFF20;\n" \ 00220 "sw $2, 4($15);\n" \ 00221 "lw $2, ($15);\n" \ 00222 ,16); 00223 fMIPS32_ExecuteDebugModule(&cpxbuf[regnum-32],4,1); 00224 tgt_exec(\ 00225 "lw $2, 4($15);\n" \ 00226 "mfc0 $15, $31;\n" \ 00227 ,8); 00228 } 00229 00230 else 00231 { 00232 printf("Invalid register number %d.\n", regnum); 00233 return -1; 00234 } 00235 } 00236 return 0; 00237 } 00238 else if(!strcmp(argv[1],"helpaddr")) 00239 { 00240 if(argc==2)printf("helpaddr=0x%x\n",help_addr); 00241 else help_addr=strtoul(argv[2],0,0); 00242 00243 } 00244 return 0; 00245 }
| mycmd_init | ( | goback | , | |
| cmd_goback | , | |||
| "goback " | [address], | |||
| "go back to 0xff200200 default" | ||||
| ) |
| mycmd_init | ( | cont | , | |
| cmd_cont | , | |||
| "cont " | , | |||
| "quit jtag and cont" | ||||
| ) |
| mycmd_init | ( | cp0s | , | |
| mycp0s | , | |||
| "cp0s" | , | |||
| "cp0 regs" | ||||
| ) |
| mycmd_init | ( | restore | , | |
| cmd_restore | , | |||
| "restore" | , | |||
| "restore regs" | ||||
| ) |
| mycmd_init | ( | save | , | |
| cmd_save | , | |||
| "save" | , | |||
| "save regs" | ||||
| ) |
| mycmd_init | ( | set | , | |
| cmd_set | , | |||
| "set " | [reg][val], | |||
| "set regs" | ||||
| ) |
| static int mycp0s | ( | int | argc, | |
| char ** | argv | |||
| ) | [static] |
Definition at line 74 of file reg.c.
References __cp0syscall1(), __cp0syscall2(), cp0s_sel, syscall1, syscall2, and syscall_addrwidth.
00075 { 00076 syscall1=__cp0syscall1; 00077 syscall2=__cp0syscall2; 00078 syscall_addrwidth=8; 00079 if(argc>1)cp0s_sel=strtoul(argv[1],0,0); 00080 else cp0s_sel=0; 00081 return 0; 00082 }
int cp0s_sel = 0 [static] |
Definition at line 17 of file reg.c.
Referenced by __cp0syscall1(), __cp0syscall2(), cmd_spiroms(), and mycp0s().
| char* regname[] |
| unsigned int ui_datamem[] |
1.5.6