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

📄 ppc-dis.c.svn-base

📁 我们自己开发的一个OSEK操作系统!不知道可不可以?
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
insert_ram (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  if (value >= ((insn >> 21) & 0x1f))    *errmsg = "index register in load range";  return insn | ((value & 0x1f) << 16);}/* The RA field in a D or X form instruction which is an updating   store or an updating floating point load, which means that the RA   field may not be zero.  */static unsigned longinsert_ras (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  if (value == 0)    *errmsg = "invalid register operand when updating";  return insn | ((value & 0x1f) << 16);}/* The RB field in an X form instruction when it must be the same as   the RS field in the instruction.  This is used for extended   mnemonics like mr.  This operand is marked FAKE.  The insertion   function just copies the BT field into the BA field, and the   extraction function just checks that the fields are the same.  *//*ARGSUSED*/static unsigned longinsert_rbs (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  return insn | (((insn >> 21) & 0x1f) << 11);}static longextract_rbs (insn, invalid)     uint32_t insn;     int *invalid;{  if (invalid != (int *) NULL      && ((insn >> 21) & 0x1f) != ((insn >> 11) & 0x1f))    *invalid = 1;  return 0;}/* The SH field in an MD form instruction.  This is split.  *//*ARGSUSED*/static unsigned longinsert_sh6 (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  return insn | ((value & 0x1f) << 11) | ((value & 0x20) >> 4);}/*ARGSUSED*/static longextract_sh6 (insn, invalid)     uint32_t insn;     int *invalid;{  return ((insn >> 11) & 0x1f) | ((insn << 4) & 0x20);}/* The SPR field in an XFX form instruction.  This is flipped--the   lower 5 bits are stored in the upper 5 and vice- versa.  */static unsigned longinsert_spr (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6);}static longextract_spr (insn, invalid)     uint32_t insn;     int *invalid;{  return ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0);}/* The TBR field in an XFX instruction.  This is just like SPR, but it   is optional.  When TBR is omitted, it must be inserted as 268 (the   magic number of the TB register).  These functions treat 0   (indicating an omitted optional operand) as 268.  This means that   ``mftb 4,0'' is not handled correctly.  This does not matter very   much, since the architecture manual does not define mftb as   accepting any values other than 268 or 269.  */#define TB (268)static unsigned longinsert_tbr (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  if (value == 0)    value = TB;  return insn | ((value & 0x1f) << 16) | ((value & 0x3e0) << 6);}static longextract_tbr (insn, invalid)     uint32_t insn;     int *invalid;{  long ret;  ret = ((insn >> 16) & 0x1f) | ((insn >> 6) & 0x3e0);  if (ret == TB)    ret = 0;  return ret;}/* Macros used to form opcodes.  *//* The main opcode.  */#define OP(x) (((x) & 0x3f) << 26)#define OP_MASK OP (0x3f)/* The main opcode combined with a trap code in the TO field of a D   form instruction.  Used for extended mnemonics for the trap   instructions.  */#define OPTO(x,to) (OP (x) | (((to) & 0x1f) << 21))#define OPTO_MASK (OP_MASK | TO_MASK)/* The main opcode combined with a comparison size bit in the L field   of a D form or X form instruction.  Used for extended mnemonics for   the comparison instructions.  */#define OPL(x,l) (OP (x) | (((l) & 1) << 21))#define OPL_MASK OPL (0x3f,1)/* An A form instruction.  */#define A(op, xop, rc) (OP (op) | (((xop) & 0x1f) << 1) | ((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) | (((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)) | (((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 (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)) | (((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)) | (((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) | (((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) | (((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) | (((sa) & 1) << 1) | ((lk) & 1))#define SC_MASK (OP_MASK | (0x3ff << 16) | (1 << 1) | 1)/* An X form instruction.  */#define X(op, xop) (OP (op) | (((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)) | (((l) & 1) << 21))/* The mask for an X form comparison instruction.  */#define XCMP_MASK (X_MASK | (1 << 22))/* The mask for an X form comparison instruction with the L field   fixed.  */#define XCMPL_MASK (XCMP_MASK | (1 << 21))/* An X form trap instruction with the TO field specified.  */#define XTO(op, xop, to) (X ((op), (xop)) | (((to) & 0x1f) << 21))#define XTO_MASK (X_MASK | TO_MASK)/* An XFL form instruction.  */#define XFL(op, xop, rc) (OP (op) | (((xop) & 0x3ff) << 1) | ((rc) & 1))#define XFL_MASK (XFL (0x3f, 0x3ff, 1) | (1 << 25) | (1 << 16))/* An XL form instruction with the LK field set to 0.  */#define XL(op, xop) (OP (op) | (((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)) | (((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)) | (((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)) | (((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) | (((xop) & 0x1ff) << 1) | (((oe) & 1) << 10) | ((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) | (((xop) & 0x1ff) << 2) | ((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 | (1 << 20) | (1 << 11))/* An XFX form instruction with the FXM field filled in.  */#define XFXM(op, xop, fxm) \  (X ((op), (xop)) | (((fxm) & 0xff) << 12))/* An XFX form instruction with the SPR field filled in.  */#define XSPR(op, xop, spr) \  (X ((op), (xop)) | (((spr) & 0x1f) << 16) | (((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)/* 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)

⌨️ 快捷键说明

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