mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-24 13:44:16 +00:00
0c87bf9ea4
* Refactor CPU interface * Use IExecutionContext interface on SVC handler, change how CPU interrupts invokes the handlers * Make CpuEngine take a ITickSource rather than returning one The previous implementation had the scenario where the CPU engine had to implement the tick source in mind, like for example, when we have a hypervisor and the game can read CNTPCT on the host directly. However given that we need to do conversion due to different frequencies anyway, it's not worth it. It's better to just let the user pass the tick source and redirect any reads to CNTPCT to the user tick source * XML docs for the public interfaces * PPTC invalidation due to NativeInterface function name changes * Fix build of the CPU tests * PR feedback
49 lines
1.9 KiB
C#
49 lines
1.9 KiB
C#
using Ryujinx.Common.Configuration;
|
|
using Ryujinx.Cpu;
|
|
using Ryujinx.Cpu.Jit;
|
|
using Ryujinx.Graphics.Gpu;
|
|
using Ryujinx.HLE.HOS.Kernel;
|
|
using Ryujinx.HLE.HOS.Kernel.Process;
|
|
using Ryujinx.Memory;
|
|
using System;
|
|
|
|
namespace Ryujinx.HLE.HOS
|
|
{
|
|
class ArmProcessContextFactory : IProcessContextFactory
|
|
{
|
|
private readonly ICpuEngine _cpuEngine;
|
|
private readonly GpuContext _gpu;
|
|
|
|
public ArmProcessContextFactory(ICpuEngine cpuEngine, GpuContext gpu)
|
|
{
|
|
_cpuEngine = cpuEngine;
|
|
_gpu = gpu;
|
|
}
|
|
|
|
public IProcessContext Create(KernelContext context, ulong pid, ulong addressSpaceSize, InvalidAccessHandler invalidAccessHandler, bool for64Bit)
|
|
{
|
|
MemoryManagerMode mode = context.Device.Configuration.MemoryManagerMode;
|
|
|
|
if (!MemoryBlock.SupportsFlags(MemoryAllocationFlags.ViewCompatible))
|
|
{
|
|
mode = MemoryManagerMode.SoftwarePageTable;
|
|
}
|
|
|
|
switch (mode)
|
|
{
|
|
case MemoryManagerMode.SoftwarePageTable:
|
|
var memoryManager = new MemoryManager(context.Memory, addressSpaceSize, invalidAccessHandler);
|
|
return new ArmProcessContext<MemoryManager>(pid, _cpuEngine, _gpu, memoryManager, for64Bit);
|
|
|
|
case MemoryManagerMode.HostMapped:
|
|
case MemoryManagerMode.HostMappedUnsafe:
|
|
bool unsafeMode = mode == MemoryManagerMode.HostMappedUnsafe;
|
|
var memoryManagerHostMapped = new MemoryManagerHostMapped(context.Memory, addressSpaceSize, unsafeMode, invalidAccessHandler);
|
|
return new ArmProcessContext<MemoryManagerHostMapped>(pid, _cpuEngine, _gpu, memoryManagerHostMapped, for64Bit);
|
|
|
|
default:
|
|
throw new ArgumentOutOfRangeException();
|
|
}
|
|
}
|
|
}
|
|
}
|