当前位置: 首页>>代码示例>>C#>>正文


C# X86.DWordMemory类代码示例

本文整理汇总了C#中SharpOS.AOT.X86.DWordMemory的典型用法代码示例。如果您正苦于以下问题:C# DWordMemory类的具体用法?C# DWordMemory怎么用?C# DWordMemory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DWordMemory类属于SharpOS.AOT.X86命名空间,在下文中一共展示了DWordMemory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FSUBR

		/// <summary>
		/// FSUBR mem32
		/// </summary>
		public static void FSUBR (DWordMemory target)
		{
		}
开发者ID:sharpos,项目名称:SharpOS,代码行数:6,代码来源:Asm.cs

示例2: Call

		/// <summary>
		/// Encodes the IL 'call', 'calli', and 'callvirt' instructions
		/// </summary>
		private void Call (SharpOS.AOT.IR.Instructions.Call call)
		{
			if (call.IsSpecialCase) {
				if (this.assembly.IsInstruction (call.Method.Class.TypeFullName))
					this.HandleAssemblyStub (call);
				else
					this.HandleBuiltIns (call);

				return;
			}

			if (call.Method.Class.IsArray
					&& call.Method.SkipProcessing) {
				this.ArrayCalls (call);

				return;
			}

			// TODO add support for call/callvirt/calli/jmp and for tail./constrained.

			// Perform a null check for non-static methods
			if (!(call.Method.MethodDefinition as Mono.Cecil.MethodDefinition).IsStatic) {
				IR.Operands.Register identifier = call.Use [0] as IR.Operands.Register;

				if (identifier.IsRegisterSet)
					this.assembly.MOV (R32.EAX, Assembly.GetRegister (identifier.Register));
				else
					this.assembly.MOV (R32.EAX, new DWordMemory (this.GetAddress (identifier)));

				NullCheck (R32.EAX);
			}

			PushCallParameters (call);

			IR.Operands.Register assignee = call.Def as IR.Operands.Register;

			if (call.Method.IsReturnTypeBigValueType) {
				this.assembly.LEA (R32.EAX, this.GetAddress (assignee));
				this.assembly.PUSH (R32.EAX);
			}

			if (call is Callvirt
					&& (call.Method.IsNewSlot
						|| call.Method.IsVirtual)) {
				IR.Operands.Register _this = call.Use [0] as IR.Operands.Register;

				if (_this.IsRegisterSet)
					this.assembly.MOV (R32.EAX, Assembly.GetRegister (_this.Register));
				else
					this.assembly.MOV (R32.EAX, new DWordMemory (this.GetAddress (_this)));

				if (call.Method.InterfaceMethodNumber == -1) {
					// Do a normal vtable call
					int address = this.assembly.Engine.VTableSize + this.assembly.IntSize * call.Method.VirtualSlot;

					// Get the Object's VTable
					this.assembly.MOV (R32.EAX, new DWordMemory (null, R32.EAX, null, 0));

					// Call virtual method using the table in the Object's VTable
					this.assembly.CALL (new DWordMemory (null, R32.EAX, null, 0, address));
				} else {
					// Do a IMT lookup call for interface method
					int address = this.assembly.IntSize * call.Method.InterfaceMethodKey + this.assembly.Engine.ObjectSize;

					// Get the Object's VTable
					this.assembly.MOV (R32.EAX, new DWordMemory (null, R32.EAX, null, 0));

					// Get the Object's ITable
					this.assembly.MOV (R32.EAX, new DWordMemory (null, R32.EAX, null, 0, this.assembly.IntSize * 4));

					// IMT key in case call hits a colision resolving stub
					this.assembly.MOV (R32.ECX, (uint) call.Method.InterfaceMethodNumber);

					// Call virtual method using the table in the Object's ITable
					this.assembly.CALL (new DWordMemory (null, R32.EAX, null, 0, address));
				}
			} else
				assembly.CALL (call.Method.AssemblyLabel);

			PopCallParameters (call);

			if (assignee != null) {
				switch (assignee.InternalType) {
				case InternalType.I:
				case InternalType.M:
				case InternalType.O:
				case InternalType.I4:
				case InternalType.SZArray:
				case InternalType.Array:
					if (assignee.IsRegisterSet)
						this.assembly.MOV (Assembly.GetRegister (assignee.Register), R32.EAX);
					else
						this.assembly.MOV (new DWordMemory (this.GetAddress (assignee)), R32.EAX);

					break;

				case InternalType.I8:
//.........这里部分代码省略.........
开发者ID:sharpos,项目名称:SharpOS,代码行数:101,代码来源:IR.cs

示例3: Load

		/// <summary>
		/// Common implementation for IL instructions which load a value onto the IL evaluation stack.
		/// </summary>
		private void Load (IR.Operands.Register assignee, InternalType sourceType, Memory memory)
		{
			switch (sourceType) {
			case InternalType.I1:
				this.assembly.MOVSX (R32.EAX, new ByteMemory (memory));

				if (assignee.IsRegisterSet)
					this.assembly.MOV (Assembly.GetRegister (assignee.Register), R32.EAX);

				else
					this.assembly.MOV (new DWordMemory (this.GetAddress (assignee)), R32.EAX);

				break;

			case InternalType.U1:
				this.assembly.MOVZX (R32.EAX, new ByteMemory (memory));

				if (assignee.IsRegisterSet)
					this.assembly.MOV (Assembly.GetRegister (assignee.Register), R32.EAX);

				else
					this.assembly.MOV (new DWordMemory (this.GetAddress (assignee)), R32.EAX);

				break;

			case InternalType.I2:
				this.assembly.MOVSX (R32.EAX, new WordMemory (memory));

				if (assignee.IsRegisterSet)
					this.assembly.MOV (Assembly.GetRegister (assignee.Register), R32.EAX);

				else
					this.assembly.MOV (new DWordMemory (this.GetAddress (assignee)), R32.EAX);

				break;

			case InternalType.U2:
				this.assembly.MOVZX (R32.EAX, new WordMemory (memory));

				if (assignee.IsRegisterSet)
					this.assembly.MOV (Assembly.GetRegister (assignee.Register), R32.EAX);

				else
					this.assembly.MOV (new DWordMemory (this.GetAddress (assignee)), R32.EAX);

				break;

			case InternalType.I4:
			case InternalType.U4:
			case InternalType.I:
			case InternalType.U:
			case InternalType.O:
			case InternalType.M:
			case InternalType.SZArray:
			case InternalType.Array:
				this.assembly.MOV (R32.EAX, new DWordMemory (memory));

				if (assignee.IsRegisterSet)
					this.assembly.MOV (Assembly.GetRegister (assignee.Register), R32.EAX);

				else
					this.assembly.MOV (new DWordMemory (this.GetAddress (assignee)), R32.EAX);

				break;

			case InternalType.I8:
			case InternalType.U8:
				DWordMemory source = new DWordMemory (memory);
				source.DisplacementDelta = 4;

				Memory destination = this.GetAddress (assignee);
				destination.DisplacementDelta = 4;

				this.assembly.MOV (R32.EAX, new DWordMemory (memory));
				this.assembly.MOV (new DWordMemory (this.GetAddress (assignee)), R32.EAX);

				this.assembly.MOV (R32.EAX, new DWordMemory (source));
				this.assembly.MOV (new DWordMemory (destination), R32.EAX);
				break;

			case InternalType.ValueType:
				uint size = (uint) assignee.Type.Size;

				if (size == 4) {
					this.assembly.MOV (R32.EAX, new DWordMemory (memory));

					if (assignee.IsRegisterSet)
						this.assembly.MOV (Assembly.GetRegister (assignee.Register), R32.EAX);
					else
						this.assembly.MOV (new DWordMemory (this.GetAddress (assignee)), R32.EAX);

				} else {
					this.assembly.PUSH (R32.ECX);
					this.assembly.PUSH (R32.ESI);
					this.assembly.PUSH (R32.EDI);

					this.assembly.LEA (R32.ESI, new DWordMemory (memory));
//.........这里部分代码省略.........
开发者ID:sharpos,项目名称:SharpOS,代码行数:101,代码来源:IR.cs

示例4: ConditionCheck

		/// <summary>
		///
		/// </summary>
		private void ConditionCheck (IR.Instructions.ConditionCheck instruction)
		{
			IR.Operands.Register assignee = instruction.Def as IR.Operands.Register;
			IR.Operands.Register first = instruction.Use [0] as IR.Operands.Register;
			IR.Operands.Register second = instruction.Use [1] as IR.Operands.Register;

			string errorLabel = assembly.GetCMPLabel;
			string okLabel = assembly.GetCMPLabel;
			string endLabel = assembly.GetCMPLabel;

			switch (first.InternalType) {
			case InternalType.M:
			case InternalType.O:
			case InternalType.I:
			case InternalType.I4:
			case InternalType.SZArray:
			case InternalType.Array:
				if (first.IsRegisterSet)
					this.assembly.MOV (R32.EAX, Assembly.GetRegister (first.Register));
				else
					this.assembly.MOV (R32.EAX, new DWordMemory (this.GetAddress (first)));

				if (second.IsRegisterSet)
					this.assembly.MOV (R32.EDX, Assembly.GetRegister (second.Register));
				else
					this.assembly.MOV (R32.EDX, new DWordMemory (this.GetAddress (second)));

				this.assembly.CMP (R32.EAX, R32.EDX);

				RelationalTypeCMP (instruction.RelationalType, okLabel);

				break;

			case InternalType.I8:
				DWordMemory firstAddress = new DWordMemory (this.GetAddress (first));
				firstAddress.DisplacementDelta = 4;

				DWordMemory secondAddress = new DWordMemory (this.GetAddress (second));
				secondAddress.DisplacementDelta = 4;

				this.assembly.MOV (R32.EAX, firstAddress);
				this.assembly.MOV (R32.EDX, secondAddress);
				this.assembly.CMP (R32.EAX, R32.EDX);

				RelationalTypeCMP (instruction.RelationalType, okLabel, errorLabel);

				this.assembly.MOV (R32.EAX, new DWordMemory (this.GetAddress (first)));
				this.assembly.MOV (R32.EDX, new DWordMemory (this.GetAddress (second)));
				this.assembly.CMP (R32.EAX, R32.EDX);

				RelationalTypeCMP (instruction.RelationalType, okLabel);

				break;

			default:
				throw new NotImplementedEngineException ("ConditionCheck for " + first.InternalType.ToString() + " and " + second.InternalType.ToString());
			}

			assembly.LABEL (errorLabel);
			this.assembly.XOR (R32.ECX, R32.ECX);
			this.assembly.JMP (endLabel);

			assembly.LABEL (okLabel);
			this.assembly.XOR (R32.ECX, R32.ECX);
			this.assembly.INC (R32.ECX);

			this.assembly.LABEL (endLabel);

			if (assignee.IsRegisterSet)
				this.assembly.MOV (Assembly.GetRegister (assignee.Register), R32.ECX);
			else
				this.assembly.MOV (new DWordMemory (this.GetAddress (assignee)), R32.ECX);
		}
开发者ID:sharpos,项目名称:SharpOS,代码行数:76,代码来源:IR.cs

示例5: Mul

		/// <summary>
		/// Implements the 'mul' IL instruction, which pops two values, multiplies them, and pushes
		/// the result.
		/// </summary>
		private void Mul (IR.Instructions.Mul instruction)
		{
			IR.Operands.Register assignee = instruction.Def as IR.Operands.Register;
			IR.Operands.Register first = instruction.Use [0] as IR.Operands.Register;
			IR.Operands.Register second = instruction.Use [1] as IR.Operands.Register;

			switch (assignee.InternalType) {
			case InternalType.I:
			case InternalType.I4:
				if (first.IsRegisterSet)
					this.assembly.MOV (R32.EAX, Assembly.GetRegister (first.Register));
				else
					this.assembly.MOV (R32.EAX, new DWordMemory (this.GetAddress (first)));

				if (instruction.MulType == IR.Instructions.Mul.Type.Mul || instruction.MulType == IR.Instructions.Mul.Type.MulUnsignedWithOverflowCheck ) {
					if (second.IsRegisterSet)
						this.assembly.IMUL (R32.EAX, Assembly.GetRegister (second.Register));
					else
						this.assembly.IMUL (R32.EAX, new DWordMemory (this.GetAddress (second)));
				} else
					throw new NotImplementedEngineException ("Mul not supported for Mul.Type." + instruction.MulType);

				if (assignee.IsRegisterSet)
					this.assembly.MOV (Assembly.GetRegister (assignee.Register), R32.EAX);
				else
					this.assembly.MOV (new DWordMemory (this.GetAddress (assignee)), R32.EAX);

				break;

			case InternalType.I8:
				if (instruction.MulType == IR.Instructions.Mul.Type.Mul) {
					Memory firstMemory = this.GetAddress (first);
					DWordMemory firstHigh = new DWordMemory (firstMemory);
					firstHigh.DisplacementDelta = 4;
					DWordMemory firstLow = new DWordMemory (firstMemory);

					Memory secondMemory = this.GetAddress (second);
					DWordMemory secondHigh = new DWordMemory (secondMemory);
					secondHigh.DisplacementDelta = 4;
					DWordMemory secondLow = new DWordMemory (secondMemory);

					this.assembly.PUSH (secondHigh);
					this.assembly.PUSH (secondLow);
					this.assembly.PUSH (firstHigh);
					this.assembly.PUSH (firstLow);
					this.assembly.CALL (Assembly.HELPER_LMUL);
					this.assembly.ADD (R32.ESP, 16);

					Memory assigneeMemory = this.GetAddress (assignee);
					this.assembly.MOV (new DWordMemory (assigneeMemory), R32.EAX);
					assigneeMemory.DisplacementDelta = 4;
					this.assembly.MOV (new DWordMemory (assigneeMemory), R32.EDX);
				} else
					throw new NotImplementedEngineException ("Mul not supported for Mul.Type." + instruction.MulType);

				break;

			default:
				throw new NotImplementedEngineException ("Mul not supported for InternalType." + assignee.InternalType);
			}
		}
开发者ID:sharpos,项目名称:SharpOS,代码行数:65,代码来源:IR.cs

示例6: SHRD___CL

		/// <summary>
		/// SHRD mem32,reg32,CL
		/// </summary>
		public static void SHRD___CL (DWordMemory target, R32Type source)
		{
		}
开发者ID:sharpos,项目名称:SharpOS,代码行数:6,代码来源:Asm.cs

示例7: Convert

		/// <summary>
		/// Implements the 'conv' family of IL instructions, which handle conversions between primitive data types.
		/// </summary>
		private void Convert (IR.Instructions.Convert instruction)
		{
			IR.Operands.Register assignee = instruction.Def as IR.Operands.Register;
			IR.Operands.Register value = instruction.Use [0] as IR.Operands.Register;

			switch (value.InternalType) {
			case InternalType.M:
			case InternalType.I:
			case InternalType.U:
			case InternalType.I4:
				switch (instruction.ConvertType) {
				case SharpOS.AOT.IR.Instructions.Convert.Type.Conv_I1:
				case SharpOS.AOT.IR.Instructions.Convert.Type.Conv_U1:
					if (value.IsRegisterSet)
						this.assembly.MOV (R32.EAX, Assembly.GetRegister (value.Register));
					else
						this.assembly.MOV (R32.EAX, new DWordMemory (this.GetAddress (value)));

					this.assembly.AND (R32.EAX, (uint) 0xFF);

					if (assignee.IsRegisterSet)
						this.assembly.MOV (Assembly.GetRegister (assignee.Register), R32.EAX);
					else
						this.assembly.MOV (new DWordMemory (this.GetAddress (assignee)), R32.EAX);
					break;

				case SharpOS.AOT.IR.Instructions.Convert.Type.Conv_I2:
				case SharpOS.AOT.IR.Instructions.Convert.Type.Conv_U2:
					if (value.IsRegisterSet)
						this.assembly.MOV (R32.EAX, Assembly.GetRegister (value.Register));
					else
						this.assembly.MOV (R32.EAX, new DWordMemory (this.GetAddress (value)));

					this.assembly.AND (R32.EAX, (uint) 0xFFFF);

					if (assignee.IsRegisterSet)
						this.assembly.MOV (Assembly.GetRegister (assignee.Register), R32.EAX);
					else
						this.assembly.MOV (new DWordMemory (this.GetAddress (assignee)), R32.EAX);
					break;

				case SharpOS.AOT.IR.Instructions.Convert.Type.Conv_I:
				case SharpOS.AOT.IR.Instructions.Convert.Type.Conv_I4:
				case SharpOS.AOT.IR.Instructions.Convert.Type.Conv_U:
				case SharpOS.AOT.IR.Instructions.Convert.Type.Conv_U4:
					if (value.IsRegisterSet)
						this.assembly.MOV (R32.EAX, Assembly.GetRegister (value.Register));
					else
						this.assembly.MOV (R32.EAX, new DWordMemory (this.GetAddress (value)));

					if (assignee.IsRegisterSet)
						this.assembly.MOV (Assembly.GetRegister (assignee.Register), R32.EAX);
					else
						this.assembly.MOV (new DWordMemory (this.GetAddress (assignee)), R32.EAX);

					break;

				case SharpOS.AOT.IR.Instructions.Convert.Type.Conv_I8:
				case SharpOS.AOT.IR.Instructions.Convert.Type.Conv_U8:
					if (value.IsRegisterSet)
						this.assembly.MOV (R32.EAX, Assembly.GetRegister (value.Register));
					else
						this.assembly.MOV (R32.EAX, new DWordMemory (this.GetAddress (value)));

					Memory memory = this.GetAddress (assignee);
					DWordMemory low = new DWordMemory (memory);
					this.assembly.MOV (low, R32.EAX);

					DWordMemory high = new DWordMemory (memory);
					high.DisplacementDelta = 4;
					this.assembly.XOR (R32.EAX, R32.EAX);
					this.assembly.MOV (high, R32.EAX);

					break;

				default:
					throw new NotImplementedEngineException ("The conversion from " + value.InternalType +
						" to " + instruction.ConvertType + " is not yet supported.");
				}

				break;

			case InternalType.I8:
				switch (instruction.ConvertType) {
				case SharpOS.AOT.IR.Instructions.Convert.Type.Conv_I:
				case SharpOS.AOT.IR.Instructions.Convert.Type.Conv_U:
				case SharpOS.AOT.IR.Instructions.Convert.Type.Conv_I4:
				case SharpOS.AOT.IR.Instructions.Convert.Type.Conv_U4:
					this.assembly.MOV (R32.EAX, new DWordMemory (this.GetAddress (value)));

					if (assignee.IsRegisterSet)
						this.assembly.MOV (Assembly.GetRegister (assignee.Register), R32.EAX);
					else
						this.assembly.MOV (new DWordMemory (this.GetAddress (assignee)), R32.EAX);

					break;

//.........这里部分代码省略.........
开发者ID:sharpos,项目名称:SharpOS,代码行数:101,代码来源:IR.cs

示例8: MOV

		/// <summary>
		/// MOV segreg,mem32
		/// </summary>
		public static void MOV (SegType target, DWordMemory source)
		{
		}
开发者ID:sharpos,项目名称:SharpOS,代码行数:6,代码来源:Asm.cs

示例9: MUL

		/// <summary>
		/// MUL mem32
		/// </summary>
		public static void MUL (DWordMemory target)
		{
		}
开发者ID:sharpos,项目名称:SharpOS,代码行数:6,代码来源:Asm.cs

示例10: JMP_FAR

		/// <summary>
		/// JMP FAR mem32
		/// </summary>
		public static void JMP_FAR (DWordMemory target)
		{
		}
开发者ID:sharpos,项目名称:SharpOS,代码行数:6,代码来源:Asm.cs

示例11: INC

		/// <summary>
		/// INC mem32
		/// </summary>
		public static void INC (DWordMemory target)
		{
		}
开发者ID:sharpos,项目名称:SharpOS,代码行数:6,代码来源:Asm.cs

示例12: IMUL

		/// <summary>
		/// IMUL reg32,mem32,imm32
		/// </summary>
		public static void IMUL (R32Type target, DWordMemory source, UInt32 value)
		{
		}
开发者ID:sharpos,项目名称:SharpOS,代码行数:6,代码来源:Asm.cs

示例13: IDIV

		/// <summary>
		/// IDIV mem32
		/// </summary>
		public static void IDIV (DWordMemory target)
		{
		}
开发者ID:sharpos,项目名称:SharpOS,代码行数:6,代码来源:Asm.cs

示例14: BTC

		/// <summary>
		/// BTC mem32,imm8
		/// </summary>
		public static void BTC (DWordMemory target, Byte source)
		{
		}
开发者ID:sharpos,项目名称:SharpOS,代码行数:6,代码来源:Asm.cs

示例15: NOT

		/// <summary>
		/// NOT mem32
		/// </summary>
		public static void NOT (DWordMemory target)
		{
		}
开发者ID:sharpos,项目名称:SharpOS,代码行数:6,代码来源:Asm.cs


注:本文中的SharpOS.AOT.X86.DWordMemory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。