⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dis.c

📁 MIPS YAMON, a famous monitor inc. source, make file and PDF manuals.
💻 C
📖 第 1 页 / 共 4 页
字号:
      case 5 :        if( extend )            sprintf(dest, "%s,%d(%s)", 			  regs16[IMM(inst,7,5)],			  SIGN( 			       ( (IMM(inst,20,16) << 11) |			         (IMM(inst,26,21) << 5 ) |			         (IMM(inst, 4, 0) << 0 ) ),				 16 ),			  regs16[IMM(inst,10,8)] );	else            sprintf(dest, "%s,%d(%s)", 			  regs16[IMM(inst,7,5)],			  IMM(inst,4,0) << 3, 			  regs16[IMM(inst,10,8)] );	break;      case 6 :        if( extend )	    sprintf(dest, "%s,%d",			  regs16[IMM(inst,10,8)], 			  SIGN( 			       (IMM(inst,20,16) << 11) |			       (IMM(inst,26,21) << 5 ) |			       (IMM(inst, 4, 0) << 0 ),			       16 ) );	else	    sprintf(dest, "%s,%d",			  regs16[IMM(inst,10,8)], 			  SIGN( 			      IMM(inst,7,0),			      8 ) );	break;      case 7 :        if( extend )            sprintf(dest, "%s,%d", 			  regs16[IMM(inst,10,8)], 			  SIGN( 			       (IMM(inst,20,16) << 11) |			       (IMM(inst,26,21) << 5 ) |			       (IMM(inst, 4, 0) << 0 ),			       16 ) );	else            sprintf(dest, "%s,%d", 			  regs16[IMM(inst,10,8)], 			  IMM(inst,7,0) );        break;      case 8 :        if( extend )            sprintf(dest, "%s,%d", 			  regs16[IMM(inst,10,8)], 			  (IMM(inst,20,16) << 11) |			  (IMM(inst,26,21) << 5 ) |		          (IMM(inst, 4, 0) << 0 ) );		else            sprintf(dest, "%s,%d", 			  regs16[IMM(inst,10,8)], 			  IMM(inst,7,0) );        break;      case 9 :        if( extend )            sprintf(dest, "%s,%d(%s)", 			  regs16[IMM(inst,7,5)],			  SIGN( 			       ( (IMM(inst,20,16) << 11) |			         (IMM(inst,26,21) << 5 ) |			         (IMM(inst, 4, 0) << 0 ) ),				 16 ),			  regs16[IMM(inst,10,8)] );	else            sprintf(dest, "%s,%d(%s)", 			  regs16[IMM(inst,7,5)],			  IMM(inst,4,0),			  regs16[IMM(inst,10,8)] );	break;      case 10 :        if( extend )            sprintf(dest, "%s,%d(%s)", 			  regs16[IMM(inst,7,5)],			  SIGN( 			       ( (IMM(inst,20,16) << 11) |			         (IMM(inst,26,21) << 5 ) |			         (IMM(inst, 4, 0) << 0 ) ),				 16 ),			  regs16[IMM(inst,10,8)] );	else            sprintf(dest, "%s,%d(%s)", 			  regs16[IMM(inst,7,5)],			  IMM(inst,4,0) << 1, 			  regs16[IMM(inst,10,8)] );	break;      case 11 :        if( extend )            sprintf(dest, "%s,%d(sp)", 			  regs16[IMM(inst,10,8)],			  SIGN( 			       ( (IMM(inst,20,16) << 11) |			         (IMM(inst,26,21) << 5 ) |			         (IMM(inst, 4, 0) << 0 ) ),				 16 ) );	else            sprintf(dest, "%s,%d(sp)", 			  regs16[IMM(inst,10,8)],			  IMM(inst,7,0) << 2 );	break;      case 12 :        if( extend )            sprintf(dest, "%s,%d(%s)", 			  regs16[IMM(inst,7,5)],			  SIGN( 			       ( (IMM(inst,20,16) << 11) |			         (IMM(inst,26,21) << 5 ) |			         (IMM(inst, 4, 0) << 0 ) ),				 16 ),			  regs16[IMM(inst,10,8)] );	else            sprintf(dest, "%s,%d(%s)", 			  regs16[IMM(inst,7,5)],			  IMM(inst,4,0) << 2, 			  regs16[IMM(inst,10,8)] );	break;      case 13 :        if( extend )            sprintf(dest, "%s,%d(pc)", 			  regs16[IMM(inst,10,8)],			  SIGN( 			       ( (IMM(inst,20,16) << 11) |			         (IMM(inst,26,21) << 5 ) |			         (IMM(inst, 4, 0) << 0 ) ),				 16 ) );	else            sprintf(dest, "%s,%d(pc)", 			  regs16[IMM(inst,10,8)],			  IMM(inst,7,0) << 2 );	break;      case 14 :	sprintf(dest, "0x%08x",		      (*addr & 0xf0000000) +		      (( (IMM(inst,20,16) << 21) |		         (IMM(inst,25,21) << 16 ) |		         (IMM(inst,15, 0) << 0 ) ) << 2) );        break;      case 15 :        if( extend )            sprintf(dest, "%s,%s,%d", 			  regs16[IMM(inst,10,8)],			  regs16[IMM(inst,7,5)],		          IMM(inst,26,22) );	else            sprintf(dest, "%s,%s,%d",			  regs16[IMM(inst,10,8)],			  regs16[IMM(inst,7,5)],		          ZERO2EIGHT(IMM(inst,4,2)) );	break;      case 16 :        if( extend )            sprintf(dest, "%s,%s,%d", 			  regs16[IMM(inst,7,5)], 			  regs16[IMM(inst,10,8)], 			  SIGN(			       (IMM(inst,19,16) << 11) |			       (IMM(inst,26,20) << 4 ) |			       (IMM(inst, 3, 0) << 0 ),			       15 ) );	else            sprintf(dest, "%s,%s,%d", 			  regs16[IMM(inst,7,5)], 			  regs16[IMM(inst,10,8)],			  SIGN(			      IMM(inst,3,0),			      4 ) );	break;      case 17 :        if( extend )	    sprintf(dest, "0x%08x",			  (INT32)(*addr) +			  SIGN( 			       ( (IMM(inst,20,16) << 11) |			         (IMM(inst,26,21) << 5 ) |			         (IMM(inst, 4, 0) << 0 ) ) << 1,				 17 ) );	else	    sprintf(dest, "0x%08x",			  (INT32)(*addr) +			  SIGN( 			      IMM(inst,7,0) << 1, 			      9 ) );	break;      case 18 :        if( extend )            sprintf(dest, "ra,%d(sp)", 			  SIGN( 			       ( (IMM(inst,20,16) << 11) |			         (IMM(inst,26,21) << 5 ) |			         (IMM(inst, 4, 0) << 0 ) ),				 16 ) );	else            sprintf(dest, "ra,%d(sp)", 			  IMM(inst,7,0) << 2 );	break;      case 19 :        if( extend )	    sprintf(dest, "sp,%d",			  SIGN( 			       (IMM(inst,20,16) << 11) |			       (IMM(inst,26,21) << 5 ) |			       (IMM(inst, 4, 0) << 0 ),			       16 ) );	else	    sprintf(dest, "sp,%d",			  SIGN( 			      (IMM(inst,7,0) << 3),			      11 ) );	break;      case 20 :        sprintf(dest, "%s,%s", 		      regs[ (IMM(inst,4,3) << 3) |			    (IMM(inst,7,5) << 0 ) ],		      regs16[IMM(inst,2,0)] );	break;      case 21 :        sprintf(dest, "%s,%s", 		      regs16[IMM(inst,7,5)],		      regs[  IMM(inst,4,0)] );	break;      case 22 :        sprintf(dest, "%s,%s,%s", 		      regs16[IMM(inst,4,2)],		      regs16[IMM(inst,10,8)],		      regs16[IMM(inst,7,5)] );	break;      case 23 :        sprintf(dest, "0x%02x",		      IMM(inst,10,5) );	break;      case 24 :        sprintf(dest, "%s,%s", 		      regs16[IMM(inst,10,8)],		      regs16[IMM(inst,7,5)] );	break;      case 25 :        sprintf(dest, "%s,%s", 		      regs16[IMM(inst,7,5)],		      regs16[IMM(inst,10,8)] );	break;      case 26 :        if( extend )            sprintf(dest, "%s,%d", 			  regs16[IMM(inst,7,5)],		          (IMM(inst,21,21) << 5) |		          (IMM(inst,26,22) << 0) );	else            sprintf(dest, "%s,%d", 			  regs16[IMM(inst,7,5)],		          ZERO2EIGHT(IMM(inst,10,8)) );	break;      case 27 :        sprintf(dest, "%s", 		      regs16[IMM(inst,10,8)] );	break;      case 28 :        if( extend )            sprintf(dest, "%s,%d(sp)", 			  regs16[IMM(inst,7,5)],			  SIGN( 			       ( (IMM(inst,20,16) << 11) |			         (IMM(inst,26,21) << 5 ) |			         (IMM(inst, 4, 0) << 0 ) ),				 16 ) );	else            sprintf(dest, "%s,%d(sp)", 			  regs16[IMM(inst,7,5)],			  IMM(inst,4,0) << 3 );	break;      case 29 :        if( extend )            sprintf(dest, "ra,%d(sp)", 			  SIGN( 			       ( (IMM(inst,20,16) << 11) |			         (IMM(inst,26,21) << 5 ) |			         (IMM(inst, 4, 0) << 0 ) ),				 16 ) );	else            sprintf(dest, "ra,%d(sp)", 			  IMM(inst,7,0) << 3 );	break;      case 30 :        if( extend )            sprintf(dest, "%s,%d(pc)", 			  regs16[IMM(inst,7,5)],			  SIGN( 			       ( (IMM(inst,20,16) << 11) |			         (IMM(inst,26,21) << 5 ) |			         (IMM(inst, 4, 0) << 0 ) ),				 16 ) );	else            sprintf(dest, "%s,%d(pc)", 			  regs16[IMM(inst,7,5)],			  IMM(inst,4,0) << 3 );	break;      case 31 :        if( extend )            sprintf(dest, "%s,%d", 			  regs16[IMM(inst,7,5)],			  SIGN( 			       ( (IMM(inst,20,16) << 11) |			         (IMM(inst,26,21) << 5 ) |			         (IMM(inst, 4, 0) << 0 ) ),				 16 ) );	else            sprintf(dest, "%s,%d", 			  regs16[IMM(inst,7,5)],			  SIGN(			      IMM(inst,4,0),			      5 ) );	break;      case 32 :        if( extend )            sprintf(dest, "%s,pc,%d", 			  regs16[IMM(inst,7,5)], 			  SIGN(			       (IMM(inst,20,16) << 11) |			       (IMM(inst,26,21) << 5 ) |			       (IMM(inst, 4, 0) << 0 ),			       16 ) );	else            sprintf(dest, "%s,pc,%d", 			  regs16[IMM(inst,7,5)], 			  IMM(inst,4,0) << 2 );	break;      case 33 :        if( extend )            sprintf(dest, "%s,sp,%d", 			  regs16[IMM(inst,7,5)], 			  SIGN(			       (IMM(inst,20,16) << 11) |			       (IMM(inst,26,21) << 5 ) |			       (IMM(inst, 4, 0) << 0 ),			       16 ) );	else            sprintf(dest, "%s,sp,%d", 			  regs16[IMM(inst,7,5)], 			  IMM(inst,4,0) << 2 );	break;      case 34 :        if( extend )	{            if( IMM(inst,6,6) ) dest += sprintf( dest, "ra,");            if( IMM(inst,5,5) ) dest += sprintf( dest, "s0,");            if( IMM(inst,4,4) ) dest += sprintf( dest, "s1,");	    count = IMM(inst,26,24);	    /* s2..s8 */	    if( count == 1 )	        dest += sprintf( dest, "s2," );	    if( count > 1 )	        dest += sprintf( dest, "s2..s%d,", count+1 );	    	    /* a0..a3 */	    switch( IMM(inst,19,16) )	    {	      case 0  : break;	      case 1  : dest += sprintf( dest, "a3," ); break;	      case 2  : dest += sprintf( dest, "a2..a3," ); break;	      case 3  : dest += sprintf( dest, "a1..a3," ); break;	      case 11 : dest += sprintf( dest, "a0..a3," ); break;	      case 4  : break;	      case 5  : dest += sprintf( dest, "a3," ); break;	      case 6  : dest += sprintf( dest, "a2..a3," ); break;	      case 7  : dest += sprintf( dest, "a1..a3," ); break;	      case 8  : break;	      case 9  : dest += sprintf( dest, "a3," ); break;	      case 10 : dest += sprintf( dest, "a2..a3," ); break;	      case 12 : break;	      case 13 : dest += sprintf( dest, "a3," ); break;	      case 14 : break;	      case 15 : break;	    }	    /* Framesize * 8 */	    sprintf( dest, "0x%02x", 			   ((IMM(inst,23,20) << 4) |			   (IMM(inst,3,0)   << 0)) << 3 );	}	else	{            if( IMM(inst,6,6) ) dest += sprintf( dest, "ra,");            if( IMM(inst,5,5) ) dest += sprintf( dest, "s0,");            if( IMM(inst,4,4) ) dest += sprintf( dest, "s1,");	    sprintf( dest, "0x%02x", ZERO2_128(IMM(inst,3,0) << 3) );	}        break;      case 35 :        strcat(dest, "ra" );	break;      case 36 :        sprintf(dest, "ra,%s", 		      regs16[IMM(inst,10,8)] );	break;      default : /* rsvd */        break;    }    strcat( dest, "\n" );    return TRUE;}/* Command definition for dis */static t_cmd cmd_def ={    "dis",    dis,    "dis [-m] [-16] <address> [<count>]",    "Disassemble code starting at <address>.\n"    "\n"    "Disassembles MIPS64/MIPS32 instructions.\n"    "Includes MIPS-3D(TM) and MIPS16e(TM) ASEs.\n"    "Includes MIPS64/MIPS32 Release 2 instructions.\n"    "\n"    "<count> (default 16) specifies the number of instructions to disassemble.\n"    "\n"    "The continuation command '.' works together with 'dis'.",    options,    OPTION_COUNT,    FALSE};/************************************************************************ *  Implementation : Public functions ************************************************************************//************************************************************************ * *                          shell_dis_init *  Description : *  ------------- * *  Initialise command * *  Return values : *  --------------- * *  void * ************************************************************************/t_cmd *shell_dis_init( void ){    return &cmd_def;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -