aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Cpu/LightningJit/Arm32/Target
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2024-03-26 23:33:24 -0300
committerGitHub <noreply@github.com>2024-03-26 23:33:24 -0300
commitb323a017385ac6e08db4025fe4ef1bfbb41607ab (patch)
tree33392d69cea70232cb0342e38a924dc31fb22719 /src/Ryujinx.Cpu/LightningJit/Arm32/Target
parentf6d24449b6e1ebe753c0a8095a435820c0948f19 (diff)
Implement host tracked memory manager mode (#6356)
* Add host tracked memory manager mode * Skipping flush is no longer needed * Formatting + revert unrelated change * LightningJit: Ensure that dest register is saved for load ops that do partial updates * avoid allocations when doing address space lookup Add missing improvement * IsRmwMemory -> IsPartialRegisterUpdateMemory * Ensure we iterate all private allocations in range * PR feedback and potential fixes * Simplified bridges a lot * Skip calling SignalMappingChanged if Guest is true * Late map bridge too * Force address masking for prefetch instructions * Reprotection for bridges * Move partition list validation to separate debug method * Move host tracked related classes to HostTracked folder * New HostTracked namespace * Move host tracked modes to the end of enum to avoid PPTC invalidation --------- Co-authored-by: riperiperi <rhy3756547@hotmail.com>
Diffstat (limited to 'src/Ryujinx.Cpu/LightningJit/Arm32/Target')
-rw-r--r--src/Ryujinx.Cpu/LightningJit/Arm32/Target/Arm64/InstEmitMemory.cs18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/Ryujinx.Cpu/LightningJit/Arm32/Target/Arm64/InstEmitMemory.cs b/src/Ryujinx.Cpu/LightningJit/Arm32/Target/Arm64/InstEmitMemory.cs
index 6ab4b949..d8caee6e 100644
--- a/src/Ryujinx.Cpu/LightningJit/Arm32/Target/Arm64/InstEmitMemory.cs
+++ b/src/Ryujinx.Cpu/LightningJit/Arm32/Target/Arm64/InstEmitMemory.cs
@@ -1126,11 +1126,23 @@ namespace Ryujinx.Cpu.LightningJit.Arm32.Target.Arm64
Operand destination64 = new(destination.Kind, OperandType.I64, destination.Value);
Operand basePointer = new(regAlloc.FixedPageTableRegister, RegisterType.Integer, OperandType.I64);
- if (mmType == MemoryManagerType.HostMapped || mmType == MemoryManagerType.HostMappedUnsafe)
+ // We don't need to mask the address for the safe mode, since it is already naturally limited to 32-bit
+ // and can never reach out of the guest address space.
+
+ if (mmType.IsHostTracked())
{
- // We don't need to mask the address for the safe mode, since it is already naturally limited to 32-bit
- // and can never reach out of the guest address space.
+ int tempRegister = regAlloc.AllocateTempGprRegister();
+
+ Operand pte = new(tempRegister, RegisterType.Integer, OperandType.I64);
+
+ asm.Lsr(pte, guestAddress, new Operand(OperandKind.Constant, OperandType.I32, 12));
+ asm.LdrRr(pte, basePointer, pte, ArmExtensionType.Uxtx, true);
+ asm.Add(destination64, pte, guestAddress);
+ regAlloc.FreeTempGprRegister(tempRegister);
+ }
+ else if (mmType.IsHostMapped())
+ {
asm.Add(destination64, basePointer, guestAddress);
}
else