本文整理汇总了C#中Opcode.WithMainByte方法的典型用法代码示例。如果您正苦于以下问题:C# Opcode.WithMainByte方法的具体用法?C# Opcode.WithMainByte怎么用?C# Opcode.WithMainByte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Opcode
的用法示例。
在下文中一共展示了Opcode.WithMainByte方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToOpcodeEncoding
public static void ToOpcodeEncoding(this VexOpcodeEncoding vexEncoding, out Opcode opcode, out InstructionEncoding encoding)
{
opcode = default(Opcode);
encoding = default(InstructionEncoding);
var vexType = vexEncoding & VexOpcodeEncoding.Type_Mask;
switch (vexType)
{
case VexOpcodeEncoding.Type_Vex: opcode |= Opcode.XexType_Vex; break;
case VexOpcodeEncoding.Type_Xop: opcode |= Opcode.XexType_Xop; break;
case VexOpcodeEncoding.Type_EVex: opcode |= Opcode.XexType_EVex; break;
default: throw new ArgumentException();
}
switch (vexEncoding & VexOpcodeEncoding.SimdPrefix_Mask)
{
case VexOpcodeEncoding.SimdPrefix_None: opcode |= Opcode.SimdPrefix_None; break;
case VexOpcodeEncoding.SimdPrefix_66: opcode |= Opcode.SimdPrefix_66; break;
case VexOpcodeEncoding.SimdPrefix_F2: opcode |= Opcode.SimdPrefix_F2; break;
case VexOpcodeEncoding.SimdPrefix_F3: opcode |= Opcode.SimdPrefix_F3; break;
default: throw new UnreachableException();
}
switch (vexEncoding & VexOpcodeEncoding.VectorLength_Mask)
{
case VexOpcodeEncoding.VectorLength_0:
encoding |= InstructionEncoding.VexL_Fixed;
opcode |= Opcode.VexL_0;
break;
case VexOpcodeEncoding.VectorLength_1:
encoding |= InstructionEncoding.VexL_Fixed;
opcode |= Opcode.VexL_1;
break;
case VexOpcodeEncoding.VectorLength_2:
encoding |= InstructionEncoding.VexL_Fixed;
opcode |= Opcode.VexL_2;
break;
case VexOpcodeEncoding.VectorLength_Ignored:
encoding |= InstructionEncoding.VexL_Ignored;
break;
}
switch (vexEncoding & VexOpcodeEncoding.RexW_Mask)
{
case VexOpcodeEncoding.RexW_0:
encoding |= InstructionEncoding.RexW_Fixed;
break;
case VexOpcodeEncoding.RexW_1:
encoding |= InstructionEncoding.RexW_Fixed;
opcode |= Opcode.RexW;
break;
case VexOpcodeEncoding.RexW_Ignored:
encoding |= InstructionEncoding.RexW_Ignored;
break;
}
if (vexType == VexOpcodeEncoding.Type_Xop)
{
switch (vexEncoding & VexOpcodeEncoding.Map_Mask)
{
case VexOpcodeEncoding.Map_Xop8: opcode |= Opcode.Map_Xop8; break;
case VexOpcodeEncoding.Map_Xop9: opcode |= Opcode.Map_Xop9; break;
case VexOpcodeEncoding.Map_Xop10: opcode |= Opcode.Map_Xop10; break;
default: throw new ArgumentException();
}
}
else
{
switch (vexEncoding & VexOpcodeEncoding.Map_Mask)
{
case VexOpcodeEncoding.Map_0F: opcode |= Opcode.Map_0F; break;
case VexOpcodeEncoding.Map_0F38: opcode |= Opcode.Map_0F38; break;
case VexOpcodeEncoding.Map_0F3A: opcode |= Opcode.Map_0F3A; break;
default: throw new ArgumentException();
}
}
opcode = opcode.WithMainByte(vexEncoding.GetMainByte());
encoding |= InstructionEncoding.OpcodeFormat_FixedByte;
if ((vexEncoding & VexOpcodeEncoding.HasModRM) != 0)
encoding |= InstructionEncoding.ModRM_Any;
switch (vexEncoding & VexOpcodeEncoding.ImmediateType_Mask)
{
case VexOpcodeEncoding.ImmediateType_None:
encoding = encoding.WithImmediateSizes(ImmediateSize.Zero);
break;
case VexOpcodeEncoding.ImmediateType_Byte:
case VexOpcodeEncoding.ImmediateType_Is4:
encoding = encoding.WithImmediateSizes(ImmediateSize.Fixed8);
break;
default: throw new ArgumentException();
//.........这里部分代码省略.........