mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-08-08 19:28:27 +02:00
aloha
This commit is contained in:
35
Ryujinx/Cpu/Memory/AMemoryAlloc.cs
Normal file
35
Ryujinx/Cpu/Memory/AMemoryAlloc.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using ChocolArm64.Exceptions;
|
||||
|
||||
namespace ChocolArm64.Memory
|
||||
{
|
||||
public class AMemoryAlloc
|
||||
{
|
||||
private long PhysPos;
|
||||
|
||||
public long Alloc(long Size)
|
||||
{
|
||||
long Position = PhysPos;
|
||||
|
||||
Size = AMemoryHelper.PageRoundUp(Size);
|
||||
|
||||
PhysPos += Size;
|
||||
|
||||
if (PhysPos > AMemoryMgr.RamSize || PhysPos < 0)
|
||||
{
|
||||
throw new VmmOutOfMemoryException(Size);
|
||||
}
|
||||
|
||||
return Position;
|
||||
}
|
||||
|
||||
public void Free(long Position)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
public long GetFreeMem()
|
||||
{
|
||||
return AMemoryMgr.RamSize - PhysPos;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user