diff --git a/src/core/cpu_code_cache.cpp b/src/core/cpu_code_cache.cpp index 6f6d3e242..593807f26 100644 --- a/src/core/cpu_code_cache.cpp +++ b/src/core/cpu_code_cache.cpp @@ -948,7 +948,6 @@ bool CPU::CodeCache::ReadBlockInstructions(u32 start_pc, BlockInstructionList* i InstructionInfo info; std::memset(&info, 0, sizeof(info)); - info.pc = pc; info.is_branch_delay_slot = is_branch_delay_slot; info.is_load_delay_slot = is_load_delay_slot; info.is_branch_instruction = IsBranchInstruction(instruction); @@ -985,18 +984,18 @@ bool CPU::CodeCache::ReadBlockInstructions(u32 start_pc, BlockInstructionList* i const BlockInstructionInfoPair& prev = instructions->back(); if (!prev.second.is_unconditional_branch_instruction || !prev.second.is_direct_branch_instruction) { - WARNING_LOG("Conditional or indirect branch delay slot at {:08X}, skipping block", info.pc); + WARNING_LOG("Conditional or indirect branch delay slot at {:08X}, skipping block", pc); return false; } if (!IsDirectBranchInstruction(instruction)) { - WARNING_LOG("Indirect branch in delay slot at {:08X}, skipping block", info.pc); + WARNING_LOG("Indirect branch in delay slot at {:08X}, skipping block", pc); return false; } // we _could_ fetch the delay slot from the first branch's target, but it's probably in a different // page, and that's an invalidation nightmare. so just fallback to the int, this is very rare anyway. - WARNING_LOG("Direct branch in delay slot at {:08X}, skipping block", info.pc); + WARNING_LOG("Direct branch in delay slot at {:08X}, skipping block", pc); return false; } @@ -1029,14 +1028,16 @@ bool CPU::CodeCache::ReadBlockInstructions(u32 start_pc, BlockInstructionList* i #if defined(_DEBUG) || defined(_DEVEL) SmallString disasm; + u32 disasm_pc = start_pc; DEBUG_LOG("Block at 0x{:08X}", start_pc); DEBUG_LOG(" Uncached fetch ticks: {}", metadata->uncached_fetch_ticks); DEBUG_LOG(" ICache line count: {}", metadata->icache_line_count); for (const auto& cbi : *instructions) { - CPU::DisassembleInstruction(&disasm, cbi.second.pc, cbi.first.bits); + CPU::DisassembleInstruction(&disasm, disasm_pc, cbi.first.bits); DEBUG_LOG("[{} {} 0x{:08X}] {:08X} {}", cbi.second.is_branch_delay_slot ? "BD" : " ", - cbi.second.is_load_delay_slot ? "LD" : " ", cbi.second.pc, cbi.first.bits, disasm); + cbi.second.is_load_delay_slot ? "LD" : " ", disasm_pc, cbi.first.bits, disasm); + disasm_pc += sizeof(Instruction); } #endif diff --git a/src/core/cpu_code_cache_private.h b/src/core/cpu_code_cache_private.h index 46f639f82..2e574e971 100644 --- a/src/core/cpu_code_cache_private.h +++ b/src/core/cpu_code_cache_private.h @@ -37,8 +37,6 @@ enum RegInfoFlags : u8 struct InstructionInfo { - u32 pc; // TODO: Remove this, old recs still depend on it. - bool is_branch_instruction : 1; bool is_direct_branch_instruction : 1; bool is_unconditional_branch_instruction : 1; diff --git a/src/core/cpu_core.cpp b/src/core/cpu_core.cpp index 87d280c7b..a6e9e000f 100644 --- a/src/core/cpu_core.cpp +++ b/src/core/cpu_core.cpp @@ -2549,7 +2549,7 @@ void CPU::CodeCache::InterpretCachedBlock(const Block* block) // now executing the instruction we previously fetched g_state.current_instruction.bits = instruction->bits; - g_state.current_instruction_pc = info->pc; + g_state.current_instruction_pc = g_state.pc; g_state.current_instruction_in_branch_delay_slot = info->is_branch_delay_slot; // TODO: let int set it instead g_state.current_instruction_was_branch_taken = g_state.branch_was_taken; g_state.branch_was_taken = false; diff --git a/src/core/cpu_recompiler_arm32.cpp b/src/core/cpu_recompiler_arm32.cpp index 85c0e4915..06fb84fc4 100644 --- a/src/core/cpu_recompiler_arm32.cpp +++ b/src/core/cpu_recompiler_arm32.cpp @@ -1024,7 +1024,7 @@ void CPU::ARM32Recompiler::Flush(u32 flags) void CPU::ARM32Recompiler::Compile_Fallback() { - WARNING_LOG("Compiling instruction fallback at PC=0x{:08X}, instruction=0x{:08X}", iinfo->pc, inst->bits); + WARNING_LOG("Compiling instruction fallback at PC=0x{:08X}, instruction=0x{:08X}", m_current_instruction_pc, inst->bits); Flush(FLUSH_FOR_INTERPRETER); diff --git a/src/core/cpu_recompiler_arm64.cpp b/src/core/cpu_recompiler_arm64.cpp index 02a5773c1..ac47aa082 100644 --- a/src/core/cpu_recompiler_arm64.cpp +++ b/src/core/cpu_recompiler_arm64.cpp @@ -1174,7 +1174,7 @@ void CPU::ARM64Recompiler::Flush(u32 flags) void CPU::ARM64Recompiler::Compile_Fallback() { - WARNING_LOG("Compiling instruction fallback at PC=0x{:08X}, instruction=0x{:08X}", iinfo->pc, inst->bits); + WARNING_LOG("Compiling instruction fallback at PC=0x{:08X}, instruction=0x{:08X}", m_current_instruction_pc, inst->bits); Flush(FLUSH_FOR_INTERPRETER); diff --git a/src/core/cpu_recompiler_riscv64.cpp b/src/core/cpu_recompiler_riscv64.cpp index e6045fa88..c78356617 100644 --- a/src/core/cpu_recompiler_riscv64.cpp +++ b/src/core/cpu_recompiler_riscv64.cpp @@ -996,7 +996,7 @@ void CPU::RISCV64Recompiler::Flush(u32 flags) void CPU::RISCV64Recompiler::Compile_Fallback() { - WARNING_LOG("Compiling instruction fallback at PC=0x{:08X}, instruction=0x{:08X}", iinfo->pc, inst->bits); + WARNING_LOG("Compiling instruction fallback at PC=0x{:08X}, instruction=0x{:08X}", m_current_instruction_pc, inst->bits); Flush(FLUSH_FOR_INTERPRETER); diff --git a/src/core/cpu_recompiler_x64.cpp b/src/core/cpu_recompiler_x64.cpp index b4c45e9af..e9da3db2c 100644 --- a/src/core/cpu_recompiler_x64.cpp +++ b/src/core/cpu_recompiler_x64.cpp @@ -928,7 +928,7 @@ void CPU::X64Recompiler::Flush(u32 flags) void CPU::X64Recompiler::Compile_Fallback() { - WARNING_LOG("Compiling instruction fallback at PC=0x{:08X}, instruction=0x{:08X}", iinfo->pc, inst->bits); + WARNING_LOG("Compiling instruction fallback at PC=0x{:08X}, instruction=0x{:08X}", m_current_instruction_pc, inst->bits); Flush(FLUSH_FOR_INTERPRETER);