Core: Reserve memory map as early as possible

Protects against all the other stuff we load eating up all the address space that we want
This commit is contained in:
TellowKrinkle
2026-03-07 09:12:00 -05:00
committed by Ty
parent 2696e304e2
commit 337daf7ed9
4 changed files with 15 additions and 4 deletions
+2
View File
@@ -899,6 +899,8 @@ int main(int argc, char* argv[])
if (!GSRunner::ParseCommandLineArgs(argc, argv, params))
return EXIT_FAILURE;
SysMemory::ReserveMemory();
if (s_use_window.value_or(true) && !GSRunner::CreatePlatformWindow())
{
Console.Error("Failed to create window.");
+2
View File
@@ -2406,6 +2406,8 @@ int main(int argc, char* argv[])
if (!QtHost::ParseCommandLineOptions(app.arguments(), autoboot))
return EXIT_FAILURE;
SysMemory::ReserveMemory();
// Bail out if we can't find any config.
if (!QtHost::InitializeConfig())
return EXIT_FAILURE;
+9 -4
View File
@@ -185,7 +185,6 @@ bool SysMemory::AllocateMemoryMap()
HostMemoryMap::IOPmem = (uptr)(s_data_memory + HostMemoryMap::IOPmemOffset);
HostMemoryMap::VUmem = (uptr)(s_data_memory + HostMemoryMap::VUmemOffset);
DumpMemoryMap();
return true;
}
@@ -235,13 +234,21 @@ void SysMemory::ReleaseMemoryMap()
}
}
void SysMemory::ReserveMemory()
{
if (!s_data_memory_file_handle)
AllocateMemoryMap();
}
bool SysMemory::Allocate()
{
DevCon.WriteLn(Color_StrongBlue, "Allocating host memory for virtual systems...");
if (!AllocateMemoryMap())
if (!s_data_memory_file_handle && !AllocateMemoryMap())
return false;
DumpMemoryMap();
memAllocate();
iopMemAlloc();
vuMemAllocate();
@@ -273,8 +280,6 @@ void SysMemory::Release()
vuMemRelease();
iopMemRelease();
memRelease();
ReleaseMemoryMap();
}
u8* SysMemory::GetDataPtr(size_t offset)
+2
View File
@@ -97,6 +97,8 @@ namespace HostMemoryMap
namespace SysMemory
{
/// Call this as early as possible to maximize chance of getting the address space we want
void ReserveMemory();
bool Allocate();
void Reset();
void Release();