コード例 #1
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a    = LoadValue(cpu, instruction.Operand1);
            uint b    = LoadValue(cpu, instruction.Operand2);
            int  size = instruction.Operand1.Size;

            int shift = ((int)b) & 0x1F;

            if (shift == 0)
            {
                return;                 // no changes
            }
            // TODO: for sizes other than 32
            Debug.Assert(size == 32);

            uint u = (a >> 1);

            shift--;

            if (cpu.EFLAGS.Carry)
            {
                u = u | ((uint)1 << (size - 1));
            }

            if (shift != 0)
            {
                u = u >> shift;
                u = u | (a << (size - shift));
            }

            StoreValue(cpu, instruction.Operand1, (uint)u, size);

            cpu.EFLAGS.Overflow = cpu.EFLAGS.Carry ^ IsSign(a, size);
            cpu.EFLAGS.Carry    = ((a >> (shift - 1)) & 0x1) == 1;
        }
コード例 #2
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var a    = LoadFloatValue(cpu, instruction.Operand2, instruction.Size);
            int size = instruction.Size;

            StoreFloatValue(cpu, instruction.Operand1, a, size);
        }
コード例 #3
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var  a    = LoadFloatValue(cpu, instruction.Operand1, instruction.Size);
            uint p    = LoadValue(cpu, instruction.Operand2);
            int  size = instruction.Size;

            float r;

            if ((p & 0x3) == 0x3)
            {
                r = (float)Math.Truncate(a.LowF);
            }
            else if ((p & 0x2) == 0x2)
            {
                r = (float)Math.Ceiling(a.LowF);
            }
            else if ((p & 0x1) == 0x1)
            {
                r = (float)Math.Floor(a.LowF);
            }
            else
            {
                r = (float)Math.Round(a.LowF);
            }

            StoreFloatValue(cpu, instruction.Operand1, r, size);
        }
コード例 #4
0
ファイル: Roundss.cs プロジェクト: pacificIT/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var a = LoadFloatValue(cpu, instruction.Operand1, instruction.Size);
            uint p = LoadValue(cpu, instruction.Operand2);
            int size = instruction.Size;

            float r;
            if ((p & 0x3) == 0x3)
            {
                r = (float)Math.Truncate(a.LowF);
            }
            else if ((p & 0x2) == 0x2)
            {
                r = (float)Math.Ceiling(a.LowF);
            }
            else if ((p & 0x1) == 0x1)
            {
                r = (float)Math.Floor(a.LowF);
            }
            else
            {
                r = (float)Math.Round(a.LowF);
            }

            StoreFloatValue(cpu, instruction.Operand1, r, size);
        }
コード例 #5
0
ファイル: Setle.cs プロジェクト: tea/MOSA-Project
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (cpu.EFLAGS.Sign != cpu.EFLAGS.Overflow)
     {
         StoreValue(cpu, instruction.Operand1, 1, 8);
     }
 }
コード例 #6
0
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (cpu.EFLAGS.Parity)
     {
         cpu.EIP.Value = ResolveBranch(cpu, instruction.Operand1);
     }
 }
コード例 #7
0
ファイル: Fld.cs プロジェクト: mwoodruff1/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var r    = LoadFloatValue(cpu, instruction.Operand1, instruction.Operand1.Size);
            int size = instruction.Operand1.Size;

            cpu.ST0.Value = r;
        }
コード例 #8
0
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (!cpu.EFLAGS.Carry && !cpu.EFLAGS.Zero)
     {
         cpu.EIP.Value = ResolveBranch(cpu, instruction.Operand1);
     }
 }
コード例 #9
0
ファイル: Jl.cs プロジェクト: pacificIT/MOSA-Project
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (cpu.EFLAGS.Sign != cpu.EFLAGS.Overflow)
     {
         cpu.EIP.Value = ResolveBranch(cpu, instruction.Operand1);
     }
 }
コード例 #10
0
ファイル: Lea.cs プロジェクト: pacificIT/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint address = GetAddress(cpu, instruction.Operand2);
            int size = instruction.Operand1.Size;

            StoreValue(cpu, instruction.Operand1, address, size);
        }
コード例 #11
0
ファイル: Sar.cs プロジェクト: Boddlnagg/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a = LoadValue(cpu, instruction.Operand1);
            uint b = LoadValue(cpu, instruction.Operand2);
            int size = instruction.Operand1.Size;

            int shift = ((int)b) & 0x1F;

            if (shift == 0)
                return; // no changes

            bool sign = IsSign(a, size);
            uint u = a >> shift;

            if (sign)
            {
                uint m = (uint.MaxValue << (int)(32 - shift));
                u = u | m;
            }

            StoreValue(cpu, instruction.Operand1, (uint)u, size);

            UpdateFlags(cpu, size, (long)u, u, true, true, false, false, false);

            cpu.EFLAGS.Overflow = (shift != 1);
            cpu.EFLAGS.Carry = ((a >> (shift - 1)) & 0x1) == 1;
            cpu.EFLAGS.Sign = sign;
        }
コード例 #12
0
ファイル: Cmovcc.cs プロジェクト: mwoodruff1/MOSA-Project
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (!cpu.EFLAGS.Carry && !cpu.EFLAGS.Zero)
     {
         base.Execute(cpu, instruction);
     }
 }
コード例 #13
0
ファイル: Sar.cs プロジェクト: mwoodruff1/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a    = LoadValue(cpu, instruction.Operand1);
            uint b    = LoadValue(cpu, instruction.Operand2);
            int  size = instruction.Operand1.Size;

            int shift = ((int)b) & 0x1F;

            if (shift == 0)
            {
                return;                 // no changes
            }
            bool sign = IsSign(a, size);
            uint u    = a >> shift;

            if (sign)
            {
                uint m = (uint.MaxValue << 32 - shift);
                u = u | m;
            }

            StoreValue(cpu, instruction.Operand1, u, size);

            UpdateFlags(cpu, size, u, u, true, true, false, false, false);

            cpu.EFLAGS.Overflow = (shift != 1);
            cpu.EFLAGS.Carry    = ((a >> (shift - 1)) & 0x1) == 1;
            cpu.EFLAGS.Sign     = sign;
        }
コード例 #14
0
ファイル: Jnp.cs プロジェクト: yonglehou/MOSA-Project
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			if (!cpu.EFLAGS.Parity)
			{
				cpu.EIP.Value = ResolveBranch(cpu, instruction.Operand1);
			}
		}
コード例 #15
0
ファイル: Ucomiss.cs プロジェクト: yonglehou/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var a    = LoadFloatValue(cpu, instruction.Operand1, instruction.Size).LowF;
            var b    = LoadFloatValue(cpu, instruction.Operand2, instruction.Size).LowF;
            int size = instruction.Size;

            if (float.IsNaN(a) || float.IsNaN(b))
            {
                cpu.EFLAGS.Zero   = true;
                cpu.EFLAGS.Parity = true;
                cpu.EFLAGS.Carry  = true;
            }
            else if (a == b)
            {
                cpu.EFLAGS.Zero   = true;
                cpu.EFLAGS.Parity = false;
                cpu.EFLAGS.Carry  = false;
            }
            else if (a > b)
            {
                cpu.EFLAGS.Zero   = false;
                cpu.EFLAGS.Parity = false;
                cpu.EFLAGS.Carry  = false;
            }
            else
            {
                cpu.EFLAGS.Zero   = false;
                cpu.EFLAGS.Parity = false;
                cpu.EFLAGS.Carry  = true;
            }

            cpu.EFLAGS.Overflow = false;
            cpu.EFLAGS.Adjust   = false;
            cpu.EFLAGS.Sign     = false;
        }
コード例 #16
0
ファイル: Setnz.cs プロジェクト: tea/MOSA-Project
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (!cpu.EFLAGS.Zero)
     {
         StoreValue(cpu, instruction.Operand1, 1, 8);
     }
 }
コード例 #17
0
ファイル: Cvtss2sd.cs プロジェクト: yonglehou/MOSA-Project
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			var a = LoadFloatValue(cpu, instruction.Operand2, instruction.Operand1.Size);
			int size = instruction.Operand1.Size;

			StoreFloatValue(cpu, instruction.Operand1, a, size);
		}
コード例 #18
0
ファイル: Cdq.cs プロジェクト: yonglehou/MOSA-Project
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			if (IsSign(cpu.EAX.Value))
				cpu.EDX.Value = ~(uint)0;
			else
				cpu.EDX.Value = 0;
		}
コード例 #19
0
ファイル: Movzx.cs プロジェクト: yonglehou/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a    = LoadValue(cpu, instruction.Operand2);
            int  size = instruction.Operand1.Size;

            StoreValue(cpu, instruction.Operand1, a, size);
        }
コード例 #20
0
ファイル: Rcl.cs プロジェクト: yonglehou/MOSA-Project
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			uint a = LoadValue(cpu, instruction.Operand1);
			uint b = LoadValue(cpu, instruction.Operand2);
			int size = instruction.Operand1.Size;

			int shift = ((int)b) & 0x1F;

			if (shift == 0)
				return; // no changes

			// TODO: for sizes other than 32
			Debug.Assert(size == 32);

			uint u = (a << 1);

			if (cpu.EFLAGS.Carry)
				u = u | 0x1;

			shift--;

			u = u << shift;

			u = u | (a >> (size - shift));

			StoreValue(cpu, instruction.Operand1, (uint)u, size);

			cpu.EFLAGS.Overflow = cpu.EFLAGS.Carry ^ IsSign(a, size);
			cpu.EFLAGS.Carry = ((a >> (size - shift)) & 0x1) == 1;
		}
コード例 #21
0
ファイル: Lea.cs プロジェクト: mwoodruff1/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint address = GetAddress(cpu, instruction.Operand2);
            int  size    = instruction.Operand1.Size;

            StoreValue(cpu, instruction.Operand1, address, size);
        }
コード例 #22
0
ファイル: Movzx.cs プロジェクト: yonglehou/MOSA-Project
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			uint a = LoadValue(cpu, instruction.Operand2);
			int size = instruction.Operand1.Size;

			StoreValue(cpu, instruction.Operand1, a, size);
		}
コード例 #23
0
ファイル: Cmovcc.cs プロジェクト: mwoodruff1/MOSA-Project
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (cpu.EFLAGS.Sign)
     {
         base.Execute(cpu, instruction);
     }
 }
コード例 #24
0
ファイル: Jbe.cs プロジェクト: yonglehou/MOSA-Project
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			if (cpu.EFLAGS.Carry || cpu.EFLAGS.Zero)
			{
				cpu.EIP.Value = ResolveBranch(cpu, instruction.Operand1);
			}
		}
コード例 #25
0
ファイル: Shl.cs プロジェクト: mwoodruff1/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a    = LoadValue(cpu, instruction.Operand1);
            uint b    = LoadValue(cpu, instruction.Operand2);
            int  size = instruction.Operand1.Size;

            int shift = ((int)b) & 0x1F;

            if (shift == 0)
            {
                return;                 // no changes
            }
            uint u    = a << shift;
            bool sign = IsSign(a, size);

            //if (cpu.FLAGS.Carry)
            //{
            //	u = u | 0x1;
            //}

            StoreValue(cpu, instruction.Operand1, u, size);

            UpdateFlags(cpu, size, u, u, true, true, true, false, false);

            cpu.EFLAGS.Overflow = sign ^ IsSign(u, size);
            cpu.EFLAGS.Carry    = sign;
        }
コード例 #26
0
ファイル: Cvtsi2ss.cs プロジェクト: modulexcite/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            int a    = (int)LoadValue(cpu, instruction.Operand2);
            int size = instruction.Operand1.Size;

            StoreFloatValue(cpu, instruction.Operand1, (float)a, size);
        }
コード例 #27
0
ファイル: Jle.cs プロジェクト: yonglehou/MOSA-Project
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (cpu.EFLAGS.Zero || cpu.EFLAGS.Sign != cpu.EFLAGS.Overflow)
     {
         cpu.EIP.Value = ResolveBranch(cpu, instruction.Operand1);
     }
 }
コード例 #28
0
ファイル: Cmovcc.cs プロジェクト: mwoodruff1/MOSA-Project
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (!cpu.EFLAGS.Zero && cpu.EFLAGS.Sign != cpu.EFLAGS.Overflow)
     {
         base.Execute(cpu, instruction);
     }
 }
コード例 #29
0
ファイル: Fld.cs プロジェクト: yonglehou/MOSA-Project
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			var r = LoadFloatValue(cpu, instruction.Operand1, instruction.Operand1.Size);
			int size = instruction.Operand1.Size;

			cpu.ST0.Value = r;
		}
コード例 #30
0
ファイル: Comisd.cs プロジェクト: Boddlnagg/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            double a = LoadFloatValue(cpu, instruction.Operand1);
            double b = LoadFloatValue(cpu, instruction.Operand2);
            int size = instruction.Operand1.Size;

            if (double.IsNaN(a) || double.IsNaN(b))
            {
                cpu.EFLAGS.Zero = true;
                cpu.EFLAGS.Parity = true;
                cpu.EFLAGS.Carry = true;
            }
            else if (a == b)
            {
                cpu.EFLAGS.Zero = true;
                cpu.EFLAGS.Parity = false;
                cpu.EFLAGS.Carry = false;
            }
            else if (a > b)
            {
                cpu.EFLAGS.Zero = false;
                cpu.EFLAGS.Parity = false;
                cpu.EFLAGS.Carry = false;
            }
            else
            {
                cpu.EFLAGS.Zero = false;
                cpu.EFLAGS.Parity = false;
                cpu.EFLAGS.Carry = true;
            }
        }
コード例 #31
0
ファイル: Shl.cs プロジェクト: Profi-Concept/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a = LoadValue(cpu, instruction.Operand1);
            uint b = LoadValue(cpu, instruction.Operand2);
            int size = instruction.Operand1.Size;

            int shift = ((int)b) & 0x1F;

            if (shift == 0)
                return; // no changes

            uint u = a << shift;
            bool sign = IsSign(a, size);

            //if (cpu.FLAGS.Carry)
            //{
            //	u = u | 0x1;
            //}

            StoreValue(cpu, instruction.Operand1, u, size);

            UpdateFlags(cpu, size, u, u, true, true, true, false, false);

            cpu.EFLAGS.Overflow = sign ^ IsSign(u, size);
            cpu.EFLAGS.Carry = sign;
        }
コード例 #32
0
ファイル: Ucomisd.cs プロジェクト: yonglehou/MOSA-Project
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			var a = LoadFloatValue(cpu, instruction.Operand1, instruction.Size).Low;
			var b = LoadFloatValue(cpu, instruction.Operand2, instruction.Size).Low;
			int size = instruction.Size;

			if (double.IsNaN(a) || double.IsNaN(b))
			{
				cpu.EFLAGS.Zero = true;
				cpu.EFLAGS.Parity = true;
				cpu.EFLAGS.Carry = true;
			}
			else if (a == b)
			{
				cpu.EFLAGS.Zero = true;
				cpu.EFLAGS.Parity = false;
				cpu.EFLAGS.Carry = false;
			}
			else if (a > b)
			{
				cpu.EFLAGS.Zero = false;
				cpu.EFLAGS.Parity = false;
				cpu.EFLAGS.Carry = false;
			}
			else
			{
				cpu.EFLAGS.Zero = false;
				cpu.EFLAGS.Parity = false;
				cpu.EFLAGS.Carry = true;
			}

			cpu.EFLAGS.Overflow = false;
			cpu.EFLAGS.Adjust = false;
			cpu.EFLAGS.Sign = false;
		}
コード例 #33
0
ファイル: Cvtsi2sd.cs プロジェクト: yonglehou/MOSA-Project
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			int a = (int)LoadValue(cpu, instruction.Operand2);
			int size = instruction.Operand1.Size;

			StoreFloatValue(cpu, instruction.Operand1, (double)a, size);
		}
コード例 #34
0
ファイル: Popfd.cs プロジェクト: mwoodruff1/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            int size = 32;

            cpu.EFLAGS.Value = Read(cpu, cpu.ESP.Value, size);

            cpu.ESP.Value = (uint)(cpu.ESP.Value + (size / 8));
        }
コード例 #35
0
ファイル: Ret.cs プロジェクト: yonglehou/MOSA-Project
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			int size = 32;
			uint value = Read(cpu, cpu.ESP.Value, size);

			cpu.ESP.Value = (uint)(cpu.ESP.Value + (size / 8));
			cpu.EIP.Value = value;
		}
コード例 #36
0
ファイル: Cvttss2si.cs プロジェクト: pacificIT/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var a = LoadFloatValue(cpu, instruction.Operand2, instruction.Operand2.Size);
            int size = instruction.Operand1.Size;

            uint r = (uint)a.LowF;
            StoreValue(cpu, instruction.Operand1, r, size);
        }
コード例 #37
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a    = LoadValue(cpu, instruction.Operand2);
            int  size = instruction.Operand1.Size;

            int s = SignExtend(a, instruction.Operand2.Size, size);

            StoreValue(cpu, instruction.Operand1, (uint)s, size);
        }
コード例 #38
0
ファイル: Movsx.cs プロジェクト: pacificIT/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a = LoadValue(cpu, instruction.Operand2);
            int size = instruction.Operand1.Size;

            int s = SignExtend(a, instruction.Operand2.Size, size);

            StoreValue(cpu, instruction.Operand1, (uint)s, size);
        }
コード例 #39
0
ファイル: Pop.cs プロジェクト: mwoodruff1/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            int  size  = instruction.Operand1.Size;
            uint value = Read(cpu, cpu.ESP.Value, size);

            (instruction.Operand1.Register as GeneralPurposeRegister).Value = value;

            cpu.ESP.Value = (uint)(cpu.ESP.Value + (size / 8));
        }
コード例 #40
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var a    = LoadFloatValue(cpu, instruction.Operand2, instruction.Operand2.Size);
            int size = instruction.Operand1.Size;

            uint r = (uint)a.Low;

            StoreValue(cpu, instruction.Operand1, r, size);
        }
コード例 #41
0
ファイル: Push.cs プロジェクト: pacificIT/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a = LoadValue(cpu, instruction.Operand1);
            int size = instruction.Operand1.Size;

            Write(cpu, (uint)(cpu.ESP.Value - (size / 8)), a, size);

            cpu.ESP.Value = (uint)(cpu.ESP.Value - (size / 8));
        }
コード例 #42
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a    = LoadValue(cpu, instruction.Operand1);
            int  size = instruction.Operand1.Size;

            Write(cpu, (uint)(cpu.ESP.Value - (size / 8)), a, size);

            cpu.ESP.Value = (uint)(cpu.ESP.Value - (size / 8));
        }
コード例 #43
0
ファイル: FarJmp.cs プロジェクト: pacificIT/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            if (instruction.Operand1 == null)
                return;

            uint v1 = LoadValue(cpu, instruction.Operand1);

            cpu.EIP.Value = (uint)(cpu.EIP.Value + (int)v1);
        }
コード例 #44
0
ファイル: Pop.cs プロジェクト: pacificIT/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            int size = instruction.Operand1.Size;
            uint value = Read(cpu, cpu.ESP.Value, size);

            (instruction.Operand1.Register as GeneralPurposeRegister).Value = value;

            cpu.ESP.Value = (uint)(cpu.ESP.Value + (size / 8));
        }
コード例 #45
0
ファイル: Subsd.cs プロジェクト: Boddlnagg/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            double a = LoadFloatValue(cpu, instruction.Operand1);
            double b = LoadFloatValue(cpu, instruction.Operand2);
            int size = instruction.Operand1.Size;

            double r = a - b;

            StoreFloatValue(cpu, instruction.Operand1, r, size);
        }
コード例 #46
0
ファイル: Addsd.cs プロジェクト: yonglehou/MOSA-Project
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			var a = LoadFloatValue(cpu, instruction.Operand1, instruction.Size);
			var b = LoadFloatValue(cpu, instruction.Operand2, instruction.Size);
			int size = instruction.Size;

			double r = a.Low + b.Low;

			StoreFloatValue(cpu, instruction.Operand1, r, size);
		}
コード例 #47
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            int size = instruction.Operand1.Size;

            uint r = cpu.EFLAGS.Value & 0x00FCFFFF;

            Write(cpu, cpu.ESP.Value, r, size);

            cpu.ESP.Value = (uint)(cpu.ESP.Value - (size / 8));
        }
コード例 #48
0
ファイル: Addss.cs プロジェクト: mwoodruff1/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var a    = LoadFloatValue(cpu, instruction.Operand1, instruction.Size);
            var b    = LoadFloatValue(cpu, instruction.Operand2, instruction.Size);
            int size = instruction.Size;

            float r = a.LowF + b.LowF;

            StoreFloatValue(cpu, instruction.Operand1, r, size);
        }
コード例 #49
0
ファイル: Pushfd.cs プロジェクト: yonglehou/MOSA-Project
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			int size = instruction.Operand1.Size;

			uint r = cpu.EFLAGS.Value & 0x00FCFFFF;

			Write(cpu, cpu.ESP.Value, r, size);

			cpu.ESP.Value = (uint)(cpu.ESP.Value - (size / 8));
		}
コード例 #50
0
ファイル: Pxor.cs プロジェクト: yonglehou/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var a    = LoadFloatValue(cpu, instruction.Operand1, instruction.Size);
            var b    = LoadFloatValue(cpu, instruction.Operand2, instruction.Size);
            int size = instruction.Size;

            a.ULow  = a.ULow ^ b.ULow;
            a.UHigh = a.UHigh ^ b.UHigh;

            StoreFloatValue(cpu, instruction.Operand1, a, size);
        }
コード例 #51
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            // Pop Order: EIP, CS, FLAGS
            int size = 32;

            cpu.EIP.Value = Read(cpu, cpu.ESP.Value - (8 * 1), size);
            // Skip CS
            cpu.EFLAGS.Value = Read(cpu, cpu.ESP.Value - (8 * 3), size);

            cpu.ESP.Value = (uint)(cpu.ESP.Value + (size * 3 / 8));
        }
コード例 #52
0
ファイル: Iretd.cs プロジェクト: yonglehou/MOSA-Project
		public override void Execute(CPUx86 cpu, SimInstruction instruction)
		{
			// Pop Order: EIP, CS, FLAGS
			int size = 32;

			cpu.EIP.Value = Read(cpu, cpu.ESP.Value - (8 * 1), size);
			// Skip CS
			cpu.EFLAGS.Value = Read(cpu, cpu.ESP.Value - (8 * 3), size);

			cpu.ESP.Value = (uint)(cpu.ESP.Value + (size * 3 / 8));
		}
コード例 #53
0
ファイル: Pxor.cs プロジェクト: pacificIT/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            var a = LoadFloatValue(cpu, instruction.Operand1, instruction.Size);
            var b = LoadFloatValue(cpu, instruction.Operand2, instruction.Size);
            int size = instruction.Size;

            a.ULow = a.ULow ^ b.ULow;
            a.UHigh = a.UHigh ^ b.UHigh;

            StoreFloatValue(cpu, instruction.Operand1, a, size);
        }
コード例 #54
0
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            if (instruction.Operand1 == null)
            {
                return;
            }

            uint v1 = LoadValue(cpu, instruction.Operand1);

            cpu.EIP.Value = (uint)(cpu.EIP.Value + (int)v1);
        }
コード例 #55
0
ファイル: Setcc.cs プロジェクト: yonglehou/MOSA-Project
 /// <summary>
 /// Sets the Operand value to 1 if the condition is met, otherwise set to 0.
 /// </summary>
 /// <param name="cpu"></param>
 /// <param name="instruction"></param>
 /// <param name="conditionMet">Boolean indicating if the condition was met</param>
 public void SetValue(CPUx86 cpu, SimInstruction instruction, bool conditionMet)
 {
     if (conditionMet)
     {
         StoreValue(cpu, instruction.Operand1, 1, 8);
     }
     else
     {
         StoreValue(cpu, instruction.Operand1, 0, 8);
     }
 }
コード例 #56
0
 public override void Execute(CPUx86 cpu, SimInstruction instruction)
 {
     if (IsSign(cpu.EAX.Value))
     {
         cpu.EDX.Value = ~(uint)0;
     }
     else
     {
         cpu.EDX.Value = 0;
     }
 }
コード例 #57
0
 /// <summary>
 /// Sets the Operand value to 1 if the condition is met, otherwise set to 0.
 /// </summary>
 /// <param name="cpu"></param>
 /// <param name="instruction"></param>
 /// <param name="conditionMet">Boolean indicating if the condition was met</param>
 public void SetValue(CPUx86 cpu, SimInstruction instruction, bool conditionMet)
 {
     if (conditionMet)
     {
         StoreValue(cpu, instruction.Operand1, 1, 8);
     }
     else
     {
         StoreValue(cpu, instruction.Operand1, 0, 8);
     }
 }
コード例 #58
0
ファイル: Neg.cs プロジェクト: yonglehou/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a    = LoadValue(cpu, instruction.Operand1);
            int  size = instruction.Operand1.Size;

            uint u = (uint)(0 - a);

            StoreValue(cpu, instruction.Operand1, (uint)u, size);

            UpdateFlags(cpu, size, (long)u, u, true, true, true, false, false);

            cpu.EFLAGS.Carry = !cpu.EFLAGS.Zero;
        }
コード例 #59
0
        protected void Execute3(CPUx86 cpu, SimInstruction instruction)
        {
            long v1   = LoadValue(cpu, instruction.Operand2);
            long v2   = LoadValue(cpu, instruction.Operand3);
            int  size = instruction.Operand1.Size;

            long r = v1 * v2;

            StoreValue(cpu, instruction.Operand1, (uint)r, size);

            cpu.EFLAGS.Overflow = (((ulong)r) >> 32) != 0;
            cpu.EFLAGS.Carry    = cpu.EFLAGS.Overflow;
        }
コード例 #60
0
ファイル: Out.cs プロジェクト: Boddlnagg/MOSA-Project
        public override void Execute(CPUx86 cpu, SimInstruction instruction)
        {
            uint a = LoadValue(cpu, instruction.Operand1);
            uint b = LoadValue(cpu, instruction.Operand2);
            int size = instruction.Operand2.Size;

            if (size == 8)
                cpu.Write8Port(a, (byte)b);
            else if (size == 16)
                cpu.Write16Port(a, (ushort)b);
            else if (size == 32)
                cpu.Write32Port(a, b);
        }