mirror of
https://github.com/ARMSX2/ARMSX2.git
synced 2026-08-24 16:50:16 -07:00
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:
@@ -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.");
|
||||
|
||||
@@ -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
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user