📄 ppc-opc.c
字号:
of a D form or X form instruction. Used for extended mnemonics for the comparison instructions. */#define OPL(x,l) (OP (x) | ((((unsigned long)(l)) & 1) << 21))#define OPL_MASK OPL (0x3f,1)/* An A form instruction. */#define A(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x1f) << 1) | (((unsigned long)(rc)) & 1))#define A_MASK A (0x3f, 0x1f, 1)/* An A_MASK with the FRB field fixed. */#define AFRB_MASK (A_MASK | FRB_MASK)/* An A_MASK with the FRC field fixed. */#define AFRC_MASK (A_MASK | FRC_MASK)/* An A_MASK with the FRA and FRC fields fixed. */#define AFRAFRC_MASK (A_MASK | FRA_MASK | FRC_MASK)/* A B form instruction. */#define B(op, aa, lk) (OP (op) | ((((unsigned long)(aa)) & 1) << 1) | ((lk) & 1))#define B_MASK B (0x3f, 1, 1)/* A B form instruction setting the BO field. */#define BBO(op, bo, aa, lk) (B ((op), (aa), (lk)) | ((((unsigned long)(bo)) & 0x1f) << 21))#define BBO_MASK BBO (0x3f, 0x1f, 1, 1)/* A BBO_MASK with the y bit of the BO field removed. This permits matching a conditional branch regardless of the setting of the y bit. */#define Y_MASK (((unsigned long)1) << 21)#define BBOY_MASK (BBO_MASK &~ Y_MASK)/* A B form instruction setting the BO field and the condition bits of the BI field. */#define BBOCB(op, bo, cb, aa, lk) \ (BBO ((op), (bo), (aa), (lk)) | ((((unsigned long)(cb)) & 0x3) << 16))#define BBOCB_MASK BBOCB (0x3f, 0x1f, 0x3, 1, 1)/* A BBOCB_MASK with the y bit of the BO field removed. */#define BBOYCB_MASK (BBOCB_MASK &~ Y_MASK)/* A BBOYCB_MASK in which the BI field is fixed. */#define BBOYBI_MASK (BBOYCB_MASK | BI_MASK)/* The main opcode mask with the RA field clear. */#define DRA_MASK (OP_MASK | RA_MASK)/* A DS form instruction. */#define DSO(op, xop) (OP (op) | ((xop) & 0x3))#define DS_MASK DSO (0x3f, 3)/* An M form instruction. */#define M(op, rc) (OP (op) | ((rc) & 1))#define M_MASK M (0x3f, 1)/* An M form instruction with the ME field specified. */#define MME(op, me, rc) (M ((op), (rc)) | ((((unsigned long)(me)) & 0x1f) << 1))/* An M_MASK with the MB and ME fields fixed. */#define MMBME_MASK (M_MASK | MB_MASK | ME_MASK)/* An M_MASK with the SH and ME fields fixed. */#define MSHME_MASK (M_MASK | SH_MASK | ME_MASK)/* An MD form instruction. */#define MD(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x7) << 2) | ((rc) & 1))#define MD_MASK MD (0x3f, 0x7, 1)/* An MD_MASK with the MB field fixed. */#define MDMB_MASK (MD_MASK | MB6_MASK)/* An MD_MASK with the SH field fixed. */#define MDSH_MASK (MD_MASK | SH6_MASK)/* An MDS form instruction. */#define MDS(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0xf) << 1) | ((rc) & 1))#define MDS_MASK MDS (0x3f, 0xf, 1)/* An MDS_MASK with the MB field fixed. */#define MDSMB_MASK (MDS_MASK | MB6_MASK)/* An SC form instruction. */#define SC(op, sa, lk) (OP (op) | ((((unsigned long)(sa)) & 1) << 1) | ((lk) & 1))#define SC_MASK (OP_MASK | (((unsigned long)0x3ff) << 16) | (((unsigned long)1) << 1) | 1)/* An VX form instruction. */#define VX(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x7ff))/* The mask for an VX form instruction. */#define VX_MASK VX(0x3f, 0x7ff)/* An VA form instruction. */#define VXA(op, xop) (OP (op) | (((unsigned long)(xop)) & 0x07f))/* The mask for an VA form instruction. */#define VXA_MASK VXA(0x3f, 0x7f)/* An VXR form instruction. */#define VXR(op, xop, rc) (OP (op) | (((rc) & 1) << 10) | (((unsigned long)(xop)) & 0x3ff))/* The mask for a VXR form instruction. */#define VXR_MASK VXR(0x3f, 0x3ff, 1)/* An X form instruction. */#define X(op, xop) (OP (op) | ((((unsigned long)(xop)) & 0x3ff) << 1))/* An X form instruction with the RC bit specified. */#define XRC(op, xop, rc) (X ((op), (xop)) | ((rc) & 1))/* The mask for an X form instruction. */#define X_MASK XRC (0x3f, 0x3ff, 1)/* An X_MASK with the RA field fixed. */#define XRA_MASK (X_MASK | RA_MASK)/* An X_MASK with the RB field fixed. */#define XRB_MASK (X_MASK | RB_MASK)/* An X_MASK with the RT field fixed. */#define XRT_MASK (X_MASK | RT_MASK)/* An X_MASK with the RA and RB fields fixed. */#define XRARB_MASK (X_MASK | RA_MASK | RB_MASK)/* An X_MASK with the RT and RA fields fixed. */#define XRTRA_MASK (X_MASK | RT_MASK | RA_MASK)/* An X form comparison instruction. */#define XCMPL(op, xop, l) (X ((op), (xop)) | ((((unsigned long)(l)) & 1) << 21))/* The mask for an X form comparison instruction. */#define XCMP_MASK (X_MASK | (((unsigned long)1) << 22))/* The mask for an X form comparison instruction with the L field fixed. */#define XCMPL_MASK (XCMP_MASK | (((unsigned long)1) << 21))/* An X form trap instruction with the TO field specified. */#define XTO(op, xop, to) (X ((op), (xop)) | ((((unsigned long)(to)) & 0x1f) << 21))#define XTO_MASK (X_MASK | TO_MASK)/* An X form tlb instruction with the SH field specified. */#define XTLB(op, xop, sh) (X ((op), (xop)) | ((((unsigned long)(sh)) & 0x1f) << 11))#define XTLB_MASK (X_MASK | SH_MASK)/* An XFL form instruction. */#define XFL(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x3ff) << 1) | (((unsigned long)(rc)) & 1))#define XFL_MASK (XFL (0x3f, 0x3ff, 1) | (((unsigned long)1) << 25) | (((unsigned long)1) << 16))/* An XL form instruction with the LK field set to 0. */#define XL(op, xop) (OP (op) | ((((unsigned long)(xop)) & 0x3ff) << 1))/* An XL form instruction which uses the LK field. */#define XLLK(op, xop, lk) (XL ((op), (xop)) | ((lk) & 1))/* The mask for an XL form instruction. */#define XL_MASK XLLK (0x3f, 0x3ff, 1)/* An XL form instruction which explicitly sets the BO field. */#define XLO(op, bo, xop, lk) \ (XLLK ((op), (xop), (lk)) | ((((unsigned long)(bo)) & 0x1f) << 21))#define XLO_MASK (XL_MASK | BO_MASK)/* An XL form instruction which explicitly sets the y bit of the BO field. */#define XLYLK(op, xop, y, lk) (XLLK ((op), (xop), (lk)) | ((((unsigned long)(y)) & 1) << 21))#define XLYLK_MASK (XL_MASK | Y_MASK)/* An XL form instruction which sets the BO field and the condition bits of the BI field. */#define XLOCB(op, bo, cb, xop, lk) \ (XLO ((op), (bo), (xop), (lk)) | ((((unsigned long)(cb)) & 3) << 16))#define XLOCB_MASK XLOCB (0x3f, 0x1f, 0x3, 0x3ff, 1)/* An XL_MASK or XLYLK_MASK or XLOCB_MASK with the BB field fixed. */#define XLBB_MASK (XL_MASK | BB_MASK)#define XLYBB_MASK (XLYLK_MASK | BB_MASK)#define XLBOCBBB_MASK (XLOCB_MASK | BB_MASK)/* An XL_MASK with the BO and BB fields fixed. */#define XLBOBB_MASK (XL_MASK | BO_MASK | BB_MASK)/* An XL_MASK with the BO, BI and BB fields fixed. */#define XLBOBIBB_MASK (XL_MASK | BO_MASK | BI_MASK | BB_MASK)/* An XO form instruction. */#define XO(op, xop, oe, rc) \ (OP (op) | ((((unsigned long)(xop)) & 0x1ff) << 1) | ((((unsigned long)(oe)) & 1) << 10) | (((unsigned long)(rc)) & 1))#define XO_MASK XO (0x3f, 0x1ff, 1, 1)/* An XO_MASK with the RB field fixed. */#define XORB_MASK (XO_MASK | RB_MASK)/* An XS form instruction. */#define XS(op, xop, rc) (OP (op) | ((((unsigned long)(xop)) & 0x1ff) << 2) | (((unsigned long)(rc)) & 1))#define XS_MASK XS (0x3f, 0x1ff, 1)/* A mask for the FXM version of an XFX form instruction. */#define XFXFXM_MASK (X_MASK | (((unsigned long)1) << 20) | (((unsigned long)1) << 11))/* An XFX form instruction with the FXM field filled in. */#define XFXM(op, xop, fxm) \ (X ((op), (xop)) | ((((unsigned long)(fxm)) & 0xff) << 12))/* An XFX form instruction with the SPR field filled in. */#define XSPR(op, xop, spr) \ (X ((op), (xop)) | ((((unsigned long)(spr)) & 0x1f) << 16) | ((((unsigned long)(spr)) & 0x3e0) << 6))#define XSPR_MASK (X_MASK | SPR_MASK)/* An XFX form instruction with the SPR field filled in except for the SPRBAT field. */#define XSPRBAT_MASK (XSPR_MASK &~ SPRBAT_MASK)/* An XFX form instruction with the SPR field filled in except for the SPRG field. */#define XSPRG_MASK (XSPR_MASK &~ SPRG_MASK)/* An X form instruction with everything filled in except the E field. */#define XE_MASK (0xffff7fff)/* The BO encodings used in extended conditional branch mnemonics. */#define BODNZF (0x0)#define BODNZFP (0x1)#define BODZF (0x2)#define BODZFP (0x3)#define BOF (0x4)#define BOFP (0x5)#define BODNZT (0x8)#define BODNZTP (0x9)#define BODZT (0xa)#define BODZTP (0xb)#define BOT (0xc)#define BOTP (0xd)#define BODNZ (0x10)#define BODNZP (0x11)#define BODZ (0x12)#define BODZP (0x13)#define BOU (0x14)/* The BI condition bit encodings used in extended conditional branch mnemonics. */#define CBLT (0)#define CBGT (1)#define CBEQ (2)#define CBSO (3)/* The TO encodings used in extended trap mnemonics. */#define TOLGT (0x1)#define TOLLT (0x2)#define TOEQ (0x4)#define TOLGE (0x5)#define TOLNL (0x5)#define TOLLE (0x6)#define TOLNG (0x6)#define TOGT (0x8)#define TOGE (0xc)#define TONL (0xc)#define TOLT (0x10)#define TOLE (0x14)#define TONG (0x14)#define TONE (0x18)#define TOU (0x1f)/* Smaller names for the flags so each entry in the opcodes table will fit on a single line. */#undef PPC#define PPC PPC_OPCODE_PPC | PPC_OPCODE_ANY#define PPCCOM PPC_OPCODE_PPC | PPC_OPCODE_COMMON | PPC_OPCODE_ANY#define PPC32 PPC_OPCODE_PPC | PPC_OPCODE_32 | PPC_OPCODE_ANY#define PPC64 PPC_OPCODE_PPC | PPC_OPCODE_64 | PPC_OPCODE_ANY#define PPCONLY PPC_OPCODE_PPC#define PPC403 PPC#define PPC405 PPC403#define PPC750 PPC#define PPC860 PPC#define PPCVEC PPC_OPCODE_ALTIVEC | PPC_OPCODE_ANY#define POWER PPC_OPCODE_POWER | PPC_OPCODE_ANY#define POWER2 PPC_OPCODE_POWER | PPC_OPCODE_POWER2 | PPC_OPCODE_ANY#define PPCPWR2 PPC_OPCODE_PPC | PPC_OPCODE_POWER | PPC_OPCODE_POWER2 | PPC_OPCODE_ANY#define POWER32 PPC_OPCODE_POWER | PPC_OPCODE_ANY | PPC_OPCODE_32#define COM PPC_OPCODE_POWER | PPC_OPCODE_PPC | PPC_OPCODE_COMMON | PPC_OPCODE_ANY#define COM32 PPC_OPCODE_POWER | PPC_OPCODE_PPC | PPC_OPCODE_COMMON | PPC_OPCODE_ANY | PPC_OPCODE_32#define M601 PPC_OPCODE_POWER | PPC_OPCODE_601 | PPC_OPCODE_ANY#define PWRCOM PPC_OPCODE_POWER | PPC_OPCODE_601 | PPC_OPCODE_COMMON | PPC_OPCODE_ANY#define MFDEC1 PPC_OPCODE_POWER#define MFDEC2 PPC_OPCODE_PPC | PPC_OPCODE_601/* The opcode table. The format of the opcode table is: NAME OPCODE MASK FLAGS { OPERANDS } NAME is the name of the instruction. OPCODE is the instruction opcode. MASK is the opcode mask; this is used to tell the disassembler which bits in the actual opcode must match OPCODE. FLAGS are flags indicated what processors support the instruction. OPERANDS is the list of operands. The disassembler reads the table in order and prints the first instruction which matches, so this table is sorted to put more specific instructions before more general instructions. It is also sorted by major opcode. */const struct powerpc_opcode powerpc_opcodes[] = {{ "tdlgti", OPTO(2,TOLGT), OPTO_MASK, PPC64, { RA, SI } },{ "tdllti", OPTO(2,TOLLT), OPTO_MASK, PPC64, { RA, SI } },{ "tdeqi", OPTO(2,TOEQ), OPTO_MASK, PPC64, { RA, SI } },{ "tdlgei", OPTO(2,TOLGE), OPTO_MASK, PPC64, { RA, SI } },{ "tdlnli", OPTO(2,TOLNL), OPTO_MASK, PPC64, { RA, SI } },{ "tdllei", OPTO(2,TOLLE), OPTO_MASK, PPC64, { RA, SI } },{ "tdlngi", OPTO(2,TOLNG), OPTO_MASK, PPC64, { RA, SI } },{ "tdgti", OPTO(2,TOGT), OPTO_MASK, PPC64, { RA, SI } },{ "tdgei", OPTO(2,TOGE), OPTO_MASK, PPC64, { RA, SI } },{ "tdnli", OPTO(2,TONL), OPTO_MASK, PPC64, { RA, SI } },{ "tdlti", OPTO(2,TOLT), OPTO_MASK, PPC64, { RA, SI } },{ "tdlei", OPTO(2,TOLE), OPTO_MASK, PPC64, { RA, SI } },{ "tdngi", OPTO(2,TONG), OPTO_MASK, PPC64, { RA, SI } },{ "tdnei", OPTO(2,TONE), OPTO_MASK, PPC64, { RA, SI } },{ "tdi", OP(2), OP_MASK, PPC64, { TO, RA, SI } },{ "twlgti", OPTO(3,TOLGT), OPTO_MASK, PPCCOM, { RA, SI } },{ "tlgti", OPTO(3,TOLGT), OPTO_MASK, PWRCOM, { RA, SI } },{ "twllti", OPTO(3,TOLLT), OPTO_MASK, PPCCOM, { RA, SI } },{ "tllti", OPTO(3,TOLLT), OPTO_MASK, PWRCOM, { RA, SI } },{ "tweqi", OPTO(3,TOEQ), OPTO_MASK, PPCCOM, { RA, SI } },{ "teqi", OPTO(3,TOEQ), OPTO_MASK, PWRCOM, { RA, SI } },{ "twlgei", OPTO(3,TOLGE), OPTO_MASK, PPCCOM, { RA, SI } },{ "tlgei", OPTO(3,TOLGE), OPTO_MASK, PWRCOM, { RA, SI } },{ "twlnli", OPTO(3,TOLNL), OPTO_MASK, PPCCOM, { RA, SI } },{ "tlnli", OPTO(3,TOLNL), OPTO_MASK, PWRCOM, { RA, SI } },{ "twllei", OPTO(3,TOLLE), OPTO_MASK, PPCCOM, { RA, SI } },{ "tllei", OPTO(3,TOLLE), OPTO_MASK, PWRCOM, { RA, SI } },{ "twlngi", OPTO(3,TOLNG), OPTO_MASK, PPCCOM, { RA, SI } },{ "tlngi", OPTO(3,TOLNG), OPTO_MASK, PWRCOM, { RA, SI } },{ "twgti", OPTO(3,TOGT), OPTO_MASK, PPCCOM, { RA, SI } },{ "tgti", OPTO(3,TOGT), OPTO_MASK, PWRCOM, { RA, SI } },{ "twgei", OPTO(3,TOGE), OPTO_MASK, PPCCOM, { RA, SI } },{ "tgei", OPTO(3,TOGE), OPTO_MASK, PWRCOM, { RA, SI } },{ "twnli", OPTO(3,TONL), OPTO_MASK, PPCCOM, { RA, SI } },{ "tnli", OPTO(3,TONL), OPTO_MASK, PWRCOM, { RA, SI } },{ "twlti", OPTO(3,TOLT), OPTO_MASK, PPCCOM, { RA, SI } },{ "tlti", OPTO(3,TOLT), OPTO_MASK, PWRCOM, { RA, SI } },{ "twlei", OPTO(3,TOLE), OPTO_MASK, PPCCOM, { RA, SI } },{ "tlei", OPTO(3,TOLE), OPTO_MASK, PWRCOM, { RA, SI } },{ "twngi", OPTO(3,TONG), OPTO_MASK, PPCCOM, { RA, SI } },{ "tngi", OPTO(3,TONG), OPTO_MASK, PWRCOM, { RA, SI } },{ "twnei", OPTO(3,TONE), OPTO_MASK, PPCCOM, { RA, SI } },{ "tnei", OPTO(3,TONE), OPTO_MASK, PWRCOM, { RA, SI } },{ "twi", OP(3), OP_MASK, PPCCOM, { TO, RA, SI } },{ "ti", OP(3), OP_MASK, PWRCOM, { TO, RA, SI } },
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -