diff options
author | 2020-06-22 14:24:21 +0700 | |
---|---|---|
committer | 2020-06-22 14:24:21 +0700 | |
commit | c553dbee4f80081d7ff4ad550ec782b738a0037e (patch) | |
tree | 62f4d4b863b3dfe73abf23007c946e2e33740a18 | |
parent | 6bb4b454629887c060ee0181c305739ab00f8cdf (diff) |
drcbex64: fix pushf/popf bug (nw)
@cuavas please cherry-pick into release branch to fix drc crashes.
-rw-r--r-- | src/devices/cpu/drcbex64.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/devices/cpu/drcbex64.cpp b/src/devices/cpu/drcbex64.cpp index c6222d2050c..7738b02c169 100644 --- a/src/devices/cpu/drcbex64.cpp +++ b/src/devices/cpu/drcbex64.cpp @@ -2695,7 +2695,7 @@ void drcbe_x64::op_getflgs(Assembler &a, const instruction &inst) // default cases default: - a.pushf(); // pushf + a.pushfq(); // pushf a.pop(eax); // pop eax a.and_(eax, flagmask); // and eax,flagmask a.movzx(dstreg, byte_ptr(rbp, rax, 0, offset_from_rbp(&m_near.flagsmap[0]))); // movzx dstreg,[flags_map] @@ -2730,7 +2730,7 @@ void drcbe_x64::op_save(Assembler &a, const instruction &inst) emit_mov_r64_imm(a, rcx, (uintptr_t)dstp.memory()); // mov rcx,dstp // copy flags - a.pushf(); // pushf + a.pushfq(); // pushf a.pop(rax); // pop rax a.and_(eax, 0x8c5); // and eax,0x8c5 a.mov(al, ptr(rbp, rax, 0, offset_from_rbp(&m_near.flagsmap[0]))); // mov al,[flags_map] @@ -2826,7 +2826,7 @@ void drcbe_x64::op_restore(Assembler &a, const instruction &inst) // copy flags a.movzx(eax, byte_ptr(rcx, offsetof(drcuml_machine_state, flags))); // movzx eax,state->flags a.push(ptr(rbp, rax, 3, offset_from_rbp(&m_near.flagsunmap[0]))); // push flags_unmap[eax*8] - a.popf(); // popf + a.popfq(); // popf } @@ -4038,7 +4038,7 @@ void drcbe_x64::op_mulu(Assembler &a, const instruction &inst) if (zsflags != 0) { if (vflag) - a.pushf(); // pushf + a.pushfq(); // pushf if (compute_hi) { if (zsflags == FLAG_Z) @@ -4059,11 +4059,11 @@ void drcbe_x64::op_mulu(Assembler &a, const instruction &inst) // we rely on the fact that OF is cleared by all logical operations above if (vflag) { - a.pushf(); // pushf + a.pushfq(); // pushf a.pop(rax); // pop rax a.and_(qword_ptr(rsp), ~0x84); // and [rsp],~0x84 a.or_(ptr(rsp), rax); // or [rsp],rax - a.popf(); // popf + a.popfq(); // popf } } } @@ -4093,7 +4093,7 @@ void drcbe_x64::op_mulu(Assembler &a, const instruction &inst) if (zsflags != 0) { if (vflag) - a.pushf(); // pushf + a.pushfq(); // pushf if (compute_hi) { if (zsflags == FLAG_Z) @@ -4114,11 +4114,11 @@ void drcbe_x64::op_mulu(Assembler &a, const instruction &inst) // we rely on the fact that OF is cleared by all logical operations above if (vflag) { - a.pushf(); // pushf + a.pushfq(); // pushf a.pop(rax); // pop rax a.and_(qword_ptr(rsp), ~0x84); // and [rsp],~0x84 a.or_(ptr(rsp), rax); // or [rsp],rax - a.popf(); // popf + a.popfq(); // popf } } } @@ -4197,7 +4197,7 @@ void drcbe_x64::op_muls(Assembler &a, const instruction &inst) if (zsflags != 0) { if (vflag) - a.pushf(); // pushf + a.pushfq(); // pushf if (compute_hi) { if (zsflags == FLAG_Z) @@ -4218,11 +4218,11 @@ void drcbe_x64::op_muls(Assembler &a, const instruction &inst) // we rely on the fact that OF is cleared by all logical operations above if (vflag) { - a.pushf(); // pushf + a.pushfq(); // pushf a.pop(rax); // pop rax a.and_(qword_ptr(rsp), ~0x84); // and [rsp],~0x84 a.or_(ptr(rsp), rax); // or [rsp],rax - a.popf(); // popf + a.popfq(); // popf } } } @@ -4277,7 +4277,7 @@ void drcbe_x64::op_muls(Assembler &a, const instruction &inst) if (zsflags != 0) { if (vflag) - a.pushf(); // pushf + a.pushfq(); // pushf if (compute_hi) { if (zsflags == FLAG_Z) @@ -4298,11 +4298,11 @@ void drcbe_x64::op_muls(Assembler &a, const instruction &inst) // we rely on the fact that OF is cleared by all logical operations above if (vflag) { - a.pushf(); // pushf + a.pushfq(); // pushf a.pop(rax); // pop rax a.and_(qword_ptr(rsp), ~0x84); // and [rsp],~0x84 a.or_(ptr(rsp), rax); // or [rsp],rax - a.popf(); // popf + a.popfq(); // popf } } } |