Split main project into core,graphics and chocolarm4 subproject (#29)
This commit is contained in:
parent
cb665bb715
commit
62b827f474
257 changed files with 415 additions and 285 deletions
35
ChocolArm64/Memory/AMemoryAlloc.cs
Normal file
35
ChocolArm64/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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue