Implement PM GetProcessInfo atmosphere extension (partially) (#2966)
This commit is contained in:
parent
1cbca5eecb
commit
556be08c4e
6 changed files with 63 additions and 15 deletions
|
@ -59,5 +59,15 @@ namespace Ryujinx.HLE.HOS.Kernel
|
|||
{
|
||||
return GetCurrentThread().Owner;
|
||||
}
|
||||
|
||||
internal static KProcess GetProcessByPid(ulong pid)
|
||||
{
|
||||
if (Context.Processes.TryGetValue(pid, out KProcess process))
|
||||
{
|
||||
return process;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
|
||||
public KProcessCapabilities Capabilities { get; private set; }
|
||||
|
||||
public bool AllowCodeMemoryForJit { get; private set; }
|
||||
|
||||
public ulong TitleId { get; private set; }
|
||||
public bool IsApplication { get; private set; }
|
||||
public ulong Pid { get; private set; }
|
||||
|
@ -90,7 +92,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
|
||||
public HleProcessDebugger Debugger { get; private set; }
|
||||
|
||||
public KProcess(KernelContext context) : base(context)
|
||||
public KProcess(KernelContext context, bool allowCodeMemoryForJit = false) : base(context)
|
||||
{
|
||||
_processLock = new object();
|
||||
_threadingLock = new object();
|
||||
|
@ -102,6 +104,8 @@ namespace Ryujinx.HLE.HOS.Kernel.Process
|
|||
|
||||
Capabilities = new KProcessCapabilities();
|
||||
|
||||
AllowCodeMemoryForJit = allowCodeMemoryForJit;
|
||||
|
||||
RandomEntropy = new ulong[KScheduler.CpuCoresCount];
|
||||
PinnedThreads = new KThread[KScheduler.CpuCoresCount];
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ using Ryujinx.HLE.HOS.Kernel.Ipc;
|
|||
using Ryujinx.HLE.HOS.Kernel.Memory;
|
||||
using Ryujinx.HLE.HOS.Kernel.Process;
|
||||
using Ryujinx.HLE.HOS.Kernel.Threading;
|
||||
using Ryujinx.Memory;
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
|
@ -1363,10 +1362,10 @@ namespace Ryujinx.HLE.HOS.Kernel.SupervisorCall
|
|||
|
||||
KCodeMemory codeMemory = currentProcess.HandleTable.GetObject<KCodeMemory>(handle);
|
||||
|
||||
// Newer versions of the return also returns an error here if the owner and process
|
||||
// Newer versions of the kernel also returns an error here if the owner and process
|
||||
// where the operation will happen are the same. We do not return an error here
|
||||
// because some homebrew requires this to be patched out to work (for JIT).
|
||||
if (codeMemory == null /* || codeMemory.Owner == currentProcess */)
|
||||
// for homebrew because some of them requires this to be patched out to work (for JIT).
|
||||
if (codeMemory == null || (!currentProcess.AllowCodeMemoryForJit && codeMemory.Owner == currentProcess))
|
||||
{
|
||||
return KernelResult.InvalidHandle;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue