Core: Change TriggerAddressException to SetVPN an R of entry hi in one call

This commit is contained in:
zilmar 2023-11-23 14:20:48 +10:30
parent d47b49d4b5
commit 01673dac8d
2 changed files with 5 additions and 14 deletions

View File

@ -238,16 +238,10 @@ uint32_t COP0EntryHi::R() const
return (uint32_t)((Value >> 62) & 0x3); return (uint32_t)((Value >> 62) & 0x3);
} }
void COP0EntryHi::SetVPN2(uint32_t VPN2) void COP0EntryHi::SetFromAddress(const uint64_t & Address)
{ {
Value &= ~(0x7FFFFFFFll << 13); Value &= ~0xC0000FFFFFFFE000;
Value |= ((uint64_t)(VPN2 & 0x7FFFFFFF)) << 13; Value |= Address & 0xC00000FFFFFFE000;
}
void COP0EntryHi::SetR(uint32_t R)
{
Value &= ~(0x3ll << 62ll);
Value |= ((uint64_t)(R & 0x3)) << 62;
} }
CP0registers::CP0registers(uint64_t * _CP0) : CP0registers::CP0registers(uint64_t * _CP0) :
@ -794,10 +788,8 @@ void CRegisters::TriggerAddressException(uint64_t Address, uint32_t ExceptionCod
ExceptionCode = EXC_MOD; ExceptionCode = EXC_MOD;
} }
} }
BAD_VADDR_REGISTER = Address; BAD_VADDR_REGISTER = Address;
ENTRYHI_REGISTER.SetVPN2((Address >> 13) & 0x7FFFFFF); ENTRYHI_REGISTER.SetFromAddress(Address);
ENTRYHI_REGISTER.SetR(Address >> 62);
CONTEXT_REGISTER.BadVPN2 = Address >> 13; CONTEXT_REGISTER.BadVPN2 = Address >> 13;
XCONTEXT_REGISTER.BadVPN2 = Address >> 13; XCONTEXT_REGISTER.BadVPN2 = Address >> 13;
XCONTEXT_REGISTER.R = Address >> 62; XCONTEXT_REGISTER.R = Address >> 62;

View File

@ -56,8 +56,7 @@ union COP0EntryHi
uint32_t FILL() const; uint32_t FILL() const;
uint32_t R() const; uint32_t R() const;
void SetVPN2(uint32_t VPN2); void SetFromAddress(const uint64_t & Address);
void SetR(uint32_t R);
struct struct
{ {