aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Kernel/Memory/SharedMemoryStorage.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.HLE/HOS/Kernel/Memory/SharedMemoryStorage.cs')
-rw-r--r--Ryujinx.HLE/HOS/Kernel/Memory/SharedMemoryStorage.cs64
1 files changed, 5 insertions, 59 deletions
diff --git a/Ryujinx.HLE/HOS/Kernel/Memory/SharedMemoryStorage.cs b/Ryujinx.HLE/HOS/Kernel/Memory/SharedMemoryStorage.cs
index cd22b65f..167e0aa9 100644
--- a/Ryujinx.HLE/HOS/Kernel/Memory/SharedMemoryStorage.cs
+++ b/Ryujinx.HLE/HOS/Kernel/Memory/SharedMemoryStorage.cs
@@ -1,8 +1,4 @@
-using Ryujinx.HLE.HOS.Kernel.Process;
-using Ryujinx.Memory;
-using Ryujinx.Memory.Range;
-using System;
-using System.Collections.Generic;
+using System;
namespace Ryujinx.HLE.HOS.Kernel.Memory
{
@@ -12,9 +8,6 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
private readonly KPageList _pageList;
private readonly ulong _size;
- private IVirtualMemoryManager _borrowerMemory;
- private ulong _borrowerVa;
-
public SharedMemoryStorage(KernelContext context, KPageList pageList)
{
_context = context;
@@ -29,24 +22,6 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
}
}
- public void Borrow(KProcess dstProcess, ulong va)
- {
- ulong currentOffset = 0;
-
- foreach (KPageNode pageNode in _pageList)
- {
- ulong address = pageNode.Address - DramMemoryMap.DramBase;
- ulong size = pageNode.PagesCount * KPageTableBase.PageSize;
-
- dstProcess.CpuMemory.Write(va + currentOffset, _context.Memory.GetSpan(address + currentOffset, (int)size));
-
- currentOffset += size;
- }
-
- _borrowerMemory = dstProcess.CpuMemory;
- _borrowerVa = va;
- }
-
public void ZeroFill()
{
for (ulong offset = 0; offset < _size; offset += sizeof(ulong))
@@ -57,42 +32,13 @@ namespace Ryujinx.HLE.HOS.Kernel.Memory
public ref T GetRef<T>(ulong offset) where T : unmanaged
{
- if (_borrowerMemory == null)
+ if (_pageList.Nodes.Count == 1)
{
- if (_pageList.Nodes.Count == 1)
- {
- ulong address = _pageList.Nodes.First.Value.Address - DramMemoryMap.DramBase;
- return ref _context.Memory.GetRef<T>(address + offset);
- }
-
- throw new NotImplementedException("Non-contiguous shared memory is not yet supported.");
- }
- else
- {
- return ref _borrowerMemory.GetRef<T>(_borrowerVa + offset);
+ ulong address = _pageList.Nodes.First.Value.Address - DramMemoryMap.DramBase;
+ return ref _context.Memory.GetRef<T>(address + offset);
}
- }
-
- public IEnumerable<HostMemoryRange> GetRanges()
- {
- if (_borrowerMemory == null)
- {
- var ranges = new List<HostMemoryRange>();
-
- foreach (KPageNode pageNode in _pageList)
- {
- ulong address = pageNode.Address - DramMemoryMap.DramBase;
- ulong size = pageNode.PagesCount * KPageTableBase.PageSize;
-
- ranges.Add(new HostMemoryRange(_context.Memory.GetPointer(address, size), size));
- }
- return ranges;
- }
- else
- {
- return _borrowerMemory.GetPhysicalRegions(_borrowerVa, _size);
- }
+ throw new NotImplementedException("Non-contiguous shared memory is not yet supported.");
}
public KPageList GetPageList()