From f3522b7b70af213a5cb0ec4bfca2865f97bd7e02 Mon Sep 17 00:00:00 2001 From: Albert Liu <45282415+ggrtk@users.noreply.github.com> Date: Sun, 8 Nov 2020 22:19:25 -0800 Subject: [PATCH] Bus: Stub out EXP3 and unknown EXP accesses --- src/core/bus.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ src/core/bus.h | 3 +++ 2 files changed, 45 insertions(+) diff --git a/src/core/bus.cpp b/src/core/bus.cpp index 7b2b8f09a..2739538f0 100644 --- a/src/core/bus.cpp +++ b/src/core/bus.cpp @@ -638,6 +638,40 @@ ALWAYS_INLINE static TickCount DoEXP2Access(u32 offset, u32& value) } } +template +ALWAYS_INLINE static TickCount DoEXP3Access(u32 offset, u32& value) +{ + if constexpr (type == MemoryAccessType::Read) + { + Log_WarningPrintf("EXP3 read: 0x%08X -> 0x%08X", EXP3_BASE | offset); + value = UINT32_C(0xFFFFFFFF); + + return 0; + } + else + { + if (offset == 0) + Log_WarningPrintf("BIOS POST3 status: %02X", value & UINT32_C(0x0F)); + + return 0; + } +} + +template +ALWAYS_INLINE static TickCount DoUnknownEXPAccess(u32 address, u32& value) +{ + if constexpr (type == MemoryAccessType::Read) + { + Log_ErrorPrintf("Unknown EXP read: 0x%08X", address); + return -1; + } + else + { + Log_WarningPrintf("Unknown EXP write: 0x%08X <- 0x%08X", address, value); + return 0; + } +} + template ALWAYS_INLINE static TickCount DoMemoryControlAccess(u32 offset, u32& value) { @@ -1289,6 +1323,14 @@ static ALWAYS_INLINE TickCount DoMemoryAccess(VirtualMemoryAddress address, u32& { return DoEXP2Access(address & EXP2_MASK, value); } + else if (address < EXP3_BASE) + { + return DoUnknownEXPAccess(address, value); + } + else if (address < (EXP3_BASE + EXP3_SIZE)) + { + return DoEXP3Access(address & EXP3_MASK, value); + } else { return DoInvalidAccess(type, size, address, value); diff --git a/src/core/bus.h b/src/core/bus.h index 4be96a83b..05982edd0 100644 --- a/src/core/bus.h +++ b/src/core/bus.h @@ -56,6 +56,9 @@ enum : u32 EXP2_BASE = 0x1F802000, EXP2_SIZE = 0x2000, EXP2_MASK = EXP2_SIZE - 1, + EXP3_BASE = 0x1FA00000, + EXP3_SIZE = 0x1, + EXP3_MASK = EXP3_SIZE - 1, BIOS_BASE = 0x1FC00000, BIOS_SIZE = 0x80000, BIOS_MASK = 0x7FFFF,