當前位置: 首頁>>代碼示例>>C#>>正文


C# CodeContext.GetEffectiveAddressSize方法代碼示例

本文整理匯總了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;
		}
開發者ID:MrTrillian,項目名稱:Asmuth,代碼行數:45,代碼來源:InstructionDictionary.cs


注:本文中的CodeContext.GetEffectiveAddressSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。