Files
Kenji-NX/src/Ryujinx.HLE/HOS/Kernel/KernelStatic.cs
T
LotPandKeatonTheBot 42727fca07 12 GiB heap support
The heap was limited to 6 GiB no matter the memory setting, causing memory configurations above 8 GiB to not actually affect the heap size.

Now when the memory config is set to [10 or] 12 GiB the heap also allocates 12 GiB.

The SetHeapSize SysCall will now allow heap sizes up to 12 GiB (technically slightly less).

Co-authored-by: KeatonTheBot <keaton@ryujinx.app>
2025-10-15 21:49:11 -05:00

75 lines
1.9 KiB
C#

using Ryujinx.HLE.HOS.Kernel.Memory;
using Ryujinx.HLE.HOS.Kernel.Process;
using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.Horizon.Common;
using System;
using System.Threading;
namespace Ryujinx.HLE.HOS.Kernel
{
static class KernelStatic
{
[ThreadStatic]
private static KernelContext _context;
[ThreadStatic]
private static KThread _currentThread;
public static Result StartInitialProcess(
KernelContext context,
ProcessCreationInfo creationInfo,
ReadOnlySpan<uint> capabilities,
int mainThreadPriority,
ThreadStart customThreadStart)
{
KProcess process = new(context);
Result result = process.Initialize(
creationInfo,
capabilities,
context.ResourceLimit,
MemoryRegion.Service,
context.Device.Configuration.MemoryConfiguration,
null,
customThreadStart);
if (result != Result.Success)
{
return result;
}
process.DefaultCpuCore = KScheduler.CpuCoresCount - 1;
context.Processes.TryAdd(process.Pid, process);
return process.Start(mainThreadPriority, 0x1000UL);
}
internal static void SetKernelContext(KernelContext context, KThread thread)
{
_context = context;
_currentThread = thread;
}
internal static KThread GetCurrentThread()
{
return _currentThread;
}
internal static KProcess GetCurrentProcess()
{
return GetCurrentThread().Owner;
}
internal static KProcess GetProcessByPid(ulong pid)
{
if (_context.Processes.TryGetValue(pid, out KProcess process))
{
return process;
}
return null;
}
}
}