{a32,a64}_emit_x64_memory: Ensure return value of fastmem callback are zero-extended
This commit is contained in:
parent
dc3e70c552
commit
6c4fa780e0
3 changed files with 20 additions and 0 deletions
|
@ -53,6 +53,7 @@ void A32EmitX64::GenFastmemFallbacks() {
|
||||||
code.mov(Xbyak::Reg64{value_idx}, code.ABI_RETURN);
|
code.mov(Xbyak::Reg64{value_idx}, code.ABI_RETURN);
|
||||||
}
|
}
|
||||||
ABI_PopCallerSaveRegistersAndAdjustStackExcept(code, HostLocRegIdx(value_idx));
|
ABI_PopCallerSaveRegistersAndAdjustStackExcept(code, HostLocRegIdx(value_idx));
|
||||||
|
code.ZeroExtendFrom(bitsize, Xbyak::Reg64{value_idx});
|
||||||
code.ret();
|
code.ret();
|
||||||
PerfMapRegister(read_fallbacks[std::make_tuple(bitsize, vaddr_idx, value_idx)], code.getCurr(), fmt::format("a32_read_fallback_{}", bitsize));
|
PerfMapRegister(read_fallbacks[std::make_tuple(bitsize, vaddr_idx, value_idx)], code.getCurr(), fmt::format("a32_read_fallback_{}", bitsize));
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,6 +141,7 @@ void A64EmitX64::GenFastmemFallbacks() {
|
||||||
code.mov(Xbyak::Reg64{value_idx}, code.ABI_RETURN);
|
code.mov(Xbyak::Reg64{value_idx}, code.ABI_RETURN);
|
||||||
}
|
}
|
||||||
ABI_PopCallerSaveRegistersAndAdjustStackExcept(code, HostLocRegIdx(value_idx));
|
ABI_PopCallerSaveRegistersAndAdjustStackExcept(code, HostLocRegIdx(value_idx));
|
||||||
|
code.ZeroExtendFrom(bitsize, Xbyak::Reg64{value_idx});
|
||||||
code.ret();
|
code.ret();
|
||||||
PerfMapRegister(read_fallbacks[std::make_tuple(bitsize, vaddr_idx, value_idx)], code.getCurr(), fmt::format("a64_read_fallback_{}", bitsize));
|
PerfMapRegister(read_fallbacks[std::make_tuple(bitsize, vaddr_idx, value_idx)], code.getCurr(), fmt::format("a64_read_fallback_{}", bitsize));
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,24 @@ public:
|
||||||
CallFunction(Common::FptrCast(l));
|
CallFunction(Common::FptrCast(l));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ZeroExtendFrom(size_t bitsize, Xbyak::Reg64 reg) {
|
||||||
|
switch (bitsize) {
|
||||||
|
case 8:
|
||||||
|
movzx(reg.cvt32(), reg.cvt8());
|
||||||
|
return;
|
||||||
|
case 16:
|
||||||
|
movzx(reg.cvt32(), reg.cvt16());
|
||||||
|
return;
|
||||||
|
case 32:
|
||||||
|
mov(reg.cvt32(), reg.cvt32());
|
||||||
|
return;
|
||||||
|
case 64:
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
UNREACHABLE();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Xbyak::Address MConst(const Xbyak::AddressFrame& frame, u64 lower, u64 upper = 0);
|
Xbyak::Address MConst(const Xbyak::AddressFrame& frame, u64 lower, u64 upper = 0);
|
||||||
|
|
||||||
/// Far code sits far away from the near code. Execution remains primarily in near code.
|
/// Far code sits far away from the near code. Execution remains primarily in near code.
|
||||||
|
|
Loading…
Reference in a new issue