Exemplo n.º 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);
        }
Exemplo n.º 2
0
		/// <summary>
		/// MUL mem8
		/// </summary>
		public static void MUL (ByteMemory target)
		{
		}
Exemplo n.º 3
0
		/// <summary>
		/// MOVZX reg32,mem8
		/// </summary>
		public static void MOVZX (R32Type target, ByteMemory source)
		{
		}
Exemplo n.º 4
0
		/// <summary>
		/// MOVSX reg16,mem8
		/// </summary>
		public static void MOVSX (R16Type target, ByteMemory source)
		{
		}
Exemplo n.º 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" }));
		}
Exemplo n.º 6
0
		/// <summary>
		/// SUB reg8,mem8
		/// </summary>
		public static void SUB (R8Type target, ByteMemory source)
		{
		}
Exemplo n.º 7
0
		/// <summary>
		/// SHR mem8,imm8
		/// </summary>
		public static void SHR (ByteMemory target, Byte source)
		{
		}
Exemplo n.º 8
0
		/// <summary>
		/// SETZ mem8
		/// </summary>
		public static void SETZ (ByteMemory target)
		{
		}
Exemplo n.º 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" }));
		}
Exemplo n.º 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" }));
		}
Exemplo n.º 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" }));
		}
Exemplo n.º 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" }));
			}
		}
Exemplo n.º 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" }));
		}
Exemplo n.º 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" }));
		}
Exemplo n.º 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" }));
		}
Exemplo n.º 16
0
		/// <summary>
		/// NOT mem8
		/// </summary>
		public static void NOT (ByteMemory target)
		{
		}
Exemplo n.º 17
0
		/// <summary>
		/// ROL mem8,CL
		/// </summary>
		public static void ROL__CL (ByteMemory target)
		{
		}
Exemplo n.º 18
0
		/// <summary>
		/// TEST mem8,imm8
		/// </summary>
		public static void TEST (ByteMemory target, Byte source)
		{
		}
Exemplo n.º 19
0
		/// <summary>
		/// SHR mem8,CL
		/// </summary>
		public static void SHR__CL (ByteMemory target)
		{
		}
Exemplo n.º 20
0
		/// <summary>
		/// CMPXCHG mem8,reg8
		/// </summary>
		public static void CMPXCHG (ByteMemory target, R8Type source)
		{
		}
Exemplo n.º 21
0
		/// <summary>
		/// SUB mem8,reg8
		/// </summary>
		public static void SUB (ByteMemory target, R8Type source)
		{
		}
Exemplo n.º 22
0
		/// <summary>
		/// IDIV mem8
		/// </summary>
		public static void IDIV (ByteMemory target)
		{
		}
Exemplo n.º 23
0
		/// <summary>
		/// INC mem8
		/// </summary>
		public static void INC (ByteMemory target)
		{
		}
Exemplo n.º 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" }));
		}