mirror of
https://github.com/holub/mame
synced 2025-07-04 17:38:08 +03:00
m68k: throw mmu configuration exception if SRP/CRP is invalid
This commit is contained in:
parent
be699d5197
commit
d027ffafd6
@ -55,6 +55,7 @@ static constexpr int EXCEPTION_UNINITIALIZED_INTERRUPT = 15;
|
|||||||
static constexpr int EXCEPTION_SPURIOUS_INTERRUPT = 24;
|
static constexpr int EXCEPTION_SPURIOUS_INTERRUPT = 24;
|
||||||
static constexpr int EXCEPTION_INTERRUPT_AUTOVECTOR = 24;
|
static constexpr int EXCEPTION_INTERRUPT_AUTOVECTOR = 24;
|
||||||
static constexpr int EXCEPTION_TRAP_BASE = 32;
|
static constexpr int EXCEPTION_TRAP_BASE = 32;
|
||||||
|
static constexpr int EXCEPTION_MMU_CONFIGURATION = 56; // only on 020/030
|
||||||
|
|
||||||
/* Function codes set by CPU during data/address bus activity */
|
/* Function codes set by CPU during data/address bus activity */
|
||||||
static constexpr int FUNCTION_CODE_USER_DATA = 1;
|
static constexpr int FUNCTION_CODE_USER_DATA = 1;
|
||||||
|
@ -1016,7 +1016,18 @@ void m68881_mmu_ops()
|
|||||||
|
|
||||||
if (m_mmu_tc & 0x80000000)
|
if (m_mmu_tc & 0x80000000)
|
||||||
{
|
{
|
||||||
|
int bits = 0;
|
||||||
|
for(int shift = 20; shift >= 0; shift -= 4) {
|
||||||
|
bits += (m_mmu_tc >> shift) & 0x0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bits != 32 || !((m_mmu_tc >> 23) & 1)) {
|
||||||
|
logerror("MMU: TC invalid!\n");
|
||||||
|
m_mmu_tc &= ~0x80000000;
|
||||||
|
m68ki_exception_trap(EXCEPTION_MMU_CONFIGURATION);
|
||||||
|
} else {
|
||||||
m_pmmu_enabled = 1;
|
m_pmmu_enabled = 1;
|
||||||
|
}
|
||||||
// printf("PMMU enabled\n");
|
// printf("PMMU enabled\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1036,6 +1047,12 @@ void m68881_mmu_ops()
|
|||||||
m_mmu_srp_limit = (temp64>>32) & 0xffffffff;
|
m_mmu_srp_limit = (temp64>>32) & 0xffffffff;
|
||||||
m_mmu_srp_aptr = temp64 & 0xffffffff;
|
m_mmu_srp_aptr = temp64 & 0xffffffff;
|
||||||
// printf("PMMU: SRP limit = %08x aptr = %08x\n", m_mmu_srp_limit, m_mmu_srp_aptr);
|
// printf("PMMU: SRP limit = %08x aptr = %08x\n", m_mmu_srp_limit, m_mmu_srp_aptr);
|
||||||
|
// CRP type 0 is not allowed
|
||||||
|
if ((m_mmu_crp_limit & 3) == 0) {
|
||||||
|
m68ki_exception_trap(EXCEPTION_MMU_CONFIGURATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(modes & 0x100))
|
if (!(modes & 0x100))
|
||||||
{
|
{
|
||||||
pmmu_atc_flush();
|
pmmu_atc_flush();
|
||||||
@ -1047,6 +1064,13 @@ void m68881_mmu_ops()
|
|||||||
m_mmu_crp_limit = (temp64>>32) & 0xffffffff;
|
m_mmu_crp_limit = (temp64>>32) & 0xffffffff;
|
||||||
m_mmu_crp_aptr = temp64 & 0xffffffff;
|
m_mmu_crp_aptr = temp64 & 0xffffffff;
|
||||||
// printf("PMMU: CRP limit = %08x aptr = %08x\n", m_mmu_crp_limit, m_mmu_crp_aptr);
|
// printf("PMMU: CRP limit = %08x aptr = %08x\n", m_mmu_crp_limit, m_mmu_crp_aptr);
|
||||||
|
// CRP type 0 is not allowed
|
||||||
|
if ((m_mmu_crp_limit & 3) == 0) {
|
||||||
|
m68ki_exception_trap(EXCEPTION_MMU_CONFIGURATION);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!(modes & 0x100))
|
if (!(modes & 0x100))
|
||||||
{
|
{
|
||||||
pmmu_atc_flush();
|
pmmu_atc_flush();
|
||||||
|
Loading…
Reference in New Issue
Block a user