Example #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);
 }
Example #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);
 }
Example #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));
 }
Example #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));
 }
Example #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));
 }
Example #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));
 }
Example #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));
 }
Example #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);
        }
Example #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));
 }
Example #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));
 }
Example #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));
 }
Example #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));
 }
Example #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));
 }
Example #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));
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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));
 }
Example #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));
        }
Example #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));
 }
Example #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));
 }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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));
        }
Example #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);
        }
Example #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));
        }
Example #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);
        }
Example #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));
 }
Example #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);
        }
Example #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));
        }
Example #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));
        }
Example #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));
        }
Example #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);
        }
Example #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));
 }
Example #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));
 }
Example #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));
        }
Example #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);
        }
Example #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));
 }
Example #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));
 }
Example #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));
 }
Example #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));
 }
Example #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));
 }
Example #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));
 }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #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));
 }
Example #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));
 }
Example #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);
        }
Example #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);
        }
Example #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));
 }
Example #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);
        }
Example #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));
 }
Example #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));
        }
Example #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);
        }
Example #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));
 }