mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
JitArm64: Fix lwbrx/lhbrx with optimized MMIO access
This commit is contained in:
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
#include "Core/PowerPC/JitArm64/Jit.h"
|
#include "Core/PowerPC/JitArm64/Jit.h"
|
||||||
|
#include "Core/PowerPC/JitArm64/Jit_Util.h"
|
||||||
#include "Core/PowerPC/JitArmCommon/BackPatch.h"
|
#include "Core/PowerPC/JitArmCommon/BackPatch.h"
|
||||||
#include "Core/PowerPC/MMU.h"
|
#include "Core/PowerPC/MMU.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
@ -120,16 +121,7 @@ void JitArm64::EmitBackpatchRoutine(u32 flags, bool fastmem, bool do_farcode, AR
|
|||||||
else if (flags & BackPatchInfo::FLAG_SIZE_8)
|
else if (flags & BackPatchInfo::FLAG_SIZE_8)
|
||||||
LDRB(RS, MEM_REG, addr);
|
LDRB(RS, MEM_REG, addr);
|
||||||
|
|
||||||
if (!(flags & BackPatchInfo::FLAG_REVERSE))
|
ByteswapAfterLoad(this, RS, RS, flags, true, false);
|
||||||
{
|
|
||||||
if (flags & BackPatchInfo::FLAG_SIZE_32)
|
|
||||||
REV32(RS, RS);
|
|
||||||
else if (flags & BackPatchInfo::FLAG_SIZE_16)
|
|
||||||
REV16(RS, RS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & BackPatchInfo::FLAG_EXTEND)
|
|
||||||
SXTH(RS, RS);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const u8* fastmem_end = GetCodePtr();
|
const u8* fastmem_end = GetCodePtr();
|
||||||
@ -235,20 +227,7 @@ void JitArm64::EmitBackpatchRoutine(u32 flags, bool fastmem, bool do_farcode, AR
|
|||||||
|
|
||||||
BLR(ARM64Reg::X8);
|
BLR(ARM64Reg::X8);
|
||||||
|
|
||||||
if (!(flags & BackPatchInfo::FLAG_REVERSE))
|
ByteswapAfterLoad(this, RS, ARM64Reg::W0, flags, false, false);
|
||||||
{
|
|
||||||
MOV(RS, ARM64Reg::W0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (flags & BackPatchInfo::FLAG_SIZE_32)
|
|
||||||
REV32(RS, ARM64Reg::W0);
|
|
||||||
else if (flags & BackPatchInfo::FLAG_SIZE_16)
|
|
||||||
REV16(RS, ARM64Reg::W0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & BackPatchInfo::FLAG_EXTEND)
|
|
||||||
SXTH(RS, RS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_float_emit.ABI_PopRegisters(fprs_to_push, ARM64Reg::X30);
|
m_float_emit.ABI_PopRegisters(fprs_to_push, ARM64Reg::X30);
|
||||||
|
@ -192,6 +192,33 @@ private:
|
|||||||
bool m_sign_extend;
|
bool m_sign_extend;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void ByteswapAfterLoad(ARM64XEmitter* emit, ARM64Reg dst_reg, ARM64Reg src_reg, u32 flags,
|
||||||
|
bool is_reversed, bool is_extended)
|
||||||
|
{
|
||||||
|
if (is_reversed == !(flags & BackPatchInfo::FLAG_REVERSE))
|
||||||
|
{
|
||||||
|
if (flags & BackPatchInfo::FLAG_SIZE_32)
|
||||||
|
{
|
||||||
|
emit->REV32(dst_reg, src_reg);
|
||||||
|
src_reg = dst_reg;
|
||||||
|
}
|
||||||
|
else if (flags & BackPatchInfo::FLAG_SIZE_16)
|
||||||
|
{
|
||||||
|
emit->REV16(dst_reg, src_reg);
|
||||||
|
src_reg = dst_reg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_extended && (flags & BackPatchInfo::FLAG_EXTEND))
|
||||||
|
{
|
||||||
|
emit->SXTH(dst_reg, src_reg);
|
||||||
|
src_reg = dst_reg;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dst_reg != src_reg)
|
||||||
|
emit->MOV(dst_reg, src_reg);
|
||||||
|
}
|
||||||
|
|
||||||
void MMIOLoadToReg(MMIO::Mapping* mmio, Arm64Gen::ARM64XEmitter* emit, BitSet32 gprs_in_use,
|
void MMIOLoadToReg(MMIO::Mapping* mmio, Arm64Gen::ARM64XEmitter* emit, BitSet32 gprs_in_use,
|
||||||
BitSet32 fprs_in_use, ARM64Reg dst_reg, u32 address, u32 flags)
|
BitSet32 fprs_in_use, ARM64Reg dst_reg, u32 address, u32 flags)
|
||||||
{
|
{
|
||||||
@ -213,6 +240,8 @@ void MMIOLoadToReg(MMIO::Mapping* mmio, Arm64Gen::ARM64XEmitter* emit, BitSet32
|
|||||||
flags & BackPatchInfo::FLAG_EXTEND);
|
flags & BackPatchInfo::FLAG_EXTEND);
|
||||||
mmio->GetHandlerForRead<u32>(address).Visit(gen);
|
mmio->GetHandlerForRead<u32>(address).Visit(gen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ByteswapAfterLoad(emit, dst_reg, dst_reg, flags, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MMIOWriteRegToAddr(MMIO::Mapping* mmio, Arm64Gen::ARM64XEmitter* emit, BitSet32 gprs_in_use,
|
void MMIOWriteRegToAddr(MMIO::Mapping* mmio, Arm64Gen::ARM64XEmitter* emit, BitSet32 gprs_in_use,
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
|
|
||||||
#include "Core/HW/MMIO.h"
|
#include "Core/HW/MMIO.h"
|
||||||
|
|
||||||
|
void ByteswapAfterLoad(Arm64Gen::ARM64XEmitter* emit, Arm64Gen::ARM64Reg dst_reg,
|
||||||
|
Arm64Gen::ARM64Reg src_reg, u32 flags, bool is_reversed, bool is_extended);
|
||||||
|
|
||||||
void MMIOLoadToReg(MMIO::Mapping* mmio, Arm64Gen::ARM64XEmitter* emit, BitSet32 gprs_in_use,
|
void MMIOLoadToReg(MMIO::Mapping* mmio, Arm64Gen::ARM64XEmitter* emit, BitSet32 gprs_in_use,
|
||||||
BitSet32 fprs_in_use, Arm64Gen::ARM64Reg dst_reg, u32 address, u32 flags);
|
BitSet32 fprs_in_use, Arm64Gen::ARM64Reg dst_reg, u32 address, u32 flags);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user