Esempio n. 1
0
 public UInt32 calc_memory_address(Emulator emu)
 {
     if (mod == 0x00)
     {
         if (rm == 0x04)
         {
             Console.WriteLine("not implemented ModRM mod = 0x00, rm = 0x04");
             Environment.Exit(0);
         }
         else if (rm == 5)
         {
             return(disp32);
         }
         else
         {
             return(emu.getRegister32(rm));
         }
     }
     else if (mod == 0x01)
     {
         if (rm == 4)
         {
             Console.WriteLine("not implemented ModRM mod = 0x01, rm = 0x04");
             Environment.Exit(0);
         }
         else
         {
             return(emu.getRegister32(rm) + disp8);
         }
     }
     else if (mod == 0x02)
     {
         if (rm == 0x04)
         {
             Console.WriteLine("not implemented ModRM mod = 0x02, rm = 0x04");
             Environment.Exit(0);
         }
         else
         {
             return(emu.getRegister32(rm) + disp32);
         }
     }
     else
     {
         Console.WriteLine("not implemented ModRM mod = 0x03");
         Environment.Exit(0);
     }
     return(0);
 }
Esempio n. 2
0
        // opcode 0x50-0x57
        public static void push_r32(Emulator emu)
        {
            Byte reg = (Byte)(emu.getCode8(0) - 0x50);

            emu.push32(emu.getRegister32(reg));
            emu.eip += 1;
        }
Esempio n. 3
0
        public static void leave(Emulator emu)
        {
            UInt32 ebp = emu.getRegister32((int)Registers.EBP);

            emu.setRegister32((int)Registers.ESP, ebp);
            emu.setRegister32((int)Registers.EBP, emu.pop32());

            emu.eip += 1;
        }
Esempio n. 4
0
 public UInt32 get_rm32(Emulator emu)
 {
     if (mod == 0x03)
     {
         return(emu.getRegister32(rm));
     }
     else
     {
         UInt32 address = calc_memory_address(emu);
         return(emu.getMemory32(address));
     }
 }
Esempio n. 5
0
 public UInt32 get_r32(Emulator emu)
 {
     return(emu.getRegister32(regIndex));
 }