diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.cpp b/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.cpp index 5faea1595..44b06c5c3 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.cpp +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.cpp @@ -656,8 +656,9 @@ bool CArmRegInfo::UnMap_ArmReg(ArmReg Reg) } else if (GetArmRegMapped(Reg) == Variable_Mapped) { - CPU_Message(" regcache: unallocate %s from variable mapping", ArmRegName(Reg)); + CPU_Message(" regcache: unallocate %s from variable mapping (%s)", ArmRegName(Reg), VariableMapName(GetVariableMappedTo(Reg))); SetArmRegMapped(Reg, NotMapped); + m_Variable_MappedTo[Reg] = VARIABLE_UNKNOWN; return true; } g_Notify->BreakPoint(__FILE__, __LINE__); @@ -960,4 +961,20 @@ void CArmRegInfo::ProtectGPR(uint32_t Reg) SetArmRegProtected(GetMipsRegMapLo(Reg), true); } +const char * CArmRegInfo::VariableMapName(VARIABLE_MAPPED variable) +{ + switch (variable) + { + case VARIABLE_UNKNOWN: return "UNKNOWN"; + case VARIABLE_GPR: return "_GPR"; + case VARIABLE_FPR: return "_FPR_S"; + case VARIABLE_TLB_READMAP: return "m_TLB_ReadMap"; + case VARIABLE_TLB_LOAD_ADDRESS: return "g_TLBLoadAddress"; + case VARIABLE_NEXT_TIMER: return "g_NextTimer"; + default: + g_Notify->BreakPoint(__FILE__, __LINE__); + return "unknown VariableMapName"; + } +} + #endif \ No newline at end of file diff --git a/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h b/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h index a42a51057..f9bd1c018 100644 --- a/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h +++ b/Source/Project64-core/N64System/Recompiler/Arm/ArmRegInfo.h @@ -75,9 +75,15 @@ public: inline uint32_t GetArmRegMapOrder(ArmReg Reg) const { return m_ArmReg_MapOrder[Reg]; } inline bool GetArmRegProtected(ArmReg Reg) const { return m_ArmReg_Protected[Reg]; } inline REG_MAPPED GetArmRegMapped(ArmReg Reg) const { return m_ArmReg_MappedTo[Reg]; } + inline void SetArmRegMapOrder(ArmReg Reg, uint32_t Order) { m_ArmReg_MapOrder[Reg] = Order; } inline void SetArmRegProtected(ArmReg Reg, bool Protected) { m_ArmReg_Protected[Reg] = Protected; } inline void SetArmRegMapped(ArmReg Reg, REG_MAPPED Mapping) { m_ArmReg_MappedTo[Reg] = Mapping; } + + inline VARIABLE_MAPPED GetVariableMappedTo(ArmReg Reg) const { return m_Variable_MappedTo[Reg]; } + inline void SetVariableMappedTo(ArmReg Reg, VARIABLE_MAPPED variable) { m_Variable_MappedTo[Reg] = variable; } + static const char * VariableMapName(VARIABLE_MAPPED variable); + private: bool ShouldPushPopReg (ArmReg Reg);