Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #9537 from AdmiralCurtiss/fastmem-error-messages
Core/Memmap: Give more detailed error messages if memory mapping fails.
  • Loading branch information
leoetlino committed Mar 2, 2021
2 parents 010279f + 918f3d9 commit 0c9f11a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Source/Core/Core/HW/Memmap.cpp
Expand Up @@ -18,6 +18,7 @@
#include "Common/CommonTypes.h"
#include "Common/Logging/Log.h"
#include "Common/MemArena.h"
#include "Common/MsgHandler.h"
#include "Common/Swap.h"
#include "Core/Config/MainSettings.h"
#include "Core/ConfigManager.h"
Expand Down Expand Up @@ -299,7 +300,9 @@ void Init()

if (!*region.out_pointer)
{
PanicAlertFmt("MemoryMap_Setup: Failed finding a memory base.");
PanicAlertFmt(
"Memory::Init(): Failed to create view for physical region at 0x{:08X} (size 0x{:08X}).",
region.physical_address, region.size);
exit(0);
}
}
Expand All @@ -321,7 +324,10 @@ bool InitFastmemArena()
physical_base = Common::MemArena::FindMemoryBase();

if (!physical_base)
{
PanicAlertFmt("Memory::InitFastmemArena(): Failed finding a memory base.");
return false;
}

for (PhysicalMemoryRegion& region : physical_regions)
{
Expand All @@ -333,6 +339,9 @@ bool InitFastmemArena()

if (base != view)
{
PanicAlertFmt("Memory::InitFastmemArena(): Failed to map memory region at 0x{:08X} "
"(size 0x{:08X}) into physical fastmem region.",
region.physical_address, region.size);
return false;
}
}
Expand Down Expand Up @@ -379,7 +388,9 @@ void UpdateLogicalMemory(const PowerPC::BatTable& dbat_table)
void* mapped_pointer = g_arena.CreateView(position, mapped_size, base);
if (!mapped_pointer)
{
PanicAlertFmt("MemoryMap_Setup: Failed finding a memory base.");
PanicAlertFmt("Memory::UpdateLogicalMemory(): Failed to map memory region at 0x{:08X} "
"(size 0x{:08X}) into logical fastmem region at 0x{:08X}.",
intersection_start, mapped_size, logical_address);
exit(0);
}
logical_mapped_entries.push_back({mapped_pointer, mapped_size});
Expand Down

0 comments on commit 0c9f11a

Please sign in to comment.