use crate::color;
use crate::emu::Emu;
use iced_x86::Instruction;
pub fn execute(emu: &mut Emu, ins: &Instruction, _instruction_sz: usize, _rep_step: bool) -> bool {
emu.show_instruction(color!("Green"), &crate::emu::decoded_instruction::DecodedInstruction::X86(*ins));
let src = match emu.get_operand_value(ins, 2, true) {
Some(v) => v,
None => {
log::trace!("mulx: error reading src operand");
return false;
}
};
if emu.get_operand_sz(ins, 0) == 64 {
let factor = emu.regs().rdx as u128;
let result = (src as u128).wrapping_mul(factor);
emu.set_operand_value(ins, 1, result as u64); emu.set_operand_value(ins, 0, (result >> 64) as u64); } else {
let factor = emu.regs().rdx & 0xffff_ffff; let result = (src & 0xffff_ffff).wrapping_mul(factor); emu.set_operand_value(ins, 1, result & 0xffff_ffff); emu.set_operand_value(ins, 0, (result >> 32) & 0xffff_ffff); }
true
}