?? mips-dis.c
字號:
The I64 format uses IMM8. The RI64 format uses RY and IMM5. */#define MIPS16OP_MASK_OP 0x1f#define MIPS16OP_SH_OP 11#define MIPS16OP_MASK_IMM11 0x7ff#define MIPS16OP_SH_IMM11 0#define MIPS16OP_MASK_RX 0x7#define MIPS16OP_SH_RX 8#define MIPS16OP_MASK_IMM8 0xff#define MIPS16OP_SH_IMM8 0#define MIPS16OP_MASK_RY 0x7#define MIPS16OP_SH_RY 5#define MIPS16OP_MASK_IMM5 0x1f#define MIPS16OP_SH_IMM5 0#define MIPS16OP_MASK_RZ 0x7#define MIPS16OP_SH_RZ 2#define MIPS16OP_MASK_IMM4 0xf#define MIPS16OP_SH_IMM4 0#define MIPS16OP_MASK_REGR32 0x1f#define MIPS16OP_SH_REGR32 0#define MIPS16OP_MASK_REG32R 0x1f#define MIPS16OP_SH_REG32R 3#define MIPS16OP_EXTRACT_REG32R(i) ((((i) >> 5) & 7) | ((i) & 0x18))#define MIPS16OP_MASK_MOVE32Z 0x7#define MIPS16OP_SH_MOVE32Z 0#define MIPS16OP_MASK_IMM6 0x3f#define MIPS16OP_SH_IMM6 5/* These are the characters which may appears in the args field of an instruction. They appear in the order in which the fields appear when the instruction is used. Commas and parentheses in the args string are ignored when assembling, and written into the output when disassembling. "y" 3 bit register (MIPS16OP_*_RY) "x" 3 bit register (MIPS16OP_*_RX) "z" 3 bit register (MIPS16OP_*_RZ) "Z" 3 bit register (MIPS16OP_*_MOVE32Z) "v" 3 bit same register as source and destination (MIPS16OP_*_RX) "w" 3 bit same register as source and destination (MIPS16OP_*_RY) "0" zero register ($0) "S" stack pointer ($sp or $29) "P" program counter "R" return address register ($ra or $31) "X" 5 bit MIPS register (MIPS16OP_*_REGR32) "Y" 5 bit MIPS register (MIPS16OP_*_REG32R) "6" 6 bit unsigned break code (MIPS16OP_*_IMM6) "a" 26 bit jump address "e" 11 bit extension value "l" register list for entry instruction "L" register list for exit instruction The remaining codes may be extended. Except as otherwise noted, the full extended operand is a 16 bit signed value. "<" 3 bit unsigned shift count * 0 (MIPS16OP_*_RZ) (full 5 bit unsigned) ">" 3 bit unsigned shift count * 0 (MIPS16OP_*_RX) (full 5 bit unsigned) "[" 3 bit unsigned shift count * 0 (MIPS16OP_*_RZ) (full 6 bit unsigned) "]" 3 bit unsigned shift count * 0 (MIPS16OP_*_RX) (full 6 bit unsigned) "4" 4 bit signed immediate * 0 (MIPS16OP_*_IMM4) (full 15 bit signed) "5" 5 bit unsigned immediate * 0 (MIPS16OP_*_IMM5) "H" 5 bit unsigned immediate * 2 (MIPS16OP_*_IMM5) "W" 5 bit unsigned immediate * 4 (MIPS16OP_*_IMM5) "D" 5 bit unsigned immediate * 8 (MIPS16OP_*_IMM5) "j" 5 bit signed immediate * 0 (MIPS16OP_*_IMM5) "8" 8 bit unsigned immediate * 0 (MIPS16OP_*_IMM8) "V" 8 bit unsigned immediate * 4 (MIPS16OP_*_IMM8) "C" 8 bit unsigned immediate * 8 (MIPS16OP_*_IMM8) "U" 8 bit unsigned immediate * 0 (MIPS16OP_*_IMM8) (full 16 bit unsigned) "k" 8 bit signed immediate * 0 (MIPS16OP_*_IMM8) "K" 8 bit signed immediate * 8 (MIPS16OP_*_IMM8) "p" 8 bit conditional branch address (MIPS16OP_*_IMM8) "q" 11 bit branch address (MIPS16OP_*_IMM11) "A" 8 bit PC relative address * 4 (MIPS16OP_*_IMM8) "B" 5 bit PC relative address * 8 (MIPS16OP_*_IMM5) "E" 5 bit PC relative address * 4 (MIPS16OP_*_IMM5) *//* Save/restore encoding for the args field when all 4 registers are either saved as arguments or saved/restored as statics. */#define MIPS16_ALL_ARGS 0xe#define MIPS16_ALL_STATICS 0xb/* For the mips16, we use the same opcode table format and a few of the same flags. However, most of the flags are different. *//* Modifies the register in MIPS16OP_*_RX. */#define MIPS16_INSN_WRITE_X 0x00000001/* Modifies the register in MIPS16OP_*_RY. */#define MIPS16_INSN_WRITE_Y 0x00000002/* Modifies the register in MIPS16OP_*_RZ. */#define MIPS16_INSN_WRITE_Z 0x00000004/* Modifies the T ($24) register. */#define MIPS16_INSN_WRITE_T 0x00000008/* Modifies the SP ($29) register. */#define MIPS16_INSN_WRITE_SP 0x00000010/* Modifies the RA ($31) register. */#define MIPS16_INSN_WRITE_31 0x00000020/* Modifies the general purpose register in MIPS16OP_*_REG32R. */#define MIPS16_INSN_WRITE_GPR_Y 0x00000040/* Reads the register in MIPS16OP_*_RX. */#define MIPS16_INSN_READ_X 0x00000080/* Reads the register in MIPS16OP_*_RY. */#define MIPS16_INSN_READ_Y 0x00000100/* Reads the register in MIPS16OP_*_MOVE32Z. */#define MIPS16_INSN_READ_Z 0x00000200/* Reads the T ($24) register. */#define MIPS16_INSN_READ_T 0x00000400/* Reads the SP ($29) register. */#define MIPS16_INSN_READ_SP 0x00000800/* Reads the RA ($31) register. */#define MIPS16_INSN_READ_31 0x00001000/* Reads the program counter. */#define MIPS16_INSN_READ_PC 0x00002000/* Reads the general purpose register in MIPS16OP_*_REGR32. */#define MIPS16_INSN_READ_GPR_X 0x00004000/* Is a branch insn. */#define MIPS16_INSN_BRANCH 0x00010000/* The following flags have the same value for the mips16 opcode table: INSN_UNCOND_BRANCH_DELAY INSN_COND_BRANCH_DELAY INSN_COND_BRANCH_LIKELY (never used) INSN_READ_HI INSN_READ_LO INSN_WRITE_HI INSN_WRITE_LO INSN_TRAP INSN_ISA3 */extern const struct mips_opcode mips16_opcodes[];extern const int bfd_mips16_num_opcodes;/* Short hand so the lines aren't too long. */#define LDD INSN_LOAD_MEMORY_DELAY#define LCD INSN_LOAD_COPROC_DELAY#define UBD INSN_UNCOND_BRANCH_DELAY#define CBD INSN_COND_BRANCH_DELAY#define COD INSN_COPROC_MOVE_DELAY#define CLD INSN_COPROC_MEMORY_DELAY#define CBL INSN_COND_BRANCH_LIKELY#define TRAP INSN_TRAP#define SM INSN_STORE_MEMORY#define WR_d INSN_WRITE_GPR_D#define WR_t INSN_WRITE_GPR_T#define WR_31 INSN_WRITE_GPR_31#define WR_D INSN_WRITE_FPR_D#define WR_T INSN_WRITE_FPR_T#define WR_S INSN_WRITE_FPR_S#define RD_s INSN_READ_GPR_S#define RD_b INSN_READ_GPR_S#define RD_t INSN_READ_GPR_T#define RD_S INSN_READ_FPR_S#define RD_T INSN_READ_FPR_T#define RD_R INSN_READ_FPR_R#define WR_CC INSN_WRITE_COND_CODE#define RD_CC INSN_READ_COND_CODE#define RD_C0 INSN_COP#define RD_C1 INSN_COP#define RD_C2 INSN_COP#define RD_C3 INSN_COP#define WR_C0 INSN_COP#define WR_C1 INSN_COP#define WR_C2 INSN_COP#define WR_C3 INSN_COP#define WR_HI INSN_WRITE_HI#define RD_HI INSN_READ_HI#define MOD_HI WR_HI|RD_HI#define WR_LO INSN_WRITE_LO#define RD_LO INSN_READ_LO#define MOD_LO WR_LO|RD_LO#define WR_HILO WR_HI|WR_LO#define RD_HILO RD_HI|RD_LO#define MOD_HILO WR_HILO|RD_HILO#define IS_M INSN_MULT#define WR_MACC INSN2_WRITE_MDMX_ACC#define RD_MACC INSN2_READ_MDMX_ACC#define I1 INSN_ISA1#define I2 INSN_ISA2#define I3 INSN_ISA3#define I4 INSN_ISA4#define I5 INSN_ISA5#define I32 INSN_ISA32#define I64 INSN_ISA64#define I33 INSN_ISA32R2#define I65 INSN_ISA64R2/* MIPS64 MIPS-3D ASE support. */#define I16 INSN_MIPS16/* MIPS32 SmartMIPS ASE support. */#define SMT INSN_SMARTMIPS/* MIPS64 MIPS-3D ASE support. */#define M3D INSN_MIPS3D/* MIPS64 MDMX ASE support. */#define MX INSN_MDMX#define P3 INSN_4650#define L1 INSN_4010#define V1 (INSN_4100 | INSN_4111 | INSN_4120)#define T3 INSN_3900#define M1 INSN_10000#define SB1 INSN_SB1#define N411 INSN_4111#define N412 INSN_4120#define N5 (INSN_5400 | INSN_5500)#define N54 INSN_5400#define N55 INSN_5500#define G1 (T3 \ )#define G2 (T3 \ )#define G3 (I4 \ )/* MIPS DSP ASE support. NOTE: 1. MIPS DSP ASE includes 4 accumulators ($ac0 - $ac3). $ac0 is the pair of original HI and LO. $ac1, $ac2 and $ac3 are new registers, and have the same structure as $ac0 (HI + LO). For DSP instructions that write or read accumulators (that may be $ac0), we add WR_a (WR_HILO) or RD_a (RD_HILO) attributes, such that HILO dependencies are maintained conservatively. 2. For some mul. instructions that use integer registers as destinations but destroy HI+LO as side-effect, we add WR_HILO to their attributes. 3. MIPS DSP ASE includes a new DSP control register, which has 6 fields (ccond, outflag, EFI, c, scount, pos). Many DSP instructions read or write certain fields of the DSP control register. For simplicity, we decide not to track dependencies of these fields. However, "bposge32" is a branch instruction that depends on the "pos" field. In order to make sure that GAS does not reorder DSP instructions that writes the "pos" field and "bposge32", we add DSP_VOLA (INSN_TRAP) attribute to those instructions that write the "pos" field. */#define WR_a WR_HILO /* Write dsp accumulators (reuse WR_HILO) */#define RD_a RD_HILO /* Read dsp accumulators (reuse RD_HILO) */#define MOD_a WR_a|RD_a#define DSP_VOLA INSN_TRAP#define D32 INSN_DSP#define D33 INSN_DSPR2#define D64 INSN_DSP64/* MIPS MT ASE support. */#define MT32 INSN_MT/* The order of overloaded instructions matters. Label arguments and register arguments look the same. Instructions that can have either for arguments must apear in the correct order in this table for the assembler to pick the right one. In other words, entries with immediate operands must apear after the same instruction with registers. Because of the lookup algorithm used, entries with the same opcode name must be contiguous. Many instructions are short hand for other instructions (i.e., The jal <register> instruction is short for jalr <register>). */const struct mips_opcode mips_builtin_opcodes[] ={/* These instructions appear first so that the disassembler will find them first. The assemblers uses a hash table based on the instruction name anyhow. *//* name, args, match, mask, pinfo, membership */{"pref", "k,o(b)", 0xcc000000, 0xfc000000, RD_b, 0, I4|I32|G3 },{"prefx", "h,t(b)", 0x4c00000f, 0xfc0007ff, RD_b|RD_t, 0, I4|I33 },{"nop", "", 0x00000000, 0xffffffff, 0, INSN2_ALIAS, I1 }, /* sll */{"ssnop", "", 0x00000040, 0xffffffff, 0, INSN2_ALIAS, I32|N55 }, /* sll */{"ehb", "", 0x000000c0, 0xffffffff, 0, INSN2_ALIAS, I33 }, /* sll */{"li", "t,j", 0x24000000, 0xffe00000, WR_t, INSN2_ALIAS, I1 }, /* addiu */{"li", "t,i", 0x34000000, 0xffe00000, WR_t, INSN2_ALIAS, I1 }, /* ori */{"li", "t,I", 0, (int) M_LI, INSN_MACRO, 0, I1 },{"move", "d,s", 0, (int) M_MOVE, INSN_MACRO, 0, I1 },{"move", "d,s", 0x0000002d, 0xfc1f07ff, WR_d|RD_s, INSN2_ALIAS, I3 },/* daddu */{"move", "d,s", 0x00000021, 0xfc1f07ff, WR_d|RD_s, INSN2_ALIAS, I1 },/* addu */{"move", "d,s", 0x00000025, 0xfc1f07ff, WR_d|RD_s, INSN2_ALIAS, I1 },/* or */{"b", "p", 0x10000000, 0xffff0000, UBD, INSN2_ALIAS, I1 },/* beq 0,0 */{"b", "p", 0x04010000, 0xffff0000, UBD, INSN2_ALIAS, I1 },/* bgez 0 */{"bal", "p", 0x04110000, 0xffff0000, UBD|WR_31, INSN2_ALIAS, I1 },/* bgezal 0*/{"abs", "d,v", 0, (int) M_ABS, INSN_MACRO, 0, I1 },{"abs.s", "D,V", 0x46000005, 0xffff003f, WR_D|RD_S|FP_S, 0, I1 },{"abs.d", "D,V", 0x46200005, 0xffff003f, WR_D|RD_S|FP_D, 0, I1 },{"abs.ps", "D,V", 0x46c00005, 0xffff003f, WR_D|RD_S|FP_D, 0, I5|I33 },{"add", "d,v,t", 0x00000020, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I1 },{"add", "t,r,I", 0, (int) M_ADD_I, INSN_MACRO, 0, I1 },{"add.s", "D,V,T", 0x46000000, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, 0, I1 },{"add.d", "D,V,T", 0x46200000, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, I1 },{"add.ob", "X,Y,Q", 0x7800000b, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },{"add.ob", "D,S,T", 0x4ac0000b, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },{"add.ob", "D,S,T[e]", 0x4800000b, 0xfe20003f, WR_D|RD_S|RD_T, 0, N54 },{"add.ob", "D,S,k", 0x4bc0000b, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },{"add.ps", "D,V,T", 0x46c00000, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, I5|I33 },{"add.qh", "X,Y,Q", 0x7820000b, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -