diff options
Diffstat (limited to 'Ryujinx.HLE/HOS/Kernel/KernelInit.cs')
-rw-r--r-- | Ryujinx.HLE/HOS/Kernel/KernelInit.cs | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/Ryujinx.HLE/HOS/Kernel/KernelInit.cs b/Ryujinx.HLE/HOS/Kernel/KernelInit.cs index a797951b..efb514c1 100644 --- a/Ryujinx.HLE/HOS/Kernel/KernelInit.cs +++ b/Ryujinx.HLE/HOS/Kernel/KernelInit.cs @@ -4,28 +4,28 @@ namespace Ryujinx.HLE.HOS.Kernel { static class KernelInit { - public static void InitializeResourceLimit(KResourceLimit resourceLimit) + public static void InitializeResourceLimit(KResourceLimit ResourceLimit) { - void EnsureSuccess(KernelResult result) + void EnsureSuccess(KernelResult Result) { - if (result != KernelResult.Success) + if (Result != KernelResult.Success) { - throw new InvalidOperationException($"Unexpected result \"{result}\"."); + throw new InvalidOperationException($"Unexpected result \"{Result}\"."); } } - int kernelMemoryCfg = 0; + int KernelMemoryCfg = 0; - long ramSize = GetRamSize(kernelMemoryCfg); + long RamSize = GetRamSize(KernelMemoryCfg); - EnsureSuccess(resourceLimit.SetLimitValue(LimitableResource.Memory, ramSize)); - EnsureSuccess(resourceLimit.SetLimitValue(LimitableResource.Thread, 800)); - EnsureSuccess(resourceLimit.SetLimitValue(LimitableResource.Event, 700)); - EnsureSuccess(resourceLimit.SetLimitValue(LimitableResource.TransferMemory, 200)); - EnsureSuccess(resourceLimit.SetLimitValue(LimitableResource.Session, 900)); + EnsureSuccess(ResourceLimit.SetLimitValue(LimitableResource.Memory, RamSize)); + EnsureSuccess(ResourceLimit.SetLimitValue(LimitableResource.Thread, 800)); + EnsureSuccess(ResourceLimit.SetLimitValue(LimitableResource.Event, 700)); + EnsureSuccess(ResourceLimit.SetLimitValue(LimitableResource.TransferMemory, 200)); + EnsureSuccess(ResourceLimit.SetLimitValue(LimitableResource.Session, 900)); - if (!resourceLimit.Reserve(LimitableResource.Memory, 0) || - !resourceLimit.Reserve(LimitableResource.Memory, 0x60000)) + if (!ResourceLimit.Reserve(LimitableResource.Memory, 0) || + !ResourceLimit.Reserve(LimitableResource.Memory, 0x60000)) { throw new InvalidOperationException("Unexpected failure reserving memory on resource limit."); } @@ -33,99 +33,99 @@ namespace Ryujinx.HLE.HOS.Kernel public static KMemoryRegionManager[] GetMemoryRegions() { - KMemoryArrange arrange = GetMemoryArrange(); + KMemoryArrange Arrange = GetMemoryArrange(); return new KMemoryRegionManager[] { - GetMemoryRegion(arrange.Application), - GetMemoryRegion(arrange.Applet), - GetMemoryRegion(arrange.Service), - GetMemoryRegion(arrange.NvServices) + GetMemoryRegion(Arrange.Application), + GetMemoryRegion(Arrange.Applet), + GetMemoryRegion(Arrange.Service), + GetMemoryRegion(Arrange.NvServices) }; } - private static KMemoryRegionManager GetMemoryRegion(KMemoryArrangeRegion region) + private static KMemoryRegionManager GetMemoryRegion(KMemoryArrangeRegion Region) { - return new KMemoryRegionManager(region.Address, region.Size, region.EndAddr); + return new KMemoryRegionManager(Region.Address, Region.Size, Region.EndAddr); } private static KMemoryArrange GetMemoryArrange() { - int mcEmemCfg = 0x1000; + int McEmemCfg = 0x1000; - ulong ememApertureSize = (ulong)(mcEmemCfg & 0x3fff) << 20; + ulong EmemApertureSize = (ulong)(McEmemCfg & 0x3fff) << 20; - int kernelMemoryCfg = 0; + int KernelMemoryCfg = 0; - ulong ramSize = (ulong)GetRamSize(kernelMemoryCfg); + ulong RamSize = (ulong)GetRamSize(KernelMemoryCfg); - ulong ramPart0; - ulong ramPart1; + ulong RamPart0; + ulong RamPart1; - if (ramSize * 2 > ememApertureSize) + if (RamSize * 2 > EmemApertureSize) { - ramPart0 = ememApertureSize / 2; - ramPart1 = ememApertureSize / 2; + RamPart0 = EmemApertureSize / 2; + RamPart1 = EmemApertureSize / 2; } else { - ramPart0 = ememApertureSize; - ramPart1 = 0; + RamPart0 = EmemApertureSize; + RamPart1 = 0; } - int memoryArrange = 1; + int MemoryArrange = 1; - ulong applicationRgSize; + ulong ApplicationRgSize; - switch (memoryArrange) + switch (MemoryArrange) { - case 2: applicationRgSize = 0x80000000; break; + case 2: ApplicationRgSize = 0x80000000; break; case 0x11: - case 0x21: applicationRgSize = 0x133400000; break; - default: applicationRgSize = 0xcd500000; break; + case 0x21: ApplicationRgSize = 0x133400000; break; + default: ApplicationRgSize = 0xcd500000; break; } - ulong appletRgSize; + ulong AppletRgSize; - switch (memoryArrange) + switch (MemoryArrange) { - case 2: appletRgSize = 0x61200000; break; - case 3: appletRgSize = 0x1c000000; break; - case 0x11: appletRgSize = 0x23200000; break; + case 2: AppletRgSize = 0x61200000; break; + case 3: AppletRgSize = 0x1c000000; break; + case 0x11: AppletRgSize = 0x23200000; break; case 0x12: - case 0x21: appletRgSize = 0x89100000; break; - default: appletRgSize = 0x1fb00000; break; + case 0x21: AppletRgSize = 0x89100000; break; + default: AppletRgSize = 0x1fb00000; break; } - KMemoryArrangeRegion serviceRg; - KMemoryArrangeRegion nvServicesRg; - KMemoryArrangeRegion appletRg; - KMemoryArrangeRegion applicationRg; + KMemoryArrangeRegion ServiceRg; + KMemoryArrangeRegion NvServicesRg; + KMemoryArrangeRegion AppletRg; + KMemoryArrangeRegion ApplicationRg; - const ulong nvServicesRgSize = 0x29ba000; + const ulong NvServicesRgSize = 0x29ba000; - ulong applicationRgEnd = DramMemoryMap.DramEnd; //- RamPart0; + ulong ApplicationRgEnd = DramMemoryMap.DramEnd; //- RamPart0; - applicationRg = new KMemoryArrangeRegion(applicationRgEnd - applicationRgSize, applicationRgSize); + ApplicationRg = new KMemoryArrangeRegion(ApplicationRgEnd - ApplicationRgSize, ApplicationRgSize); - ulong nvServicesRgEnd = applicationRg.Address - appletRgSize; + ulong NvServicesRgEnd = ApplicationRg.Address - AppletRgSize; - nvServicesRg = new KMemoryArrangeRegion(nvServicesRgEnd - nvServicesRgSize, nvServicesRgSize); - appletRg = new KMemoryArrangeRegion(nvServicesRgEnd, appletRgSize); + NvServicesRg = new KMemoryArrangeRegion(NvServicesRgEnd - NvServicesRgSize, NvServicesRgSize); + AppletRg = new KMemoryArrangeRegion(NvServicesRgEnd, AppletRgSize); //Note: There is an extra region used by the kernel, however //since we are doing HLE we are not going to use that memory, so give all //the remaining memory space to services. - ulong serviceRgSize = nvServicesRg.Address - DramMemoryMap.SlabHeapEnd; + ulong ServiceRgSize = NvServicesRg.Address - DramMemoryMap.SlabHeapEnd; - serviceRg = new KMemoryArrangeRegion(DramMemoryMap.SlabHeapEnd, serviceRgSize); + ServiceRg = new KMemoryArrangeRegion(DramMemoryMap.SlabHeapEnd, ServiceRgSize); - return new KMemoryArrange(serviceRg, nvServicesRg, appletRg, applicationRg); + return new KMemoryArrange(ServiceRg, NvServicesRg, AppletRg, ApplicationRg); } - private static long GetRamSize(int kernelMemoryCfg) + private static long GetRamSize(int KernelMemoryCfg) { - switch ((kernelMemoryCfg >> 16) & 3) + switch ((KernelMemoryCfg >> 16) & 3) { case 1: return 0x180000000; case 2: return 0x200000000; |