Bus: Add memory region access helpers

This commit is contained in:
Connor McLaughlin
2020-12-16 00:12:20 +10:00
parent c95ccbcb5e
commit 9fd1d606d7
2 changed files with 141 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include "types.h"
#include <array>
#include <bitset>
#include <optional>
#include <string>
#include <vector>
@ -149,4 +150,23 @@ ALWAYS_INLINE TickCount GetDMARAMTickCount(u32 word_count)
return static_cast<TickCount>(word_count + ((word_count + 15) / 16));
}
enum class MemoryRegion
{
RAM,
RAMMirror1,
RAMMirror2,
RAMMirror3,
EXP1,
Scratchpad,
BIOS,
Count
};
std::optional<MemoryRegion> GetMemoryRegionForAddress(PhysicalMemoryAddress address);
PhysicalMemoryAddress GetMemoryRegionStart(MemoryRegion region);
PhysicalMemoryAddress GetMemoryRegionEnd(MemoryRegion region);
u8* GetMemoryRegionPointer(MemoryRegion region);
std::optional<PhysicalMemoryAddress> SearchMemory(PhysicalMemoryAddress start_address, const u8* pattern,
const u8* mask, u32 pattern_length);
} // namespace Bus