Esempio n. 1
0
        // opcode 0x83
        public static void code_83(Emulator emu)
        {
            emu.eip += 1;
            ModRM modrm = new ModRM();

            modrm.Parse(emu);

            switch (modrm.opcode)
            {
            case 0:
                add_rm32_imm8(emu, modrm);
                break;

            case 5:
                sub_rm32_imm8(emu, modrm);
                break;

            case 7:
                cmp_rm32_imm8(emu, modrm);
                break;

            default:
                Console.WriteLine("not implemented: 83 /%d", modrm.opcode);
                System.Environment.Exit(0);
                break;
            }
        }
Esempio n. 2
0
        private static void add_rm32_imm8(Emulator emu, ModRM modrm)
        {
            UInt32 rm32 = modrm.get_rm32(emu);
            UInt32 imm8 = (UInt32)emu.getSignedCode8(0);

            emu.eip += 1;
            modrm.set_rm32(emu, rm32 + imm8);
        }
Esempio n. 3
0
        // opcode 0x8B
        public static void mov_r32_rm32(Emulator emu)
        {
            emu.eip += 1;
            ModRM modrm = new ModRM();

            modrm.Parse(emu);
            UInt32 rm32 = modrm.get_rm32(emu);

            modrm.set_r32(emu, rm32);
        }
Esempio n. 4
0
        static void cmp_rm32_imm8(Emulator emu, ModRM modrm)
        {
            UInt32 rm32 = modrm.get_rm32(emu);
            UInt32 imm8 = (UInt32)emu.getSignedCode8(0);

            emu.eip += 1;
            UInt64 result = (UInt64)rm32 - (UInt64)imm8;

            emu.update_eflags_sub(rm32, imm8, result);
        }
Esempio n. 5
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);
        }
Esempio n. 6
0
        // opcode 0x3B
        public static void cmp_r32_rm32(Emulator emu)
        {
            emu.eip += 1;
            ModRM modrm = new ModRM();

            modrm.Parse(emu);
            UInt32 r32    = modrm.get_r32(emu);
            UInt32 rm32   = modrm.get_rm32(emu);
            UInt64 result = (UInt64)r32 - (UInt64)rm32;

            emu.update_eflags_sub(r32, rm32, result);
        }
Esempio n. 7
0
        // opcode 0xFF
        public static void code_ff(Emulator emu)
        {
            emu.eip += 1;
            ModRM modrm = new ModRM();

            modrm.Parse(emu);

            switch (modrm.opcode)
            {
            case 0:
                inc_rm32(emu, modrm);
                break;

            default:
                Console.WriteLine("not implemented: 83 /%d", modrm.opcode);
                System.Environment.Exit(1);
                break;
            }
        }
Esempio n. 8
0
        private static void inc_rm32(Emulator emu, ModRM modrm)
        {
            UInt32 value = modrm.get_rm32(emu);

            modrm.set_rm32(emu, value + 1);
        }