mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-11-16 01:55:27 +00:00
fbb4019ed5
* Make GPU memory manager a member of GPU channel * Move physical memory instance to the memory manager, and the caches to the physical memory * PR feedback
51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
using ARMeilleure.Memory;
|
|
using ARMeilleure.State;
|
|
using Ryujinx.Cpu;
|
|
using Ryujinx.Graphics.Gpu;
|
|
using Ryujinx.HLE.HOS.Kernel.Process;
|
|
using Ryujinx.Memory;
|
|
|
|
namespace Ryujinx.HLE.HOS
|
|
{
|
|
class ArmProcessContext<T> : IProcessContext where T : class, IVirtualMemoryManagerTracked, IMemoryManager
|
|
{
|
|
private readonly long _pid;
|
|
private readonly GpuContext _gpuContext;
|
|
private readonly CpuContext _cpuContext;
|
|
private T _memoryManager;
|
|
|
|
public IVirtualMemoryManager AddressSpace => _memoryManager;
|
|
|
|
public ArmProcessContext(long pid, GpuContext gpuContext, T memoryManager, bool for64Bit)
|
|
{
|
|
if (memoryManager is IRefCounted rc)
|
|
{
|
|
rc.IncrementReferenceCount();
|
|
}
|
|
|
|
gpuContext.RegisterProcess(pid, memoryManager);
|
|
|
|
_pid = pid;
|
|
_gpuContext = gpuContext;
|
|
_cpuContext = new CpuContext(memoryManager, for64Bit);
|
|
_memoryManager = memoryManager;
|
|
}
|
|
|
|
public void Execute(ExecutionContext context, ulong codeAddress)
|
|
{
|
|
_cpuContext.Execute(context, codeAddress);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
if (_memoryManager is IRefCounted rc)
|
|
{
|
|
rc.DecrementReferenceCount();
|
|
|
|
_memoryManager = null;
|
|
_gpuContext.UnregisterProcess(_pid);
|
|
}
|
|
}
|
|
}
|
|
}
|