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

📄 ppc-dis.c.svn-base

📁 我们自己开发的一个OSEK操作系统!不知道可不可以?
💻 SVN-BASE
📖 第 1 页 / 共 5 页
字号:
static unsigned longinsert_bdm (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  if ((value & 0x8000) != 0)    insn |= 1 << 21;  return insn | (value & 0xfffc);}static longextract_bdm (insn, invalid)     uint32_t insn;     int *invalid;{  if (invalid != (int *) NULL      && ((insn & (1 << 21)) == 0	  || (insn & (1 << 15)) == 0))    *invalid = 1;  if ((insn & 0x8000) != 0)    return (insn & 0xfffc) - 0x10000;  else    return insn & 0xfffc;}/* The BD field in a B form instruction when the + modifier is used.   This is like BDM, above, except that the branch is expected to be   taken.  *//*ARGSUSED*/static unsigned longinsert_bdp (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  if ((value & 0x8000) == 0)    insn |= 1 << 21;  return insn | (value & 0xfffc);}static longextract_bdp (insn, invalid)     uint32_t insn;     int *invalid;{  if (invalid != (int *) NULL      && ((insn & (1 << 21)) == 0	  || (insn & (1 << 15)) != 0))    *invalid = 1;  if ((insn & 0x8000) != 0)    return (insn & 0xfffc) - 0x10000;  else    return insn & 0xfffc;}/* Check for legal values of a BO field.  */static intvalid_bo (int32_t value){  /* Certain encodings have bits that are required to be zero.  These     are (z must be zero, y may be anything):         001zy	 011zy	 1z00y	 1z01y	 1z1zz     */  switch (value & 0x14)    {    default:    case 0:      return 1;    case 0x4:      return (value & 0x2) == 0;    case 0x10:      return (value & 0x8) == 0;    case 0x14:      return value == 0x14;    }}/* The BO field in a B form instruction.  Warn about attempts to set   the field to an illegal value.  */static unsigned longinsert_bo (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  if (errmsg != (const char **) NULL      && ! valid_bo (value))    *errmsg = "invalid conditional option";  return insn | ((value & 0x1f) << 21);}static longextract_bo (insn, invalid)     uint32_t insn;     int *invalid;{  int32_t value;  value = (insn >> 21) & 0x1f;  if (invalid != (int *) NULL      && ! valid_bo (value))    *invalid = 1;  return value;}/* The BO field in a B form instruction when the + or - modifier is   used.  This is like the BO field, but it must be even.  When   extracting it, we force it to be even.  */static unsigned longinsert_boe (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  if (errmsg != (const char **) NULL)    {      if (! valid_bo (value))	*errmsg = "invalid conditional option";      else if ((value & 1) != 0)	*errmsg = "attempt to set y bit when using + or - modifier";    }  return insn | ((value & 0x1f) << 21);}static longextract_boe (insn, invalid)     uint32_t insn;     int *invalid;{  int32_t value;  value = (insn >> 21) & 0x1f;  if (invalid != (int *) NULL      && ! valid_bo (value))    *invalid = 1;  return value & 0x1e;}/* The DS field in a DS form instruction.  This is like D, but the   lower two bits are forced to zero.  *//*ARGSUSED*/static unsigned longinsert_ds (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  return insn | (value & 0xfffc);}/*ARGSUSED*/static longextract_ds (insn, invalid)     uint32_t insn;     int *invalid;{  if ((insn & 0x8000) != 0)    return (insn & 0xfffc) - 0x10000;  else    return insn & 0xfffc;}/* The LI field in an I form instruction.  The lower two bits are   forced to zero.  *//*ARGSUSED*/static unsigned longinsert_li (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  return insn | (value & 0x3fffffc);}/*ARGSUSED*/static longextract_li (insn, invalid)     uint32_t insn;     int *invalid;{  if ((insn & 0x2000000) != 0)    return (insn & 0x3fffffc) - 0x4000000;  else    return insn & 0x3fffffc;}/* The MB and ME fields in an M form instruction expressed as a single   operand which is itself a bitmask.  The extraction function always   marks it as invalid, since we never want to recognize an   instruction which uses a field of this type.  */static unsigned longinsert_mbe (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  uint32_t uval;  int mb, me;  uval = value;  if (uval == 0)    {      if (errmsg != (const char **) NULL)	*errmsg = "illegal bitmask";      return insn;    }  me = 31;  while ((uval & 1) == 0)    {      uval >>= 1;      --me;    }  mb = me;  uval >>= 1;  while ((uval & 1) != 0)    {      uval >>= 1;      --mb;    }  if (uval != 0)    {      if (errmsg != (const char **) NULL)	*errmsg = "illegal bitmask";    }  return insn | (mb << 6) | (me << 1);}static longextract_mbe (insn, invalid)     uint32_t insn;     int *invalid;{  long ret;  int mb, me;  int i;  if (invalid != (int *) NULL)    *invalid = 1;  ret = 0;  mb = (insn >> 6) & 0x1f;  me = (insn >> 1) & 0x1f;  for (i = mb; i < me; i++)    ret |= 1 << (31 - i);  return ret;}/* The MB or ME field in an MD or MDS form instruction.  The high bit   is wrapped to the low end.  *//*ARGSUSED*/static unsigned longinsert_mb6 (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  return insn | ((value & 0x1f) << 6) | (value & 0x20);}/*ARGSUSED*/static longextract_mb6 (insn, invalid)     uint32_t insn;     int *invalid;{  return ((insn >> 6) & 0x1f) | (insn & 0x20);}/* The NB field in an X form instruction.  The value 32 is stored as   0.  */static unsigned longinsert_nb (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  if (value < 0 || value > 32)    *errmsg = "value out of range";  if (value == 32)    value = 0;  return insn | ((value & 0x1f) << 11);}/*ARGSUSED*/static longextract_nb (insn, invalid)     uint32_t insn;     int *invalid;{  long ret;  ret = (insn >> 11) & 0x1f;  if (ret == 0)    ret = 32;  return ret;}/* The NSI field in a D form instruction.  This is the same as the SI   field, only negated.  The extraction function always marks it as   invalid, since we never want to recognize an instruction which uses   a field of this type.  *//*ARGSUSED*/static unsigned longinsert_nsi (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  return insn | ((- value) & 0xffff);}static longextract_nsi (insn, invalid)     uint32_t insn;     int *invalid;{  if (invalid != (int *) NULL)    *invalid = 1;  if ((insn & 0x8000) != 0)    return - ((insn & 0xffff) - 0x10000);  else    return - (insn & 0xffff);}/* The RA field in a D or X form instruction which is an updating   load, which means that the RA field may not be zero and may not   equal the RT field.  */static unsigned longinsert_ral (insn, value, errmsg)     uint32_t insn;     int32_t value;     const char **errmsg;{  if (value == 0      || value == ((insn >> 21) & 0x1f))    *errmsg = "invalid register operand when updating";  return insn | ((value & 0x1f) << 16);}/* The RA field in an lmw instruction, which has special value   restrictions.  */static unsigned long

⌨️ 快捷键说明

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