Пример #1
0
        public void Parse(Emulator emu)
        {
            mod    = 0;
            opcode = regIndex = 0;
            rm     = 0;
            sib    = 0;
            disp32 = disp8 = 0;

            Byte code;

            code = (Byte)emu.getCode8(0);

            mod    = (Byte)((code & 0xC0) >> 6);
            opcode = regIndex = (Byte)((code & 0x38) >> 3);
            rm     = (Byte)(code & 0x07);

            emu.eip++;

            if (mod != 0x03 && rm == 0x04)
            {
                sib = (Byte)emu.getCode8(0);
                emu.eip++;
            }

            if ((mod == 0x00 && rm == 0x05) || mod == 0x02)
            {
                disp32   = emu.getCode32(0);
                emu.eip += 4;
            }
            else if (mod == 0x01)
            {
                disp8    = (Byte)emu.getCode8(0);
                emu.eip += 1;
            }
        }
Пример #2
0
        // opcode 0x68
        public static void push_imm32(Emulator emu)
        {
            UInt32 value = emu.getCode32(1);

            emu.push32(value);
            emu.eip += 5;
        }
Пример #3
0
        // opcode 0xC7
        public static void mov_r32_imm32(Emulator emu)
        {
            Byte   reg   = (Byte)(emu.getCode8(0) - 0xB8);
            UInt32 value = emu.getCode32(1);

            emu.registers[reg] = value;
            emu.eip           += 5;
        }
Пример #4
0
        // opcode 0xB8~0xBF
        public static void mov_rm32_imm32(Emulator emu)
        {
            emu.eip++;
            ModRM modrm = new ModRM();

            modrm.Parse(emu);
            UInt32 value = emu.getCode32(0);

            emu.eip += 4;
            modrm.set_rm32(emu, value);
        }