Skip to content

Commit

Permalink
fsubrp
Browse files Browse the repository at this point in the history
  • Loading branch information
evmar committed Jun 6, 2024
1 parent 8cd9666 commit 787a7fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 7 additions & 2 deletions x86/src/ops/fpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,17 @@ pub fn fsubr_m32fp(cpu: &mut CPU, mem: Mem, instr: &Instruction) {
*x = y - *x;
}

pub fn fsubr_st0_sti(cpu: &mut CPU, _mem: Mem, instr: &Instruction) {
pub fn fsubr_sti_sti(cpu: &mut CPU, _mem: Mem, instr: &Instruction) {
let y = *cpu.fpu.get(instr.op1_register());
let x = cpu.fpu.st0();
let x = cpu.fpu.get(instr.op0_register());
*x = y - *x;
}

pub fn fsubrp_st0_sti(cpu: &mut CPU, mem: Mem, instr: &Instruction) {
fsubr_sti_sti(cpu, mem, instr);
cpu.fpu.pop();
}

pub fn fmul_m64fp(cpu: &mut CPU, mem: Mem, instr: &Instruction) {
let y = mem.get_pod::<f64>(x86_addr(cpu, instr));
*cpu.fpu.st0() *= y;
Expand Down
4 changes: 3 additions & 1 deletion x86/src/ops/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,9 @@ pub unsafe fn init_op_tab() {

OP_TAB[iced_x86::Code::Fsubr_m64fp as usize] = Some(fsubr_m64fp);
OP_TAB[iced_x86::Code::Fsubr_m32fp as usize] = Some(fsubr_m32fp);
OP_TAB[iced_x86::Code::Fsubr_st0_sti as usize] = Some(fsubr_st0_sti);
OP_TAB[iced_x86::Code::Fsubr_st0_sti as usize] = Some(fsubr_sti_sti);
OP_TAB[iced_x86::Code::Fsubr_sti_st0 as usize] = Some(fsubr_sti_sti);
OP_TAB[iced_x86::Code::Fsubrp_sti_st0 as usize] = Some(fsubrp_st0_sti);

OP_TAB[iced_x86::Code::Fmul_m64fp as usize] = Some(fmul_m64fp);
OP_TAB[iced_x86::Code::Fmul_m32fp as usize] = Some(fmul_m32fp);
Expand Down

0 comments on commit 787a7fe

Please sign in to comment.