Beispiel #1
0
        /// <summary>
        /// Gets the memory.
        /// </summary>
        /// <param name="operand">The operand.</param>
        /// <param name="emit">if set to <c>true</c> [emit].</param>
        /// <returns></returns>
        private Memory GetMemory(Operand operand)
        {
            Memory address = null;

            if (operand is FieldOperand)
            {
                address = this.GetAddress(operand as FieldOperand);
            }
            else if (operand is Argument)
            {
                address = this.GetAddress(operand as Argument);
            }
            else if (operand is Local)
            {
                address = this.GetAddress(operand as Local);
            }
            else if (operand is IR.Operands.Register)
            {
                address = this.GetAddress(operand as IR.Operands.Register);
            }
            else
            {
                throw new NotImplementedEngineException("Wrong '" + operand.ToString() + "' Operand.");
            }

            if (operand.InternalType == InternalType.I1 ||
                operand.InternalType == InternalType.U1)
            {
                address = new ByteMemory(address);
            }
            else if (operand.InternalType == InternalType.I2 ||
                     operand.InternalType == InternalType.U2)
            {
                address = new WordMemory(address);
            }
            else if (operand.InternalType == InternalType.I4 ||
                     operand.InternalType == InternalType.U4 ||
                     operand.InternalType == InternalType.I ||
                     operand.InternalType == InternalType.U ||
                     operand.InternalType == InternalType.ValueType ||
                     operand.InternalType == InternalType.O ||
                     operand.InternalType == InternalType.M ||
                     operand.InternalType == InternalType.SZArray ||
                     operand.InternalType == InternalType.Array)
            {
                address = new DWordMemory(address);
            }
            else if (operand.InternalType == InternalType.I8 ||
                     operand.InternalType == InternalType.U8)
            {
                address = new DWordMemory(address);
            }
            else
            {
                throw new NotImplementedEngineException("'" + operand.InternalType + "' not supported.");
            }

            return(address);
        }
Beispiel #2
0
		/// <summary>
		/// MUL mem8
		/// </summary>
		public static void MUL (ByteMemory target)
		{
		}
Beispiel #3
0
		/// <summary>
		/// MOVZX reg32,mem8
		/// </summary>
		public static void MOVZX (R32Type target, ByteMemory source)
		{
		}
Beispiel #4
0
		/// <summary>
		/// MOVSX reg16,mem8
		/// </summary>
		public static void MOVSX (R16Type target, ByteMemory source)
		{
		}
Beispiel #5
0
		/// <summary>
		/// MOVZX reg32,mem8
		/// </summary>
		public void MOVZX (R32Type target, ByteMemory source)
		{
			this.instructions.Add (new Instruction (true, string.Empty, string.Empty, "MOVZX", target.ToString () + ", " + source.ToString (), source, null, target, null, new string [] { "o32", "0F", "B6", "/r" }));
		}
Beispiel #6
0
		/// <summary>
		/// SUB reg8,mem8
		/// </summary>
		public static void SUB (R8Type target, ByteMemory source)
		{
		}
Beispiel #7
0
		/// <summary>
		/// SHR mem8,imm8
		/// </summary>
		public static void SHR (ByteMemory target, Byte source)
		{
		}
Beispiel #8
0
		/// <summary>
		/// SETZ mem8
		/// </summary>
		public static void SETZ (ByteMemory target)
		{
		}
Beispiel #9
0
		/// <summary>
		/// ADC reg8,mem8
		/// </summary>
		public void ADC (R8Type target, ByteMemory source)
		{
			this.instructions.Add (new Instruction (true, string.Empty, string.Empty, "ADC", target.ToString () + ", " + source.ToString (), source, null, target, null, new string [] { "12", "/r" }));
		}
Beispiel #10
0
		/// <summary>
		/// XOR mem8,imm8
		/// </summary>
		public void XOR (ByteMemory target, Byte source)
		{
			this.instructions.Add (new Instruction (true, string.Empty, string.Empty, "XOR", target.ToString () + ", " + string.Format ("0x{0:x}", source), target, null, null, new UInt32 [] { source }, new string [] { "80", "/6", "ib" }));
		}
Beispiel #11
0
		/// <summary>
		/// XOR mem8,reg8
		/// </summary>
		public void XOR (ByteMemory target, R8Type source)
		{
			this.instructions.Add (new Instruction (true, string.Empty, string.Empty, "XOR", target.ToString () + ", " + source.ToString (), target, null, source, null, new string [] { "30", "/r" }));
		}
Beispiel #12
0
		/// <summary>
		/// SHR mem8,imm8
		/// </summary>
		public void SHR (ByteMemory target, Byte source)
		{
			if (source == 1)
				this.instructions.Add (new Instruction (true, string.Empty, string.Empty, "SHR__1", target.ToString () + ", " + "1", target, null, null, null, new string [] { "D0", "/5" }));
			else {
				this.instructions.Add (new Instruction (true, string.Empty, string.Empty, "SHR", target.ToString () + ", " + string.Format ("0x{0:x}", source), target, null, null, new UInt32 [] { source }, new string [] { "C0", "/5", "ib" }));
			}
		}
Beispiel #13
0
		/// <summary>
		/// SHR mem8,CL
		/// </summary>
		public void SHR__CL (ByteMemory target)
		{
			this.instructions.Add (new Instruction (true, string.Empty, string.Empty, "SHR__CL", target.ToString () + ", " + "CL", target, null, null, null, new string [] { "D2", "/5" }));
		}
Beispiel #14
0
		/// <summary>
		/// SETZ mem8
		/// </summary>
		public void SETZ (ByteMemory target)
		{
			this.instructions.Add (new Instruction (true, string.Empty, string.Empty, "SETZ", target.ToString (), target, null, null, null, new string [] { "0F", "94", "/0" }));
		}
Beispiel #15
0
		/// <summary>
		/// NOT mem8
		/// </summary>
		public void NOT (ByteMemory target)
		{
			this.instructions.Add (new Instruction (true, string.Empty, string.Empty, "NOT", target.ToString (), target, null, null, null, new string [] { "F6", "/2" }));
		}
Beispiel #16
0
		/// <summary>
		/// NOT mem8
		/// </summary>
		public static void NOT (ByteMemory target)
		{
		}
Beispiel #17
0
		/// <summary>
		/// ROL mem8,CL
		/// </summary>
		public static void ROL__CL (ByteMemory target)
		{
		}
Beispiel #18
0
		/// <summary>
		/// TEST mem8,imm8
		/// </summary>
		public static void TEST (ByteMemory target, Byte source)
		{
		}
Beispiel #19
0
		/// <summary>
		/// SHR mem8,CL
		/// </summary>
		public static void SHR__CL (ByteMemory target)
		{
		}
Beispiel #20
0
		/// <summary>
		/// CMPXCHG mem8,reg8
		/// </summary>
		public static void CMPXCHG (ByteMemory target, R8Type source)
		{
		}
Beispiel #21
0
		/// <summary>
		/// SUB mem8,reg8
		/// </summary>
		public static void SUB (ByteMemory target, R8Type source)
		{
		}
Beispiel #22
0
		/// <summary>
		/// IDIV mem8
		/// </summary>
		public static void IDIV (ByteMemory target)
		{
		}
Beispiel #23
0
		/// <summary>
		/// INC mem8
		/// </summary>
		public static void INC (ByteMemory target)
		{
		}
Beispiel #24
0
		/// <summary>
		/// INC mem8
		/// </summary>
		public void INC (ByteMemory target)
		{
			this.instructions.Add (new Instruction (true, string.Empty, string.Empty, "INC", target.ToString (), target, null, null, null, new string [] { "FE", "/0" }));
		}