本文整理汇总了C#中CodeContext.GetEffectiveAddressSize方法的典型用法代码示例。如果您正苦于以下问题:C# CodeContext.GetEffectiveAddressSize方法的具体用法?C# CodeContext.GetEffectiveAddressSize怎么用?C# CodeContext.GetEffectiveAddressSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeContext
的用法示例。
在下文中一共展示了CodeContext.GetEffectiveAddressSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetOperandSizeMatchLevel
object IInstructionDecoderLookup.TryLookup(
CodeContext mode, ImmutableLegacyPrefixList legacyPrefixes,
Xex xex, byte opcode, out bool hasModRM, out int immediateSizeInBytes)
{
var operandSize = mode.GetEffectiveOperandSize(legacyPrefixes, xex);
var addressSize = mode.GetEffectiveAddressSize(legacyPrefixes);
InstructionDefinition bestMatch = null;
int bestOperandSizeMatchLevel = -1;
var lookupKey = OpcodeEnum.MakeLookupKey(legacyPrefixes.GetSimdPrefix(xex.OpcodeMap), xex.OpcodeMap, opcode);
foreach (var instruction in byOpcodeKey[lookupKey])
{
var encoding = instruction.Encoding;
// Ensure we match the RexW requirements
if ((encoding & InstructionEncoding.RexW_Mask) == InstructionEncoding.RexW_Fixed
&& xex.OperandSize64 != ((instruction.Opcode & Opcode.RexW) != 0))
{
continue;
}
// Ensure we match the opcode
if ((opcode & encoding.GetOpcodeMainByteFixedMask()) != instruction.Opcode.GetMainByte())
continue;
// Record the candidate, favoring more specific operand size matches
var operandSizeMatchLevel = GetOperandSizeMatchLevel(encoding, operandSize);
if (operandSizeMatchLevel > bestOperandSizeMatchLevel)
{
bestMatch = instruction;
bestOperandSizeMatchLevel = operandSizeMatchLevel;
}
}
if (bestMatch == null)
{
hasModRM = false;
immediateSizeInBytes = 0;
return null;
}
hasModRM = bestMatch.Encoding.HasModRM();
immediateSizeInBytes = bestMatch.Encoding.GetImmediatesSizeInBytes(operandSize, addressSize);
return bestMatch;
}