Esempio n. 1
0
        public void X86St_SetEsi()
        {
            var state = new X86State(new X86ArchitectureFlat64(new ServiceContainer(), "x86-protected-64", new Dictionary <string, object>()));

            state.SetRegister(Registers.esi, Constant.Word32(0x12345678));
            Assert.AreEqual(0x12345678, (long)state.GetRegister(Registers.esi).ToUInt64());
            Assert.AreEqual(0x5678, (int)state.GetRegister(Registers.si).ToUInt32());
        }
Esempio n. 2
0
        public void X86St_SetEsi()
        {
            var state = new X86State(new X86ArchitectureFlat64("x86-protected-64"));

            state.SetRegister(Registers.esi, Constant.Word32(0x12345678));
            Assert.AreEqual(0x12345678, (long)state.GetRegister(Registers.esi).ToUInt64());
            Assert.AreEqual(0x5678, (int)state.GetRegister(Registers.si).ToUInt32());
        }
Esempio n. 3
0
        public void X86St_SetEdx()
        {
            var state = new X86State(new X86ArchitectureFlat64());

            state.SetRegister(Registers.edx, Constant.Word32(0x12345678));
            Assert.AreEqual(0x12345678, (long)state.GetRegister(Registers.edx).ToUInt64());
            Assert.AreEqual(0x5678, (int)state.GetRegister(Registers.dx).ToUInt32());
            Assert.AreEqual(0x78, (int)state.GetRegister(Registers.dl).ToUInt32());
            Assert.AreEqual(0x56, (int)state.GetRegister(Registers.dh).ToUInt32());
        }
Esempio n. 4
0
        public void X86St_SetCx()
        {
            var state = new X86State(new X86ArchitectureFlat64("x86-protected-64"));

            state.SetRegister(Registers.cx, Constant.Word16(0x1234));
            Assert.AreEqual(0x1234, (int)state.GetRegister(Registers.cx).ToUInt16());
            Assert.AreEqual(0x34, (int)state.GetRegister(Registers.cl).ToByte());
            Assert.AreEqual(0x12, (int)state.GetRegister(Registers.ch).ToByte());
            Assert.IsTrue(state.IsValid(Registers.cx));
            Assert.IsTrue(state.IsValid(Registers.cl));
            Assert.IsTrue(state.IsValid(Registers.ch));
        }
Esempio n. 5
0
        public void X86St_SetCx()
        {
            var state = new X86State(new X86ArchitectureFlat64(new ServiceContainer(), "x86-protected-64", new Dictionary <string, object>()));

            state.SetRegister(Registers.cx, Constant.Word16(0x1234));
            Assert.AreEqual(0x1234, (int)state.GetRegister(Registers.cx).ToUInt16());
            Assert.AreEqual(0x34, (int)state.GetRegister(Registers.cl).ToByte());
            Assert.AreEqual(0x12, (int)state.GetRegister(Registers.ch).ToByte());
            Assert.IsTrue(state.IsValid(Registers.cx));
            Assert.IsTrue(state.IsValid(Registers.cl));
            Assert.IsTrue(state.IsValid(Registers.ch));
        }
Esempio n. 6
0
        public void X86St_Simple()
        {
            var arch = new X86ArchitectureReal("x86-real-16");

            X86State st = new X86State(arch);

            st.SetRegister(Registers.cs, Constant.Word16(0xC00));
            st.SetRegister(Registers.ax, Constant.Word16(0x1234));
            Assert.IsTrue(!st.GetRegister(Registers.bx).IsValid);
            Assert.IsTrue(st.GetRegister(Registers.ax).IsValid);
            Assert.IsTrue(st.GetRegister(Registers.al).IsValid);
            Assert.AreEqual(0x34, st.GetRegister(Registers.al).ToUInt32());
            Assert.IsTrue(st.GetRegister(Registers.ah).IsValid);
            Assert.AreEqual(0x12, st.GetRegister(Registers.ah).ToUInt32());
        }
Esempio n. 7
0
        public void X86St_Simple()
        {
            var arch = new X86ArchitectureReal(new ServiceContainer(), "x86-real-16", new Dictionary <string, object>());

            X86State st = new X86State(arch);

            st.SetRegister(Registers.cs, Constant.Word16(0xC00));
            st.SetRegister(Registers.ax, Constant.Word16(0x1234));
            Assert.IsTrue(!st.GetRegister(Registers.bx).IsValid);
            Assert.IsTrue(st.GetRegister(Registers.ax).IsValid);
            Assert.IsTrue(st.GetRegister(Registers.al).IsValid);
            Assert.AreEqual(0x34, st.GetRegister(Registers.al).ToUInt32());
            Assert.IsTrue(st.GetRegister(Registers.ah).IsValid);
            Assert.AreEqual(0x12, st.GetRegister(Registers.ah).ToUInt32());
        }
Esempio n. 8
0
        public void Simple()
        {
            var arch = new IntelArchitecture(ProcessorMode.Real);

            X86State st = new X86State(arch);

            st.SetRegister(Registers.cs, Constant.Word16(0xC00));
            st.SetRegister(Registers.ax, Constant.Word16(0x1234));
            Assert.IsTrue(!st.GetRegister(Registers.bx).IsValid);
            Assert.IsTrue(st.GetRegister(Registers.ax).IsValid);
            Assert.IsTrue(st.GetRegister(Registers.al).IsValid);
            Assert.AreEqual(0x34, st.GetRegister(Registers.al).ToUInt32());
            Assert.IsTrue(st.GetRegister(Registers.ah).IsValid);
            Assert.AreEqual(0x12, st.GetRegister(Registers.ah).ToUInt32());
        }