mirror of
https://github.com/holub/mame
synced 2025-07-01 00:09:18 +03:00
arm7: Add debugger privilege callback for 26/32, A/T and user mode changes
This commit is contained in:
parent
1c4be582e9
commit
cf53896b89
@ -300,6 +300,7 @@ void arm7_cpu_device::update_reg_ptr()
|
|||||||
void arm7_cpu_device::set_cpsr(uint32_t val)
|
void arm7_cpu_device::set_cpsr(uint32_t val)
|
||||||
{
|
{
|
||||||
uint8_t old_mode = GET_CPSR & MODE_FLAG;
|
uint8_t old_mode = GET_CPSR & MODE_FLAG;
|
||||||
|
bool call_hook = false;
|
||||||
if (m_archFlags & ARCHFLAG_MODE26)
|
if (m_archFlags & ARCHFLAG_MODE26)
|
||||||
{
|
{
|
||||||
if ((val & 0x10) != (m_r[eCPSR] & 0x10))
|
if ((val & 0x10) != (m_r[eCPSR] & 0x10))
|
||||||
@ -315,6 +316,7 @@ void arm7_cpu_device::set_cpsr(uint32_t val)
|
|||||||
// 32 -> 26
|
// 32 -> 26
|
||||||
m_r[eR15] = (m_r[eR15] & 0x03FFFFFC) /* PC */ | (val & 0xF0000000) /* N Z C V */ | ((val & 0x000000C0) << (26 - 6)) /* I F */ | (val & 0x00000003) /* M1 M0 */;
|
m_r[eR15] = (m_r[eR15] & 0x03FFFFFC) /* PC */ | (val & 0xF0000000) /* N Z C V */ | ((val & 0x000000C0) << (26 - 6)) /* I F */ | (val & 0x00000003) /* M1 M0 */;
|
||||||
}
|
}
|
||||||
|
call_hook = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -329,11 +331,17 @@ void arm7_cpu_device::set_cpsr(uint32_t val)
|
|||||||
{
|
{
|
||||||
val |= 0x10; // force valid mode
|
val |= 0x10; // force valid mode
|
||||||
}
|
}
|
||||||
|
if ((val & T_MASK) != (m_r[eCPSR] & T_MASK))
|
||||||
|
call_hook = true;
|
||||||
m_r[eCPSR] = val;
|
m_r[eCPSR] = val;
|
||||||
if ((GET_CPSR & MODE_FLAG) != old_mode)
|
if ((GET_CPSR & MODE_FLAG) != old_mode)
|
||||||
{
|
{
|
||||||
|
if ((GET_CPSR & MODE_FLAG) == eARM7_MODE_USER || old_mode == eARM7_MODE_USER)
|
||||||
|
call_hook = true;
|
||||||
update_reg_ptr();
|
update_reg_ptr();
|
||||||
}
|
}
|
||||||
|
if (call_hook)
|
||||||
|
debugger_privilege_hook();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1676,8 +1676,8 @@ void arm7_cpu_device::arm7ops_0123(uint32_t insn)
|
|||||||
R15 = GetRegister(insn & 0x0f);
|
R15 = GetRegister(insn & 0x0f);
|
||||||
// If new PC address has A0 set, switch to Thumb mode
|
// If new PC address has A0 set, switch to Thumb mode
|
||||||
if (R15 & 1) {
|
if (R15 & 1) {
|
||||||
set_cpsr(GET_CPSR|T_MASK);
|
|
||||||
R15--;
|
R15--;
|
||||||
|
set_cpsr(GET_CPSR|T_MASK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((insn & 0x0ff000f0) == 0x01200030) // BLX Rn - v5
|
else if ((insn & 0x0ff000f0) == 0x01200030) // BLX Rn - v5
|
||||||
@ -1688,8 +1688,8 @@ void arm7_cpu_device::arm7ops_0123(uint32_t insn)
|
|||||||
R15 = GetRegister(insn & 0x0f);
|
R15 = GetRegister(insn & 0x0f);
|
||||||
// If new PC address has A0 set, switch to Thumb mode
|
// If new PC address has A0 set, switch to Thumb mode
|
||||||
if (R15 & 1) {
|
if (R15 & 1) {
|
||||||
set_cpsr(GET_CPSR|T_MASK);
|
|
||||||
R15--;
|
R15--;
|
||||||
|
set_cpsr(GET_CPSR|T_MASK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((insn & 0x0ff000f0) == 0x01600010) // CLZ - v5
|
else if ((insn & 0x0ff000f0) == 0x01600010) // CLZ - v5
|
||||||
|
Loading…
Reference in New Issue
Block a user