mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-20 08:44:15 +00:00
Call InvalidateCacheRegion
# Conflicts: # Ryujinx.HLE/HOS/ArmProcessContext.cs # src/Ryujinx.HLE/Debugger/Debugger.cs # src/Ryujinx.HLE/Debugger/IDebuggableProcess.cs # src/Ryujinx.HLE/HOS/Horizon.cs # src/Ryujinx.HLE/HOS/Kernel/Process/KProcess.cs
This commit is contained in:
parent
1b9753d42a
commit
54bf7507d7
7 changed files with 48 additions and 24 deletions
|
@ -47,6 +47,8 @@ namespace Ryujinx.HLE.Debugger
|
|||
private Ryujinx.Cpu.IExecutionContext[] GetThreads() => GetThreadIds().Select(x => GetThread(x)).ToArray();
|
||||
private ulong? GetThreadUid(Ryujinx.Cpu.IExecutionContext thread) => GetThreadIds().Where(x => GetThread(x) == thread).First();
|
||||
private IVirtualMemoryManager GetMemory() => Device.System.DebugGetApplicationProcess().CpuMemory;
|
||||
private void InvalidateCacheRegion(ulong address, ulong size) =>
|
||||
Device.System.DebugGetApplicationProcess().InvalidateCacheRegion(address, size);
|
||||
|
||||
const int GdbRegisterCount = 68;
|
||||
|
||||
|
@ -436,6 +438,7 @@ namespace Ryujinx.HLE.Debugger
|
|||
}
|
||||
|
||||
GetMemory().Write(addr, data);
|
||||
InvalidateCacheRegion(addr, len);
|
||||
ReplyOK();
|
||||
}
|
||||
catch (InvalidMemoryRegionException)
|
||||
|
|
|
@ -4,9 +4,10 @@ namespace Ryujinx.HLE.Debugger
|
|||
{
|
||||
public interface IDebuggableProcess
|
||||
{
|
||||
public void DebugStopAllThreads();
|
||||
public ulong[] DebugGetThreadUids();
|
||||
public Ryujinx.Cpu.IExecutionContext DebugGetThreadContext(ulong threadUid);
|
||||
public IVirtualMemoryManager CpuMemory { get; }
|
||||
void DebugStopAllThreads();
|
||||
ulong[] DebugGetThreadUids();
|
||||
Ryujinx.Cpu.IExecutionContext DebugGetThreadContext(ulong threadUid);
|
||||
IVirtualMemoryManager CpuMemory { get; }
|
||||
void InvalidateCacheRegion(ulong address, ulong size);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ using LibHac.Fs.Shim;
|
|||
using LibHac.FsSystem;
|
||||
using LibHac.Tools.FsSystem;
|
||||
using Ryujinx.Cpu;
|
||||
using Ryujinx.HLE.Debugger;
|
||||
using Ryujinx.HLE.FileSystem;
|
||||
using Ryujinx.HLE.HOS.Kernel;
|
||||
using Ryujinx.HLE.HOS.Kernel.Memory;
|
||||
|
@ -474,11 +475,11 @@ namespace Ryujinx.HLE.HOS
|
|||
IsPaused = pause;
|
||||
}
|
||||
|
||||
public Debugger.IDebuggableProcess DebugGetApplicationProcess()
|
||||
public IDebuggableProcess DebugGetApplicationProcess()
|
||||
{
|
||||
lock (KernelContext.Processes)
|
||||
{
|
||||
return KernelContext.Processes.Values.Where(x => x.IsApplication).First();
|
||||
return KernelContext.Processes.Values.FirstOrDefault(x => x.IsApplication)?.GdbStubInterface;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,4 +14,4 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
void Execute(IExecutionContext context, ulong codeAddress);
|
||||
void InvalidateCacheRegion(ulong address, ulong size);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Cpu;
|
||||
using Ryujinx.HLE.Debugger;
|
||||
using Ryujinx.HLE.Exceptions;
|
||||
using Ryujinx.HLE.HOS.Kernel.Common;
|
||||
using Ryujinx.HLE.HOS.Kernel.Memory;
|
||||
|
@ -14,7 +15,7 @@ using System.Threading;
|
|||
|
||||
namespace Ryujinx.HLE.HOS.Kernel.Process
|
||||
{
|
||||
class KProcess : KSynchronizationObject, Debugger.IDebuggableProcess
|
||||
class KProcess : KSynchronizationObject
|
||||
{
|
||||
public const uint KernelVersionMajor = 10;
|
||||
public const uint KernelVersionMinor = 4;
|
||||
|
@ -89,6 +90,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
public IVirtualMemoryManager CpuMemory => Context.AddressSpace;
|
||||
|
||||
public HleProcessDebugger Debugger { get; private set; }
|
||||
public IDebuggableProcess GdbStubInterface { get { return new DebuggerInterface(this); } }
|
||||
|
||||
public KProcess(KernelContext context, bool allowCodeMemoryForJit = false) : base(context)
|
||||
{
|
||||
|
@ -1176,30 +1178,47 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
return Capabilities.IsSvcPermitted(svcId);
|
||||
}
|
||||
|
||||
public void DebugStopAllThreads()
|
||||
private class DebuggerInterface : IDebuggableProcess
|
||||
{
|
||||
lock (_threadingLock)
|
||||
private readonly KProcess _parent;
|
||||
|
||||
public DebuggerInterface(KProcess p)
|
||||
{
|
||||
foreach (KThread thread in _threads)
|
||||
_parent = p;
|
||||
}
|
||||
|
||||
public void DebugStopAllThreads()
|
||||
{
|
||||
lock (_parent._threadingLock)
|
||||
{
|
||||
thread.Context.DebugStop();
|
||||
foreach (KThread thread in _parent._threads)
|
||||
{
|
||||
thread.Context.DebugStop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ulong[] DebugGetThreadUids()
|
||||
{
|
||||
lock (_threadingLock)
|
||||
public ulong[] DebugGetThreadUids()
|
||||
{
|
||||
return _threads.Select(x => x.ThreadUid).ToArray();
|
||||
lock (_parent._threadingLock)
|
||||
{
|
||||
return _parent._threads.Select(x => x.ThreadUid).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Ryujinx.Cpu.IExecutionContext DebugGetThreadContext(ulong threadUid)
|
||||
{
|
||||
lock (_threadingLock)
|
||||
public Ryujinx.Cpu.IExecutionContext DebugGetThreadContext(ulong threadUid)
|
||||
{
|
||||
return _threads.Where(x => x.ThreadUid == threadUid).FirstOrDefault()?.Context;
|
||||
lock (_parent._threadingLock)
|
||||
{
|
||||
return _parent._threads.FirstOrDefault(x => x.ThreadUid == threadUid)?.Context;
|
||||
}
|
||||
}
|
||||
|
||||
public IVirtualMemoryManager CpuMemory { get { return _parent.CpuMemory; } }
|
||||
|
||||
public void InvalidateCacheRegion(ulong address, ulong size)
|
||||
{
|
||||
_parent.Context.InvalidateCacheRegion(address, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,4 +34,4 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -36,4 +36,4 @@ namespace Ryujinx.Tests.Cpu
|
|||
_translator.InvalidateJitCacheRegion(address, size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue