CPU: Handle mirrors of BIOS syscalls

This commit is contained in:
Stenzek 2024-11-11 16:26:51 +10:00
parent 3f41dcc97d
commit 6ffa5bffab
No known key found for this signature in database
3 changed files with 10 additions and 6 deletions

View File

@ -2422,9 +2422,11 @@ template<PGXPMode pgxp_mode, bool debug>
if (s_trace_to_log)
LogInstruction(g_state.current_instruction.bits, g_state.current_instruction_pc, true);
if (g_state.current_instruction_pc == 0xA0) [[unlikely]]
// handle all mirrors of the syscall trampoline
const u32 masked_pc = (g_state.current_instruction_pc & PHYSICAL_MEMORY_ADDRESS_MASK);
if (masked_pc == 0xA0) [[unlikely]]
HandleA0Syscall();
else if (g_state.current_instruction_pc == 0xB0) [[unlikely]]
else if (masked_pc == 0xB0) [[unlikely]]
HandleB0Syscall();
}

View File

@ -84,9 +84,10 @@ void CPU::NewRec::Compiler::BeginBlock()
if (g_settings.bios_tty_logging)
{
if (m_block->pc == 0xa0)
const u32 masked_pc = (m_block->pc & PHYSICAL_MEMORY_ADDRESS_MASK);
if (masked_pc == 0xa0)
GenerateCall(reinterpret_cast<const void*>(&CPU::HandleA0Syscall));
else if (m_block->pc == 0xb0)
else if (masked_pc == 0xb0)
GenerateCall(reinterpret_cast<const void*>(&CPU::HandleB0Syscall));
}

View File

@ -1000,9 +1000,10 @@ void CodeGenerator::BlockPrologue()
if (g_settings.bios_tty_logging)
{
if (m_pc == 0xa0)
const u32 masked_pc = (m_pc & PHYSICAL_MEMORY_ADDRESS_MASK);
if (masked_pc == 0xa0)
EmitFunctionCall(nullptr, &CPU::HandleA0Syscall);
else if (m_pc == 0xb0)
else if (masked_pc == 0xb0)
EmitFunctionCall(nullptr, &CPU::HandleB0Syscall);
}