aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.HLE
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2024-04-06 13:51:44 -0300
committerGitHub <noreply@github.com>2024-04-06 13:51:44 -0300
commit12b235700cf104163bf8030df0feb6357a40f9d3 (patch)
tree9a3882a69debf74c450b86056a40b427f401580b /src/Ryujinx.HLE
parent3be616207df437695208ceaec9b255db18768610 (diff)
Delete old 16KB page workarounds (#6584)
* Delete old 16KB page workarounds * Rename Supports4KBPage to UsesPrivateAllocations * Format whitespace * This one should be false too * Update XML doc
Diffstat (limited to 'src/Ryujinx.HLE')
-rw-r--r--src/Ryujinx.HLE/HOS/ArmProcessContextFactory.cs2
-rw-r--r--src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTable.cs2
-rw-r--r--src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs12
-rw-r--r--src/Ryujinx.HLE/HOS/Kernel/Memory/KSharedMemory.cs13
4 files changed, 9 insertions, 20 deletions
diff --git a/src/Ryujinx.HLE/HOS/ArmProcessContextFactory.cs b/src/Ryujinx.HLE/HOS/ArmProcessContextFactory.cs
index e8c43326..6646826c 100644
--- a/src/Ryujinx.HLE/HOS/ArmProcessContextFactory.cs
+++ b/src/Ryujinx.HLE/HOS/ArmProcessContextFactory.cs
@@ -75,7 +75,7 @@ namespace Ryujinx.HLE.HOS
// We want to use host tracked mode if the host page size is > 4KB.
if ((mode == MemoryManagerMode.HostMapped || mode == MemoryManagerMode.HostMappedUnsafe) && MemoryBlock.GetPageSize() <= 0x1000)
{
- if (!AddressSpace.TryCreate(context.Memory, addressSpaceSize, MemoryBlock.GetPageSize() == MemoryManagerHostMapped.PageSize, out addressSpace))
+ if (!AddressSpace.TryCreate(context.Memory, addressSpaceSize, out addressSpace))
{
Logger.Warning?.Print(LogClass.Cpu, "Address space creation failed, falling back to software page table");
diff --git a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTable.cs b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTable.cs
index d7b601d1..d262c159 100644
--- a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTable.cs
+++ b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTable.cs
@@ -11,7 +11,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
{
private readonly IVirtualMemoryManager _cpuMemory;
- protected override bool Supports4KBPages => _cpuMemory.Supports4KBPages;
+ protected override bool UsesPrivateAllocations => _cpuMemory.UsesPrivateAllocations;
public KPageTable(KernelContext context, IVirtualMemoryManager cpuMemory, ulong reservedAddressSpaceSize) : base(context, reservedAddressSpaceSize)
{
diff --git a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs
index 6470742d..ae99a434 100644
--- a/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs
+++ b/src/Ryujinx.HLE/HOS/Kernel/Memory/KPageTableBase.cs
@@ -32,7 +32,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
private const int MaxBlocksNeededForInsertion = 2;
protected readonly KernelContext Context;
- protected virtual bool Supports4KBPages => true;
+ protected virtual bool UsesPrivateAllocations => false;
public ulong AddrSpaceStart { get; private set; }
public ulong AddrSpaceEnd { get; private set; }
@@ -1947,17 +1947,17 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
Result result;
- if (srcPageTable.Supports4KBPages)
+ if (srcPageTable.UsesPrivateAllocations)
+ {
+ result = MapForeign(srcPageTable.GetHostRegions(addressRounded, alignedSize), currentVa, alignedSize);
+ }
+ else
{
KPageList pageList = new();
srcPageTable.GetPhysicalRegions(addressRounded, alignedSize, pageList);
result = MapPages(currentVa, pageList, permission, MemoryMapFlags.None);
}
- else
- {
- result = MapForeign(srcPageTable.GetHostRegions(addressRounded, alignedSize), currentVa, alignedSize);
- }
if (result != Result.Success)
{
diff --git a/src/Ryujinx.HLE/HOS/Kernel/Memory/KSharedMemory.cs b/src/Ryujinx.HLE/HOS/Kernel/Memory/KSharedMemory.cs
index e302ee44..e593a7e1 100644
--- a/src/Ryujinx.HLE/HOS/Kernel/Memory/KSharedMemory.cs
+++ b/src/Ryujinx.HLE/HOS/Kernel/Memory/KSharedMemory.cs
@@ -2,7 +2,6 @@ using Ryujinx.Common;
using Ryujinx.HLE.HOS.Kernel.Common;
using Ryujinx.HLE.HOS.Kernel.Process;
using Ryujinx.Horizon.Common;
-using Ryujinx.Memory;
namespace Ryujinx.HLE.HOS.Kernel.Memory
{
@@ -49,17 +48,7 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
return KernelResult.InvalidPermission;
}
- // On platforms with page size > 4 KB, this can fail due to the address not being page aligned,
- // we can return an error to force the application to retry with a different address.
-
- try
- {
- return memoryManager.MapPages(address, _pageList, MemoryState.SharedMemory, permission);
- }
- catch (InvalidMemoryRegionException)
- {
- return KernelResult.InvalidMemState;
- }
+ return memoryManager.MapPages(address, _pageList, MemoryState.SharedMemory, permission);
}
public Result UnmapFromProcess(KPageTableBase memoryManager, ulong address, ulong size, KProcess process)