--- tme/machine/sun2/sun2-mmu.c 2018/04/24 16:43:21 1.1.1.5 +++ tme/machine/sun2/sun2-mmu.c 2018/04/24 16:45:19 1.1.1.6 @@ -1,4 +1,4 @@ -/* $Id: sun2-mmu.c,v 1.1.1.5 2018/04/24 16:43:21 root Exp $ */ +/* $Id: sun2-mmu.c,v 1.1.1.6 2018/04/24 16:45:19 root Exp $ */ /* machine/sun2/sun2-mmu.c - implementation of Sun 2 MMU emulation: */ @@ -34,7 +34,7 @@ */ #include -_TME_RCSID("$Id: sun2-mmu.c,v 1.1.1.5 2018/04/24 16:43:21 root Exp $"); +_TME_RCSID("$Id: sun2-mmu.c,v 1.1.1.6 2018/04/24 16:45:19 root Exp $"); /* includes: */ #include "sun2-impl.h" @@ -70,6 +70,9 @@ _TME_RCSID("$Id: sun2-mmu.c,v 1.1.1.5 20 /* real context count: */ #define TME_SUN2_CONTEXT_COUNT (8) +int bradshow; +int jamdelay; + /* this logs a bus error: */ #ifndef TME_NO_LOG static void @@ -174,6 +177,12 @@ _tme_sun2_obio_fault_handler(void *_sun2 { tme_uint8_t all_bits_one[sizeof(tme_uint16_t)]; +#if 0 + { + extern int printf(const char *format, ...); + printf("_tme_sun2_obio_fault_handler() %08x\n", (int)cycle->tme_bus_cycle_address); + } +#endif /* the sun2 obio bus doesn't generate bus errors, it just reads all-bits-one: */ memset(all_bits_one, 0xff, sizeof(all_bits_one)); @@ -191,6 +200,12 @@ _tme_sun2_obmem_fault_handler(void *_sun /* the sun2 obmem bus apparently doesn't generate bus errors below 0x700000, and instead just reads all-bits-one: */ +#if 0 + { + extern int printf(const char *format, ...); + printf("_tme_sun2_obmem_fault_handler() %08x\n", (int)cycle->tme_bus_cycle_address); + } +#endif if (cycle->tme_bus_cycle_address < 0x700000) { memset(all_bits_one, 0xff, sizeof(all_bits_one)); tme_bus_cycle_xfer_memory(cycle, @@ -208,6 +223,15 @@ static int _tme_sun2_multibus_fault_handler(void *_sun2, struct tme_bus_tlb *tlb, struct tme_bus_cycle *cycle, int rc) { +#if 1 + { + extern int printf(const char *format, ...); + printf("_tme_sun2_multibus_fault_handler() %08x, rc %d\n", (int)cycle->tme_bus_cycle_address, rc); + } + if ((int)cycle->tme_bus_cycle_address == 0) + rc = ENOENT; +#endif + /* call the common bus fault handler: */ return (_tme_sun2_bus_fault_handler((struct tme_sun2 *) _sun2, tlb, cycle, rc)); } @@ -432,6 +456,14 @@ _tme_sun2_bus_tlb_fill(struct tme_bus_co case TME_SUN2_BUS_MBMEM: base = 0xf00000; size = TME_SUN2_DVMA_SIZE_MBMEM; + +#if 0 + if (1) { + extern int printf(const char *format, ...); + printf("_tme_sun2_bus_tlb_fill; address %x\n", (int)address); + } +#endif + break; case TME_SUN2_BUS_VME: @@ -469,6 +501,8 @@ _tme_sun2_bus_tlb_fill(struct tme_bus_co return (TME_OK); } +//#include "m68k-impl.h" + /* our post-MMU TLB filler: */ static int _tme_sun2_tlb_fill_mmu(void *_sun2, struct tme_bus_tlb *tlb, @@ -501,8 +535,32 @@ _tme_sun2_tlb_fill_mmu(void *_sun2, stru /* add in the page offset to finish the address: */ address |= *_address & (TME_SUN2_PAGE_SIZE - 1); +#if 0 + if ((int)address > 0xffffff || (int)address < 0xef0000) + { + extern int printf(const char *format, ...); + struct tme_sun2 *s2 = (struct tme_sun2 *)sun2; + struct tme_m68k *m68k; + extern unsigned int _tme_m68010_get_pc(struct tme_m68k *ic); + + m68k = s2->tme_sun2_m68k->tme_m68k_bus_connection.tme_bus_connection.tme_connection_element->tme_element_private; + + if (_tme_m68010_get_pc(m68k) == 0x3c3bc) bradshow = 1; + + if (_tme_m68010_get_pc(m68k) == 0x3c3bc && address == 0 && jamdelay == 0) { + jamdelay = 2; + } + + if (bradshow) + printf("_tme_sun2_tlb_fill_mmu; address %08x, vir %08x, bus_type %d, boot %x, pc %08x\n", + (int)address, (int)_address, (int)bus_type, + (s2->tme_sun2_enable & TME_SUN2_ENA_NOTBOOT) ? 1 : 0, + _tme_m68010_get_pc(m68k)); + } +#endif *_address = address; + /* if this is obio: */ if (bus_type == TME_SUN2_PGTYPE_OBIO) { conn_bus = sun2->tme_sun2_obio; @@ -548,11 +606,38 @@ _tme_sun2_tlb_fill_mmu(void *_sun2, stru rc = ((*conn_bus->tme_bus_tlb_fill) (conn_bus, tlb, address, cycles)); +#if 0 + if (bus_type == TME_SUN2_PGTYPE_MBMEM && bradshow) { + extern int printf(const char *format, ...); + printf("_tme_sun2_tlb_fill_mmu; rc %d\n", rc); + } +#endif + /* if the bus TLB filler succeeded, add our bus fault handler: */ if (rc == TME_OK) { TME_BUS_TLB_FAULT_HANDLER(tlb, bus_fault_handler, sun2); } +#if 0 + if (rc == TME_OK) { + if (jamdelay) { + jamdelay--; + if (jamdelay == 0) { +// tlb->tme_bus_tlb_cycles_ok &= ~(TME_BUS_CYCLE_READ | TME_BUS_CYCLE_WRITE); + + struct tme_bus_cycle c; + c.tme_bus_cycle_address = address; + _tme_sun2_bus_fault_handler(sun2, tlb, &c, ENOENT); + bradshow = 0; +// rc = ENOENT; + + extern int printf(const char *format, ...); + printf("waah. jamdelay went off\n"); + } + } + } +#endif + return (rc); }