SwapPage should be after loop

This commit is contained in:
Alex 2023-03-23 23:23:47 +02:00
parent 6a7e940e80
commit c56bc2c4d7
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD

View File

@ -69,12 +69,7 @@ namespace Memory
if (PageBitmap[PageBitmapIndex] == true) if (PageBitmap[PageBitmapIndex] == true)
continue; continue;
this->LockPage((void *)(PageBitmapIndex * PAGE_SIZE)); this->LockPage((void *)(PageBitmapIndex * PAGE_SIZE));
return (void *)(PageBitmapIndex * PAGE_SIZE);
}
if (this->SwapPage((void *)(PageBitmapIndex * PAGE_SIZE)))
{
this->LockPage((void *)(PageBitmapIndex * PAGE_SIZE));
#ifdef DEBUG #ifdef DEBUG
if (EnableExternalMemoryTracer) if (EnableExternalMemoryTracer)
{ {
@ -97,6 +92,12 @@ namespace Memory
return (void *)(PageBitmapIndex * PAGE_SIZE); return (void *)(PageBitmapIndex * PAGE_SIZE);
} }
if (this->SwapPage((void *)(PageBitmapIndex * PAGE_SIZE)))
{
this->LockPage((void *)(PageBitmapIndex * PAGE_SIZE));
return (void *)(PageBitmapIndex * PAGE_SIZE);
}
error("Out of memory! (Free: %ldMB; Used: %ldMB; Reserved: %ldMB)", TO_MB(FreeMemory), TO_MB(UsedMemory), TO_MB(ReservedMemory)); error("Out of memory! (Free: %ldMB; Used: %ldMB; Reserved: %ldMB)", TO_MB(FreeMemory), TO_MB(UsedMemory), TO_MB(ReservedMemory));
CPU::Stop(); CPU::Stop();
__builtin_unreachable(); __builtin_unreachable();