Esempio n. 1
0
 public void EvGv()
 {
     code = new Byte[] { 0x89, 0x00 };
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.EvGv, encoding);
 }
Esempio n. 2
0
 public void EvGv()
 {
     code = new Byte[] {0x89, 0x00};
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.EvGv, encoding);
 }
Esempio n. 3
0
 public void None()
 {
     code = new Byte[] { 0x90 };
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.None, encoding);
     Assert.AreEqual(StackEffect.None, opcode.GetStackEffectFor(code));
 }
Esempio n. 4
0
 public void rAxIv()
 {
     code = new Byte[] { 0xb8, 0x00, 0x00, 0x00, 0x00 };
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.rAxIv, encoding);
     Assert.AreEqual(RegisterName.EAX, opcode.GetDestinationRegisterFor(code));
 }
Esempio n. 5
0
 public void Halt()
 {
     code = new Byte[] { 0xf4 };
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.None, encoding);
     Assert.AreEqual(StackEffect.None, opcode.GetStackEffectFor(code));
     Assert.IsTrue(opcode.TerminatesFunction(code));
 }
Esempio n. 6
0
 public void PushrBX()
 {
     code     = new Byte[] { 0x53 };
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.rBX, encoding);
     Assert.AreEqual(StackEffect.Push, opcode.GetStackEffectFor(code));
     Assert.AreEqual(RegisterName.None, opcode.GetDestinationRegisterFor(code));
     Assert.AreEqual(RegisterName.EBX, opcode.GetSourceRegisterFor(code));
 }
Esempio n. 7
0
 public void EbIb()
 {
     const byte IMMEDIATE = 0;
     code = new Byte[] {0xc6, 0x40, 0x10, IMMEDIATE};
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.EbIb, encoding);
     Assert.AreEqual(IMMEDIATE, opcode.GetImmediateFor(code));
 }
Esempio n. 8
0
        public void EvGvSub()
        {
            code = new Byte[] {0x29, 0xc4};
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.EvGv, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);
            Assert.AreEqual(OperatorEffect.Sub, operatorEffect);
        }
Esempio n. 9
0
 public void EvIz()
 {
     code = new Byte[] { 0xc7, 0x04, 0x24, 0x10, 0x00, 0x00, 0x00 };
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.EvIz, encoding);
     Assert.IsTrue(opcode.HasDestinationRegister(code));
     Assert.AreEqual(RegisterName.ESP, opcode.GetDestinationRegisterFor(code));
     Assert.AreEqual(0x10, opcode.GetImmediateFor(code));
 }
Esempio n. 10
0
 public void GvEv()
 {
     // mov eax, [eax]
     code = new Byte[] { 0x8b, 0x00 };
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.GvEv, encoding);
     Assert.AreEqual(RegisterName.EAX, opcode.GetSourceRegisterFor(code));
     Assert.AreEqual(RegisterName.EAX, opcode.GetDestinationRegisterFor(code));
 }
Esempio n. 11
0
 public void GvEvDword()
 {
     // mov eax, [0x11223344]
     code = new Byte[] { 0x8b, 0x05, 0x44, 0x33, 0x22, 0x11 };
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.GvEv, encoding);
     Assert.AreEqual(RegisterName.None, opcode.GetSourceRegisterFor(code));
     Assert.AreEqual(RegisterName.EAX, opcode.GetDestinationRegisterFor(code));
 }
Esempio n. 12
0
 public void GvEvSIB()
 {
     // mov eax, [base_register+scale_register*scaler
     code = new Byte[] { 0x8b, 0x04, 0x24 };
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.GvEv, encoding);
     Assert.AreEqual(RegisterName.None, opcode.GetSourceRegisterFor(code));
     Assert.AreEqual(RegisterName.EAX, opcode.GetDestinationRegisterFor(code));
 }
Esempio n. 13
0
 public void PushrDX()
 {
     code     = new Byte[] { 0x52 };
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.rDX, encoding);
     Assert.AreEqual(StackEffect.Push, opcode.GetStackEffectFor(code));
     Assert.IsTrue(opcode.HasSourceRegister(code));
     Assert.IsFalse(opcode.HasDestinationRegister(code));
     Assert.AreEqual(RegisterName.EDX, opcode.GetSourceRegisterFor(code));
 }
Esempio n. 14
0
        public void EbIb()
        {
            const byte IMMEDIATE = 0;

            code = new Byte[] { 0xc6, 0x40, 0x10, IMMEDIATE };
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.EbIb, encoding);
            Assert.AreEqual(IMMEDIATE, opcode.GetImmediateFor(code));
        }
Esempio n. 15
0
        public void EvIbShr()
        {
            code = new Byte[] { 0xc1, 0xe8, 0x04 };
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.EvIb, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);

            Assert.AreEqual(OperatorEffect.Shr, operatorEffect);
        }
Esempio n. 16
0
        public void EvIbAnd()
        {
            code = new Byte[] { 0x83, 0xe4, 0xf0 };
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.EvIb, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);

            Assert.AreEqual(OperatorEffect.And, operatorEffect);
        }
Esempio n. 17
0
        public void Jb()
        {
            code = new Byte[] { 0x75, 0x06 };
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.Jb, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);

            Assert.AreEqual(OperatorEffect.Jnz, operatorEffect);
        }
Esempio n. 18
0
 public void PoprSP()
 {
     code     = new Byte[] { 0x5c };
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.rSP, encoding);
     Assert.AreEqual(StackEffect.Pop, opcode.GetStackEffectFor(code));
     Assert.IsFalse(opcode.HasSourceRegister(code));
     Assert.IsTrue(opcode.HasDestinationRegister(code));
     Assert.AreEqual(RegisterName.None, opcode.GetSourceRegisterFor(code));
     Assert.AreEqual(RegisterName.ESP, opcode.GetDestinationRegisterFor(code));
 }
Esempio n. 19
0
        public void Jz()
        {
            code = new Byte[] { 0xe8, 0x14, 0xff, 0xff, 0xff };
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.Jz, encoding);

            Assert.AreEqual(OperatorEffect.Call, opcode.GetOperatorEffectFor(code));
            Assert.IsTrue(opcode.HasImmediate(code));
            Assert.AreEqual(0xffffff14, opcode.GetImmediateFor(code));
        }
Esempio n. 20
0
 public void PushrSI()
 {
     code = new Byte[] { 0x56 };
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.rSI, encoding);
     Assert.AreEqual(StackEffect.Push, opcode.GetStackEffectFor(code));
     Assert.IsTrue(opcode.HasSourceRegister(code));
     Assert.IsFalse(opcode.HasDestinationRegister(code));
     Assert.AreEqual(RegisterName.ESI, opcode.GetSourceRegisterFor(code));
 }
Esempio n. 21
0
 public void XorEvGv()
 {
     // xor EBP,EBP
     code = new Byte[] { 0x31, 0xed };
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.EvGv, encoding);
     Assert.AreEqual(OperatorEffect.Xor, opcode.GetOperatorEffectFor(code));
     Assert.AreEqual(RegisterName.EBP, opcode.GetDestinationRegisterFor(code));
     Assert.AreEqual(RegisterName.EBP, opcode.GetSourceRegisterFor(code));
 }
Esempio n. 22
0
        public void rAxIz()
        {
            code = new Byte[] { 0x05, 0x04, 0x01, 0x00, 0x00 };
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.rAxIz, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);

            Assert.AreEqual(OperatorEffect.Add, operatorEffect);
        }
Esempio n. 23
0
        public void rAxOv()
        {
            code = new Byte[] { 0xa1, 0xe4, 0x84, 0x04, 0x08 };
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.rAxOv, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);

            Assert.AreEqual(OperatorEffect.Assignment, operatorEffect);
        }
Esempio n. 24
0
        public void EvGvSub()
        {
            code = new Byte[] { 0x29, 0xc4 };
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.EvGv, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);

            Assert.AreEqual(OperatorEffect.Sub, operatorEffect);
        }
Esempio n. 25
0
        public void AnotherGvM()
        {
            code = new Byte[] {0x8d, 0x04, 0x02};
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            Assert.IsTrue(opcode.HasModRM(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.GvM, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);
            Assert.AreEqual(OperatorEffect.Assignment, operatorEffect);
            Assert.AreEqual(RegisterName.EAX, opcode.GetDestinationRegisterFor(code));
        }
Esempio n. 26
0
        public void EvIbAdd()
        {
            // 83 c0 0f                add    eax,0xf
            code = new Byte[] { 0x83, 0xc0, 0x0f };
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.EvIb, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);

            Assert.AreEqual(OperatorEffect.Add, operatorEffect);
        }
Esempio n. 27
0
        public void EbGb()
        {
            // mov    BYTE PTR [eax+16],bl
            code = new Byte[] {0x88, 0x58, 0x10};
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.EbGb, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);
            Assert.AreEqual(OperatorEffect.Assignment, operatorEffect);
            Assert.AreEqual(RegisterName.EBX, opcode.GetSourceRegisterFor(code));
        }
Esempio n. 28
0
        public void ObAL()
        {
            // mov    ds:0x80495e0,al
            code = new Byte[] { 0xa2, 0xe0, 0x95, 0x04, 0x08 };
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.ObAL, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);

            Assert.AreEqual(OperatorEffect.Assignment, operatorEffect);
        }
Esempio n. 29
0
 public void PushIz()
 {
     code = new Byte[] { 0x68, 0x10, 0x84, 0x04, 0x08 };
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.Iz, encoding);
     Assert.AreEqual(StackEffect.Push, opcode.GetStackEffectFor(code));
     Assert.IsFalse(opcode.HasSourceRegister(code));
     Assert.IsFalse(opcode.HasDestinationRegister(code));
     Assert.IsTrue(opcode.HasImmediate(code));
     Assert.AreEqual(0x08048410, opcode.GetImmediateFor(code));
 }
Esempio n. 30
0
        public void GvEbOffsetToRegister()
        {
            // movzx  edx,BYTE PTR ds:0x80495e0
            code = new Byte[] { 0x0f, 0xb6, 0x15, 0xe0, 0x95, 0x04, 0x08 };
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.GvEb, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);

            Assert.AreEqual(OperatorEffect.Assignment, operatorEffect);
        }
Esempio n. 31
0
        public void AnotherGvM()
        {
            code = new Byte[] { 0x8d, 0x04, 0x02 };
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            Assert.IsTrue(opcode.HasModRM(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.GvM, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);

            Assert.AreEqual(OperatorEffect.Assignment, operatorEffect);
            Assert.AreEqual(RegisterName.EAX, opcode.GetDestinationRegisterFor(code));
        }
Esempio n. 32
0
        public void GvEbRegisterToRegister()
        {
            // movzx  ebx,BYTE PTR [eax]
            code = new Byte[] { 0x0f, 0xb6, 0x18 };
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.GvEb, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);

            Assert.AreEqual(OperatorEffect.Assignment, operatorEffect);
            Assert.AreEqual(RegisterName.EAX, opcode.GetSourceRegisterFor(code));
        }
Esempio n. 33
0
        public void EbGb()
        {
            // mov    BYTE PTR [eax+16],bl
            code = new Byte[] { 0x88, 0x58, 0x10 };
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.EbGb, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);

            Assert.AreEqual(OperatorEffect.Assignment, operatorEffect);
            Assert.AreEqual(RegisterName.EBX, opcode.GetSourceRegisterFor(code));
        }
Esempio n. 34
0
        public void GvM()
        {
            // lea edx, [eax+16]
            code = new Byte[] { 0x8d, 0x50, 0x10 };
            Assert.IsTrue(opcode.HasModRM(code));
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.GvM, encoding);
            Assert.AreEqual(RegisterName.EAX, opcode.GetSourceRegisterFor(code));

            var operatorEffect = opcode.GetOperatorEffectFor(code);

            Assert.AreEqual(OperatorEffect.Assignment, operatorEffect);
        }
Esempio n. 35
0
 public void rAxIv()
 {
     code = new Byte[] {0xb8, 0x00, 0x00, 0x00, 0x00};
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.rAxIv, encoding);
     Assert.AreEqual(RegisterName.EAX, opcode.GetDestinationRegisterFor(code));
 }
Esempio n. 36
0
 public void GvEv()
 {
     // mov eax, [eax]
     code = new Byte[] {0x8b, 0x00};
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.GvEv, encoding);
     Assert.AreEqual(RegisterName.EAX, opcode.GetSourceRegisterFor(code));
     Assert.AreEqual(RegisterName.EAX, opcode.GetDestinationRegisterFor(code));
 }
Esempio n. 37
0
        public void GvEbRegisterToRegister()
        {
            // movzx  ebx,BYTE PTR [eax]
            code = new Byte[] {0x0f, 0xb6, 0x18};
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.GvEb, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);
            Assert.AreEqual(OperatorEffect.Assignment, operatorEffect);
            Assert.AreEqual(RegisterName.EAX, opcode.GetSourceRegisterFor(code));
        }
Esempio n. 38
0
        public void Jb()
        {
            code = new Byte[] {0x75, 0x06};
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.Jb, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);
            Assert.AreEqual(OperatorEffect.Jnz, operatorEffect);
        }
Esempio n. 39
0
 public void GvEvDword()
 {
     // mov eax, [0x11223344]
     code = new Byte[] {0x8b, 0x05, 0x44, 0x33, 0x22, 0x11};
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.GvEv, encoding);
     Assert.AreEqual(RegisterName.None, opcode.GetSourceRegisterFor(code));
     Assert.AreEqual(RegisterName.EAX, opcode.GetDestinationRegisterFor(code));
 }
Esempio n. 40
0
 public void PushrSI()
 {
     code = new Byte[] {0x56};
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.rSI, encoding);
     Assert.AreEqual(StackEffect.Push, opcode.GetStackEffectFor(code));
     Assert.IsTrue(opcode.HasSourceRegister(code));
     Assert.IsFalse(opcode.HasDestinationRegister(code));
     Assert.AreEqual(RegisterName.ESI, opcode.GetSourceRegisterFor(code));
 }
Esempio n. 41
0
 public void EvIz()
 {
     code = new Byte[] {0xc7, 0x04, 0x24, 0x10, 0x00, 0x00, 0x00};
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.EvIz, encoding);
     Assert.IsTrue(opcode.HasDestinationRegister(code));
     Assert.AreEqual(RegisterName.ESP, opcode.GetDestinationRegisterFor(code));
     Assert.AreEqual(0x10, opcode.GetImmediateFor(code));
 }
Esempio n. 42
0
 public void GvEvSIB()
 {
     // mov eax, [base_register+scale_register*scaler
     code = new Byte[] {0x8b, 0x04, 0x24};
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.GvEv, encoding);
     Assert.AreEqual(RegisterName.None, opcode.GetSourceRegisterFor(code));
     Assert.AreEqual(RegisterName.EAX, opcode.GetDestinationRegisterFor(code));
 }
Esempio n. 43
0
 public void PoprDX()
 {
     code = new Byte[] {0x5a};
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.rDX, encoding);
     Assert.AreEqual(StackEffect.Pop, opcode.GetStackEffectFor(code));
     Assert.IsFalse(opcode.HasSourceRegister(code));
     Assert.IsTrue(opcode.HasDestinationRegister(code));
     Assert.AreEqual(RegisterName.EDX, opcode.GetDestinationRegisterFor(code));
 }
Esempio n. 44
0
 public void None()
 {
     code = new Byte[] {0x90};
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.None, encoding);
     Assert.AreEqual(StackEffect.None, opcode.GetStackEffectFor(code));
 }
Esempio n. 45
0
        public void ObAL()
        {
            // mov    ds:0x80495e0,al
            code = new Byte[] {0xa2, 0xe0, 0x95, 0x04, 0x08};
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.ObAL, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);
            Assert.AreEqual(OperatorEffect.Assignment, operatorEffect);
        }
Esempio n. 46
0
        public void GvM()
        {
            // lea edx, [eax+16]
            code = new Byte[] {0x8d, 0x50, 0x10};
            Assert.IsTrue(opcode.HasModRM(code));
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.GvM, encoding);
            Assert.AreEqual(RegisterName.EAX, opcode.GetSourceRegisterFor(code));

            var operatorEffect = opcode.GetOperatorEffectFor(code);
            Assert.AreEqual(OperatorEffect.Assignment, operatorEffect);
        }
Esempio n. 47
0
        public void EvIbAdd()
        {
            // 83 c0 0f                add    eax,0xf
            code = new Byte[] {0x83, 0xc0, 0x0f};
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.EvIb, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);
            Assert.AreEqual(OperatorEffect.Add, operatorEffect);
        }
Esempio n. 48
0
        public void EvIbShr()
        {
            code = new Byte[] {0xc1, 0xe8, 0x04};
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.EvIb, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);
            Assert.AreEqual(OperatorEffect.Shr, operatorEffect);
        }
Esempio n. 49
0
 public void PushrSP()
 {
     code = new Byte[] {0x54};
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.rSP, encoding);
     Assert.AreEqual(StackEffect.Push, opcode.GetStackEffectFor(code));
     Assert.IsTrue(opcode.HasSourceRegister(code));
     Assert.IsFalse(opcode.HasDestinationRegister(code));
     Assert.AreEqual(RegisterName.ESP, opcode.GetSourceRegisterFor(code));
     Assert.AreEqual(RegisterName.None, opcode.GetDestinationRegisterFor(code));
 }
Esempio n. 50
0
 public void XorEvGv()
 {
     // xor EBP,EBP
     code = new Byte[] {0x31, 0xed};
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.EvGv, encoding);
     Assert.AreEqual(OperatorEffect.Xor, opcode.GetOperatorEffectFor(code));
     Assert.AreEqual(RegisterName.EBP, opcode.GetDestinationRegisterFor(code));
     Assert.AreEqual(RegisterName.EBP, opcode.GetSourceRegisterFor(code));
 }
Esempio n. 51
0
        public void GvEbOffsetToRegister()
        {
            // movzx  edx,BYTE PTR ds:0x80495e0
            code = new Byte[] {0x0f, 0xb6, 0x15, 0xe0, 0x95, 0x04, 0x08};
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.GvEb, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);
            Assert.AreEqual(OperatorEffect.Assignment, operatorEffect);
        }
Esempio n. 52
0
        public void rAxOv()
        {
            code = new Byte[] {0xa1, 0xe4, 0x84, 0x04, 0x08};
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.rAxOv, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);
            Assert.AreEqual(OperatorEffect.Assignment, operatorEffect);
        }
Esempio n. 53
0
 public void PushrBX()
 {
     code = new Byte[] {0x53};
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.rBX, encoding);
     Assert.AreEqual(StackEffect.Push, opcode.GetStackEffectFor(code));
     Assert.AreEqual(RegisterName.None, opcode.GetDestinationRegisterFor(code));
     Assert.AreEqual(RegisterName.EBX, opcode.GetSourceRegisterFor(code));
 }
Esempio n. 54
0
        public void rAxIz()
        {
            code = new Byte[] {0x05, 0x04, 0x01, 0x00, 0x00};
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.rAxIz, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);
            Assert.AreEqual(OperatorEffect.Add, operatorEffect);
        }
Esempio n. 55
0
 public void Halt()
 {
     code = new Byte[] {0xf4};
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.None, encoding);
     Assert.AreEqual(StackEffect.None, opcode.GetStackEffectFor(code));
     Assert.IsTrue(opcode.TerminatesFunction(code));
 }
Esempio n. 56
0
        public void Jz()
        {
            code = new Byte[] {0xe8, 0x14, 0xff, 0xff, 0xff};
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.Jz, encoding);

            Assert.AreEqual(OperatorEffect.Call, opcode.GetOperatorEffectFor(code));
            Assert.IsTrue(opcode.HasImmediate(code));
            Assert.AreEqual(0xffffff14, opcode.GetImmediateFor(code));
        }
Esempio n. 57
0
        public void EvIbCmp()
        {
            code = new Byte[] {0x83, 0x7d, 0x08, 0x01};
            Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
            encoding = opcode.GetEncodingFor(code);
            Assert.AreEqual(OpcodeEncoding.EvIb, encoding);

            var operatorEffect = opcode.GetOperatorEffectFor(code);
            Assert.AreEqual(OperatorEffect.Cmp, operatorEffect);
        }
Esempio n. 58
0
 public void PushIz()
 {
     code = new Byte[] {0x68, 0x10, 0x84, 0x04, 0x08};
     Assert.AreEqual(code.Length, opcode.GetInstructionLengthFor(code));
     encoding = opcode.GetEncodingFor(code);
     Assert.AreEqual(OpcodeEncoding.Iz, encoding);
     Assert.AreEqual(StackEffect.Push, opcode.GetStackEffectFor(code));
     Assert.IsFalse(opcode.HasSourceRegister(code));
     Assert.IsFalse(opcode.HasDestinationRegister(code));
     Assert.IsTrue(opcode.HasImmediate(code));
     Assert.AreEqual(0x08048410, opcode.GetImmediateFor(code));
 }