diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/bus/multibus/sun-mie.c tme-0.8/bus/multibus/sun-mie.c --- tme-0.8-orig/bus/multibus/sun-mie.c 2010-06-05 09:57:27.000000000 -0400 +++ tme-0.8/bus/multibus/sun-mie.c 2011-08-01 15:35:48.000000000 -0400 @@ -158,6 +158,10 @@ /* the callout flags: */ int tme_sun_mie_callout_flags; + int tme_sun_mie_ca_callout_delay; + int tme_sun_mie_ca_callout_pending; + int tme_sun_mie_pending_deassert_intr; + /* if our interrupt line is currently asserted: */ int tme_sun_mie_int_asserted; @@ -200,6 +204,8 @@ static const struct tme_bus_signals _tme_sun_mie_bus_signals_generic = TME_BUS_SIGNALS_GENERIC; static const struct tme_bus_signals _tme_sun_mie_bus_signals_i825x6 = TME_BUS_SIGNALS_I825X6; +extern int printf(const char *format, ...); + /* the sun_mie callout function. it must be called with the mutex locked: */ static void _tme_sun_mie_callout(struct tme_sun_mie *sun_mie, int new_callouts) @@ -286,6 +292,12 @@ /* unlock the mutex: */ tme_mutex_unlock(&sun_mie->tme_sun_mie_mutex); +#if 1 + printf("callout conn_i825x6->tme_bus_signal; signal %x, level %x; %x\n", + (int)signal, (int)level, (int)(signal | level)); +#endif + +if (signal) /* do the callout: */ rc = (conn_i825x6 != NULL ? ((*conn_i825x6->tme_bus_signal) @@ -355,6 +367,9 @@ /* if this callout was successful, note the new state of the interrupt signal: */ if (rc == TME_OK) { +#if 1 + printf("IE assert int %x, csr %x\n", (int)int_asserted, (int)csr); +#endif sun_mie->tme_sun_mie_int_asserted = int_asserted; } @@ -404,6 +419,15 @@ tme_uint16_t pcr_old, pcr_new, pcr_diff; int new_callouts; +#if 1 + printf("mie_bus_cycle_regs; type %x, addr %x, size %d, %02x %02x\n", + (int)cycle_init->tme_bus_cycle_type, + (int)cycle_init->tme_bus_cycle_address, + (int)cycle_init->tme_bus_cycle_size, + (int)cycle_init->tme_bus_cycle_buffer[0], + (int)cycle_init->tme_bus_cycle_buffer[1]); +#endif + /* recover our data structure: */ sun_mie = (struct tme_sun_mie *) _sun_mie; @@ -470,6 +494,10 @@ & ~TME_SUN_MIE_CSR_READONLY) | (csr_old & TME_SUN_MIE_CSR_READONLY)); +#if 1 + printf("csr_new %x, csr_old %x, csr %x\n", + (int)csr_new, (int)csr_old, (int)TME_SUN_MIE_CSR_GET(sun_mie)); +#endif TME_SUN_MIE_CSR_PUT(sun_mie, csr_new); pcr_new = ((TME_SUN_MIE_PCR_GET(sun_mie) & ~TME_SUN_MIE_PCR_READONLY) @@ -505,6 +533,11 @@ /* nothing to do */ } +#if 1 + printf("IE now csr %x, tme_sun_mie_int_asserted %x\n", + (int)csr_new, (int)sun_mie->tme_sun_mie_int_asserted); +#endif + #ifndef TME_NO_LOG if (csr_new != sun_mie->tme_sun_mie_last_log_csr) { sun_mie->tme_sun_mie_last_log_csr = csr_new; @@ -516,6 +549,16 @@ } #endif /* !TME_NO_LOG */ +#if 1 + if (cycle_init->tme_bus_cycle_type & TME_BUS_CYCLE_WRITE) + if (sun_mie->tme_sun_mie_pending_deassert_intr) { + sun_mie->tme_sun_mie_pending_deassert_intr = 0; + printf("turning off pending intr\n"); + csr_new &= ~TME_SUN_MIE_CSR_INTR; + TME_SUN_MIE_CSR_PUT(sun_mie, csr_new); + } +#endif + /* make any new callouts: */ _tme_sun_mie_callout(sun_mie, new_callouts); @@ -533,6 +576,13 @@ { struct tme_sun_mie *sun_mie; +#if 1 + printf("_tme_sun_mie_bus_signal() %x, index %d, count %d\n", + (int)signal, + (int)TME_BUS_SIGNAL_INDEX(signal), + (int)_tme_sun_mie_bus_signals_generic.tme_bus_signals_count); +#endif + /* return now if this is not a generic bus signal: */ if (TME_BUS_SIGNAL_INDEX(signal) > _tme_sun_mie_bus_signals_generic.tme_bus_signals_count) { @@ -542,6 +592,32 @@ /* recover our data structures: */ sun_mie = conn_bus->tme_bus_connection.tme_connection_element->tme_element_private; +#if 1 + printf("_tme_sun_mie_bus_signal() doing it %x\n", (int)signal); +#endif + +#if 1 +if (TME_BUS_SIGNAL_WHICH(signal) == TME_BUS_SIGNAL_INT_UNSPEC) +{ + tme_uint16_t csr; + unsigned int level; + csr = TME_SUN_MIE_CSR_GET(sun_mie); + level = signal & TME_BUS_SIGNAL_LEVEL_MASK; + + if (level == TME_BUS_SIGNAL_LEVEL_ASSERTED) { + printf("assert csr intr!\n"); + csr |= TME_SUN_MIE_CSR_INTR; + TME_SUN_MIE_CSR_PUT(sun_mie, csr); + } + if (level == TME_BUS_SIGNAL_LEVEL_NEGATED) { + printf("deassert csr intr!\n"); +// csr &= ~TME_SUN_MIE_CSR_INTR; +// TME_SUN_MIE_CSR_PUT(sun_mie, csr); + sun_mie->tme_sun_mie_pending_deassert_intr = 1; + } +} +#endif + /* since this function is currently only given to the i825x6, just copy its signal through to the Multibus: */ conn_bus = sun_mie->tme_sun_mie_conn_regs; @@ -665,6 +741,13 @@ tlb->tme_bus_tlb_emulator_off_read = tlb->tme_bus_tlb_emulator_off_write; +#if 1 + printf("_tme_sun_mie_tlb_fill() tlb first %08x, last %08x, off_write %08x\n", + (int)tlb->tme_bus_tlb_addr_first, + (int)tlb->tme_bus_tlb_addr_last, + (int)tlb->tme_bus_tlb_emulator_off_write); +#endif + /* add this TLB entry to the active list: */ sun_mie->tme_sun_mie_tlb_tokens[tlb_i] = tlb->tme_bus_tlb_token; @@ -745,6 +828,12 @@ tlb->tme_bus_tlb_emulator_off_read = &sun_mie->tme_sun_mie_regs[0]; tlb->tme_bus_tlb_rwlock = &sun_mie->tme_sun_mie_rwlock; +#if 0 + /* XXX when debugging, nothing is fast readable or writable: */ + tlb->tme_bus_tlb_emulator_off_read = TME_EMULATOR_OFF_UNDEF; + tlb->tme_bus_tlb_emulator_off_write = TME_EMULATOR_OFF_UNDEF; +#endif + /* allow reading and writing: */ tlb->tme_bus_tlb_cycles_ok = TME_BUS_CYCLE_READ | TME_BUS_CYCLE_WRITE; diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/generic/bus.c tme-0.8/generic/bus.c --- tme-0.8-orig/generic/bus.c 2009-08-29 13:41:17.000000000 -0400 +++ tme-0.8/generic/bus.c 2011-07-13 08:24:14.000000000 -0400 @@ -42,6 +42,8 @@ #include #include +extern int bradshow; + /* this does a binary search of the addressable connections: */ int tme_bus_address_search(struct tme_bus *bus, tme_bus_addr_t address) @@ -54,6 +56,27 @@ left = 0; right = bus->tme_bus_addressables_count - 1; +#if 0 + if (bradshow) + { + extern int printf(const char *format, ...); + int i; + for (i = 0; i < bus->tme_bus_addressables_count; i++) { + + conn_int = bus->tme_bus_addressables[i].tme_bus_addressable_connection; + subregion = bus->tme_bus_addressables[i].tme_bus_addressable_subregion; + + printf("tme_bus_address_search() %d address %x %x %x\n", + i, + (int)conn_int->tme_bus_connection_int_address, + (int)(conn_int->tme_bus_connection_int_address + subregion->tme_bus_subregion_address_first), + (int)(conn_int->tme_bus_connection_int_address + subregion->tme_bus_subregion_address_last)); + +// conn_int->tme_bus_connection_int.tme_bus_connection.tme_connection_other->tme_connection_element + } + } +#endif + /* do the search: */ pivot = 0; for (; left <= right; ) { @@ -63,6 +86,17 @@ conn_int = bus->tme_bus_addressables[pivot].tme_bus_addressable_connection; subregion = bus->tme_bus_addressables[pivot].tme_bus_addressable_subregion; +#if 0 + if (bradshow) + { + extern int printf(const char *format, ...); + printf("tme_bus_address_search() address %x (%x - %x)\n", + (int)address, + (int)(conn_int->tme_bus_connection_int_address + subregion->tme_bus_subregion_address_first), + (int)(conn_int->tme_bus_connection_int_address + subregion->tme_bus_subregion_address_last)); + } +#endif + /* if we have to move left: */ if (address < (conn_int->tme_bus_connection_int_address @@ -85,10 +119,25 @@ /* we found the addressable: */ else { +#if 0 + if (bradshow) + { + extern int printf(const char *format, ...); + printf("tme_bus_address_search() hit, pivot %d\n", pivot); + } +#endif return (pivot); } } +#if 0 + if (bradshow) + { + extern int printf(const char *format, ...); + printf("tme_bus_address_search() miss, pivot %d\n", pivot); + } +#endif + /* we failed to find an addressable that covers the address: */ return (-1 - pivot); } @@ -160,6 +209,14 @@ /* search for this address on the bus: */ pivot = tme_bus_address_search(bus, conn_address); +#if 0 + if (bradshow) + { + extern int printf(const char *format, ...); + printf("tme_bus_tlb_fill() address %x %x pivot %d\n", (int)address, (int)conn_address, pivot); + } +#endif + /* if this address doesn't exist: */ if (pivot < 0) { @@ -385,6 +442,12 @@ return (TRUE); } +void bradstop(void) +{ + volatile int x = 0; + x++; +} + /* this makes a new connection: */ int tme_bus_connection_make(struct tme_bus *bus, @@ -458,6 +521,23 @@ * (bus->tme_bus_addressables_count - pivot)); +#if 0 + { + extern int printf(const char *format, ...); + printf("tme_bus_connection_make() @%d %x %x\n", + pivot, + (int)(conn_int->tme_bus_connection_int_address + subregion->tme_bus_subregion_address_first), + (int)(conn_int->tme_bus_connection_int_address + subregion->tme_bus_subregion_address_last)); + } + + if ((int)(conn_int->tme_bus_connection_int_address + subregion->tme_bus_subregion_address_first) == 0 && + (int)(conn_int->tme_bus_connection_int_address + subregion->tme_bus_subregion_address_last) == 0x40000) { + void bradstop(void); + bradstop(); + return TME_OK; + } +#endif + /* insert this new addressable: */ bus->tme_bus_addressables[pivot].tme_bus_addressable_connection = conn_int; bus->tme_bus_addressables[pivot].tme_bus_addressable_subregion = subregion; @@ -497,6 +577,14 @@ tme_bus_addr_t addr_offset; unsigned int cycles_ok; +#if 0 + if (bradshow) + { + extern int printf(const char *format, ...); + printf("tme_bus_tlb_map() %x %x\n", (int)addr0, (int)addr1); + } +#endif + /* get the address offset: */ addr_offset = addr1; addr_offset -= addr0; @@ -612,6 +700,43 @@ int warn_on_lane; unsigned int cycle_size_reader, cycle_size_writer; +#if 1 + { + struct tme_bus_cycle *c = 0; + int which = 0; + if (cycle_resp->tme_bus_cycle_type == TME_BUS_CYCLE_WRITE) { + c = cycle_resp; + which = 1; + } + if (cycle_init->tme_bus_cycle_type == TME_BUS_CYCLE_WRITE) { + c = cycle_init; + which = 2; + } + + if (c) { + extern int get_sunbw2_copy(void); + extern int get_sunbw2_copy_addr(void); + int printf(const char *format, ...); + + if (0) + if (c->tme_bus_cycle_address > 0x1000) + printf("bus write %x %x %d @ %x, %d\n", + (unsigned int)get_sunbw2_copy(), + (unsigned int)get_sunbw2_copy_addr(), + which, + (unsigned int)c->tme_bus_cycle_address, + (unsigned int)c->tme_bus_cycle_size); + + if (get_sunbw2_copy()) { + if ((c->tme_bus_cycle_address & 0x007e0000) == get_sunbw2_copy_addr()) { + printf("hit!\n"); + //abort(); + } + } + } + } +#endif + /* sort the initiator and responder into bus reader and bus writer: */ if (cycle_init->tme_bus_cycle_type == TME_BUS_CYCLE_READ) { assert(cycle_resp->tme_bus_cycle_type == TME_BUS_CYCLE_WRITE); @@ -834,6 +959,7 @@ memory = memory_junk; } + /* create the responder cycle: */ cycle_resp.tme_bus_cycle_buffer = memory; cycle_resp.tme_bus_cycle_buffer_increment = 1; diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/generic/bus-el.c tme-0.8/generic/bus-el.c --- tme-0.8-orig/generic/bus-el.c 2009-08-29 13:59:17.000000000 -0400 +++ tme-0.8/generic/bus-el.c 2011-07-13 08:39:20.000000000 -0400 @@ -51,6 +51,8 @@ TME_BUS_SIGNALS_GENERIC }; +extern int bradshow; + /* this adds a bus signal set to the bus: */ static int _tme_bus_signals_add(struct tme_bus_connection *conn_bus_caller, @@ -435,6 +437,12 @@ static int _tme_bus_fault(void *junk0, struct tme_bus_cycle *junk1) { +#if 0 + { + extern int printf(const char *format, ...); + printf("_tme_bus_fault()\n"); + } +#endif return (ENOENT); } @@ -449,6 +457,14 @@ struct tme_bus_connection_int *conn_int; int rc; +#if 0 + if (bradshow) + { + extern int printf(const char *format, ...); + printf("_tme_bus_tlb_fill() address %x\n", (int)address); + } +#endif + /* recover our bus and our connection to the asker: */ bus = conn_bus_asker->tme_bus_connection.tme_connection_element->tme_element_private; conn_int = (struct tme_bus_connection_int *) conn_bus_asker; @@ -468,6 +484,15 @@ conn_int, tlb, address, cycles); +#if 0 + if (bradshow) + { + extern int printf(const char *format, ...); + printf("_tme_bus_tlb_fill() rc = %d\n", rc); + } +#endif + + /* unlock the bus: */ tme_rwlock_unlock(&bus->tme_bus_rwlock); diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/host/posix/posix-memory.c tme-0.8/host/posix/posix-memory.c --- tme-0.8-orig/host/posix/posix-memory.c 2009-08-30 17:50:17.000000000 -0400 +++ tme-0.8/host/posix/posix-memory.c 2011-07-02 08:19:59.000000000 -0400 @@ -123,6 +123,29 @@ /* recover our data structure: */ memory = (struct tme_posix_memory *) _memory; +#if 0 + if (cycle->tme_bus_cycle_type == TME_BUS_CYCLE_WRITE) { + printf("posix write @ %x\n", (unsigned int)cycle->tme_bus_cycle_address); + } + if (cycle->tme_bus_cycle_type == TME_BUS_CYCLE_READ) { + printf("posix read @ %x\n", (unsigned int)cycle->tme_bus_cycle_address); + } +#endif + +#if 1 + if (cycle->tme_bus_cycle_type == TME_BUS_CYCLE_WRITE) { + extern int get_sunbw2_copy(void); + extern int get_sunbw2_copy_addr(void); + int printf(const char *format, ...); + + if (get_sunbw2_copy()) { + if ((cycle->tme_bus_cycle_address & 0x007e0000) == get_sunbw2_copy_addr()) { + printf("posix hit! @ %x\n", (unsigned int)cycle->tme_bus_cycle_address); + } + } + } +#endif + /* run the cycle: */ tme_bus_cycle_xfer_memory(cycle, ((cycle->tme_bus_cycle_type == TME_BUS_CYCLE_WRITE diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/ic/i825x6.c tme-0.8/ic/i825x6.c --- tme-0.8-orig/ic/i825x6.c 2010-06-05 10:43:27.000000000 -0400 +++ tme-0.8/ic/i825x6.c 2011-07-31 13:35:37.000000000 -0400 @@ -119,6 +119,10 @@ #define TME_I825X6_CALLOUT_CA TME_BIT(5) #define TME_I825X6_CALLOUT_CU TME_BIT(6) +#if 1 +extern int printf(const char *format, ...); +#endif + /* structures: */ /* an rx buffer: */ @@ -261,6 +265,10 @@ if (i825x6->tme_i825x6_stat_cus_rus_t & TME_I825X6_SCB_STAT_MASK) { i825x6->tme_i825x6_stat_cus_rus_t &= ~TME_I825X6_SCB_STAT_MASK; +#if 1 +printf("_tme_i825x6_reset() CALLOUT_INT\n"); +#endif + i825x6->tme_i825x6_callout_flags |= TME_I825X6_CALLOUT_INT; } @@ -697,6 +705,10 @@ tme_uint32_t count; int rc; +#if 1 + printf("_tme_i825x6_chunks_dma_tx; xmit %d\n", size); +#endif + /* while we have bytes left to DMA: */ for (; size > 0; ) { @@ -777,6 +789,9 @@ tme_uint16_t rbd_offset_first; int rc; +#if 1 +printf("_tme_i825x6_callout_ca()\n"); +#endif /* if this CA follows RESET: */ if (i825x6->tme_i825x6_ca_follows_reset) { @@ -817,6 +832,9 @@ | TME_I825X6_SCB_RUS_IDLE); /* "The 82596 ... sends an interrupt to the CPU": */ +#if 1 +printf("_tme_i825x6_callout_ca() CALLOUT_INT\n"); +#endif i825x6->tme_i825x6_callout_flags = TME_I825X6_CALLOUTS_RUNNING | TME_I825X6_CALLOUT_INT; } @@ -1472,6 +1490,9 @@ + TME_I825X6_RFD_C_B_OK_STATUS), c_b_ok_status); +#if 1 + printf("_tme_i825x6_callout_ru() signal int\n"); +#endif /* signal an interrupt: */ stat_cus_rus_t |= TME_I825X6_SCB_STAT_FR; @@ -1619,6 +1640,9 @@ /* unlock the mutex: */ tme_mutex_unlock(&i825x6->tme_i825x6_mutex); +#if 1 + printf("_tme_i825x6_callout; \n"); +#endif /* do the callout: */ rc = (conn_eth != NULL ? ((*conn_eth->tme_ethernet_connection_ctrl) @@ -1729,6 +1753,9 @@ & TME_I825X6_SCB_STAT_MASK) != !(stat_cus_rus_t & TME_I825X6_SCB_STAT_MASK)) { +#if 1 +printf("_tme_i825x6_callout() CALLOUT_INT\n"); +#endif i825x6->tme_i825x6_callout_flags |= TME_I825X6_CALLOUT_INT; } @@ -1763,6 +1790,9 @@ i825x6->tme_i825x6_device.tme_bus_device_connection, &i825x6->tme_i825x6_device.tme_bus_device_connection_rwlock); +#if 1 + printf("_tme_i825x6_callout; signal int - asserted %x\n", (int)int_asserted); +#endif /* call out the bus interrupt signal edge: */ rc = (*conn_bus->tme_bus_signal) (conn_bus, @@ -1777,6 +1807,9 @@ /* if this callout failed, remember that at some later time this callout should be attempted again: */ if (rc != TME_OK) { +#if 1 +printf("_tme_i825x6_callout() later CALLOUT_INT\n"); +#endif later_callouts |= TME_I825X6_CALLOUT_INT; } } @@ -1808,6 +1841,11 @@ level = signal & TME_BUS_SIGNAL_LEVEL_MASK; signal = TME_BUS_SIGNAL_WHICH(signal); +#if 1 + printf("_tme_i825x6_signal() level %x, signal %x; switch index %x\n", + (int)level, (int)signal, + (int)(signal - i825x6->tme_i825x6_bus_signals.tme_bus_signals_first)); +#endif /* dispatch on the generic bus signals: */ switch (signal) { case TME_BUS_SIGNAL_RESET: @@ -1826,6 +1864,14 @@ case TME_I825X6_SIGNAL_CA: if (level == TME_BUS_SIGNAL_LEVEL_ASSERTED) { new_callouts |= TME_I825X6_CALLOUT_CA; + } else { +#if 1 + printf("TME_I825X6_SIGNAL_CA; deasserted!!!!\n"); +#endif +#if 1 + i825x6->tme_i825x6_stat_cus_rus_t &= ~TME_I825X6_SCB_STAT_MASK; + new_callouts |= TME_I825X6_CALLOUT_INT; +#endif } break; @@ -1937,6 +1983,10 @@ & TME_I825X6_CB_CMD_MASK) == TME_I825X6_CB_CMD_TRANSMIT) { +#if 1 + printf("_tme_i825x6_read; xmit\n"); +#endif + /* assume that we will succeed: */ err = TME_OK; do { diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/ic/m68k/m68010.c tme-0.8/ic/m68k/m68010.c --- tme-0.8-orig/ic/m68k/m68010.c 2007-02-15 20:40:44.000000000 -0500 +++ tme-0.8/ic/m68k/m68010.c 2011-07-10 09:01:46.000000000 -0400 @@ -511,3 +511,9 @@ /* call the common m68k new function: */ return (tme_m68k_new(ic, args, extra, _output)); } + +unsigned int +_tme_m68010_get_pc(struct tme_m68k *ic) +{ + return ic->tme_m68k_ireg_pc; +} diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/ic/m68k/m68k-execute.c tme-0.8/ic/m68k/m68k-execute.c --- tme-0.8-orig/ic/m68k/m68k-execute.c 2009-08-29 15:25:48.000000000 -0400 +++ tme-0.8/ic/m68k/m68k-execute.c 2011-07-16 09:50:11.000000000 -0400 @@ -112,6 +112,9 @@ #endif /* TME_THREADS_COOPERATIVE */ } + if (ic->_tme_m68k_mode == TME_M68K_MODE_DIE) + return; + #ifdef _TME_M68K_EXECUTE_FAST /* get our instruction TLB entry and reload it: */ @@ -152,6 +155,14 @@ /* the execution loop: */ for (;;) { +#if 0 + extern int _m68k_dead; + if (_m68k_dead) { + extern void tme_m68k_kill_cpu(struct tme_m68k *ic); + tme_m68k_kill_cpu(ic); + } +#endif + /* reset for this instruction: */ #ifdef _TME_M68K_EXECUTE_FAST fetch_fast_next = tlb->tme_m68k_tlb_emulator_off_read + ic->tme_m68k_ireg_pc; @@ -830,6 +841,21 @@ /* an instruction has ended: */ tme_m68k_verify_end(ic, func); +#if 1 + if ((int)ic->tme_m68k_ireg_pc < 0x80000) + { + extern int printf(const char *format, ...); + //printf("finished %08x\n", (int)ic->tme_m68k_ireg_pc); + + if ((int)ic->tme_m68k_ireg_pc == 0x3c3c0) { +#ifdef _TME_M68K_EXECUTE_FAST +#else + printf("blammo; old %x\n", (int)exceptions); + exceptions |= TME_M68K_EXCEPTION_BERR; +#endif + } + } +#endif /* update the PC: */ ic->tme_m68k_ireg_pc = ic->tme_m68k_ireg_pc_next; TME_M68K_SEQUENCE_START; diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/ic/m68k/m68k-impl.h tme-0.8/ic/m68k/m68k-impl.h --- tme-0.8-orig/ic/m68k/m68k-impl.h 2009-08-29 15:28:08.000000000 -0400 +++ tme-0.8/ic/m68k/m68k-impl.h 2011-07-16 08:11:09.000000000 -0400 @@ -249,6 +249,7 @@ #define TME_M68K_MODE_RTE (2) #define TME_M68K_MODE_STOP (3) #define TME_M68K_MODE_HALT (4) +#define TME_M68K_MODE_DIE (5) /* mode-specific flags: */ #define TME_M68K_EXECUTION_INST_CANFAULT TME_BIT(0) diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/ic/m68k/m68k-insns-auto.c tme-0.8/ic/m68k/m68k-insns-auto.c --- tme-0.8-orig/ic/m68k/m68k-insns-auto.c 2010-06-06 20:50:03.000000000 -0400 +++ tme-0.8/ic/m68k/m68k-insns-auto.c 2011-07-13 12:42:38.000000000 -0400 @@ -4506,6 +4506,15 @@ /* get the value to write, in big-endian byte order: */ mem_value = tme_htobe_u16(ic->tme_m68k_ireg_memx16); +#if 1 + { + extern int printf(const char *format, ...); + if ((int)ic->tme_m68k_ireg_pc == 0x3c3bc) { + printf("tme_m68k_write_memx16 #1; mem %x, val %x\n", (int)mem, (int)mem_value); + } + } +#endif + /* do the 16-bit bus write: */ tme_memory_bus_write16(mem, mem_value, tlb->tme_m68k_tlb_bus_rwlock, sizeof(tme_uint8_t), sizeof(tme_uint32_t)); @@ -4515,6 +4524,16 @@ /* otherwise, do the bus cycles the slow way: */ else { +#if 1 + { + extern int printf(const char *format, ...); + if ((int)ic->tme_m68k_ireg_pc == 0x3c3bc) { + mem = (tme_shared tme_uint16_t *) (tlb->tme_m68k_tlb_emulator_off_write + linear_address_first); + mem_value = tme_htobe_u16(ic->tme_m68k_ireg_memx16); + printf("tme_m68k_write_memx16 #2; mem %x, val %x\n", (int)mem, (int)mem_value); + } + } +#endif tme_m68k_write16(ic, tlb, &ic->_tme_m68k_ea_function_code, &ic->_tme_m68k_ea_address, @@ -5570,6 +5589,20 @@ tme_uint8_t reg_buffer[sizeof(tme_uint32_t) * 2]; tme_shared tme_uint8_t *mem; +#if 1 + int should_fault = 0; + { + extern int printf(const char *format, ...); + if ((int)ic->tme_m68k_ireg_pc == 0x3c3bc) { + printf("tme_m68k_write; *_linear_address %x\n", (int)*_linear_address); + if ((int)*_linear_address == 0x509000) { + should_fault = 1; + } + printf("tme_m68k_write; should_fault %d\n", should_fault); + } + } +#endif + /* if we're not restarting, everything is fresh: */ if (!TME_M68K_SEQUENCE_RESTARTING) { function_code = *_function_code; @@ -5611,6 +5644,14 @@ transfer number and return: */ else { TME_M68K_SEQUENCE_TRANSFER_STEP; +#if 0 + { + extern int printf(const char *format, ...); + if ((int)ic->tme_m68k_ireg_pc == 0x3c3bc) { + printf("tme_m68k_write; returning\n"); + } + } +#endif return; } @@ -5618,6 +5659,14 @@ exception = TME_M68K_EXCEPTION_NONE; cycle_size = 0; for(; transferred < reg_size; ) { +#if 0 + { + extern int printf(const char *format, ...); + if ((int)ic->tme_m68k_ireg_pc == 0x3c3bc) { + printf("tme_m68k_write; loop %x\n", (int)linear_address); + } + } +#endif resid = reg_size - transferred; /* start the bus cycle structure: */ @@ -5762,6 +5811,16 @@ tme_m68k_callout_relock(ic); tme_m68k_tlb_busy(tlb); +#if 0 + { + extern int printf(const char *format, ...); + if ((int)ic->tme_m68k_ireg_pc == 0x3c3bc) { + printf("tme_m68k_write; old %x\n", (int)err); + err = ENOENT; + } + } +#endif + /* if the TLB entry was invalidated before the write: */ if (err == EBADF && tme_m68k_tlb_is_invalid(tlb)) { @@ -5791,6 +5850,18 @@ transferred += cycle.tme_bus_cycle_size; } +#if 1 + { + extern int printf(const char *format, ...); + if ((int)ic->tme_m68k_ireg_pc == 0x3c3bc) { + if (0) printf("tme_m68k_write; not returning\n"); + if (should_fault) { + printf("tme_m68k_write; faulting\n"); + exception = TME_M68K_EXCEPTION_BERR; + } + } + } +#endif /* NB: there is no need to explicitly unlock a device. if a locked bus cycle to a device faults, the lock must be automatically unlocked: */ @@ -5827,6 +5898,15 @@ /* otherwise, this transfer has now completed: */ TME_M68K_SEQUENCE_TRANSFER_STEP; + +#if 0 + { + extern int printf(const char *format, ...); + if ((int)ic->tme_m68k_ireg_pc == 0x3c3bc) { + printf("tme_m68k_write; end\n"); + } + } +#endif } TME_M68K_INSN(tme_m68k_abcd) diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/ic/m68k/m68k-misc.c tme-0.8/ic/m68k/m68k-misc.c --- tme-0.8-orig/ic/m68k/m68k-misc.c 2009-08-29 15:47:52.000000000 -0400 +++ tme-0.8/ic/m68k/m68k-misc.c 2011-07-16 09:40:58.000000000 -0400 @@ -303,6 +303,9 @@ tme_m68k_idle(ic); /* NOTREACHED */ + case TME_M68K_MODE_DIE: + return; + default: abort(); } @@ -2285,6 +2288,18 @@ { } +void +tme_m68k_kill_cpu(struct tme_m68k *ic) +{ + ic->_tme_m68k_mode = TME_M68K_MODE_DIE; +} + +int _m68k_dead; +void m68k_die(void) +{ + _m68k_dead = 1; +} + #if 1 #include diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/libtme/module.c tme-0.8/libtme/module.c --- tme-0.8-orig/libtme/module.c 2010-06-05 15:04:42.000000000 -0400 +++ tme-0.8/libtme/module.c 2011-06-30 08:04:52.000000000 -0400 @@ -248,7 +248,7 @@ /* if there were no slashes in the fake module pathname, there is no top name, which is incorrect: */ if (first_slash == NULL) { - tme_output_append_error(_output, module_fake_pathname); + tme_output_append_error(_output, "%s", module_fake_pathname); tme_free(module_raw_name); return (EINVAL); } @@ -258,7 +258,7 @@ (first_slash - module_raw_name), &modules_dir); if (modules_index == NULL) { - tme_output_append_error(_output, module_fake_pathname); + tme_output_append_error(_output, "%s", module_fake_pathname); tme_free(module_raw_name); return (ENOENT); } @@ -300,7 +300,7 @@ /* if we didn't find the module in the index: */ if (tokens_count == 0) { - tme_output_append_error(_output, module_fake_pathname); + tme_output_append_error(_output, "%s", module_fake_pathname); tme_free(modules_dir); return (ENOENT); } @@ -325,7 +325,7 @@ tme_mutex_unlock(&_tme_module_mutex); tme_free(module_pathname); if (handle == NULL) { - tme_output_append_error(_output, module_fake_pathname); + tme_output_append_error(_output, "%s", module_fake_pathname); tme_free_string_array(tokens, -1); return (ENOENT); } diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/machine/sun/sun-bwtwo.c tme-0.8/machine/sun/sun-bwtwo.c --- tme-0.8-orig/machine/sun/sun-bwtwo.c 2009-11-08 12:03:58.000000000 -0500 +++ tme-0.8/machine/sun/sun-bwtwo.c 2011-06-30 22:36:40.000000000 -0400 @@ -92,6 +92,13 @@ tme_uint16_t tme_sunbw2_csr; }; +#if 1 +static int sunbw2_copy; +static int sunbw2_copy_addr; +int get_sunbw2_copy(void) { return sunbw2_copy; } +int get_sunbw2_copy_addr(void) { return sunbw2_copy_addr; } +#endif + #ifdef TME_SUNBW2_DEBUG #define TME_SUNBW2_LO_WIDTH (1152) #define TME_SUNBW2_LO_HEIGHT (900) @@ -199,12 +206,20 @@ | TME_SUNBW2_CSR_JUMPER_COLOR | TME_SUNBW2_CSR_JUMPER_HIRES))); +#if 0//brad /* we do not support these bits: */ if (csr_new & (TME_SUNBW2_CSR_ENABLE_COPY | TME_SUNBW2_CSR_ENABLE_INT)) { abort(); } +#else + if (csr_new & TME_SUNBW2_CSR_ENABLE_COPY) { + sunbw2_copy = 1; + sunbw2_copy_addr = (csr_new & TME_SUNBW2_CSR_COPYBASE_MASK) << 16; + } else + sunbw2_copy = 0; +#endif /* set the new CSR value: */ sunbw2->tme_sunbw2_csr = tme_htobe_u16(csr_new); diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/machine/sun2/sun2-mainbus.c tme-0.8/machine/sun2/sun2-mainbus.c --- tme-0.8-orig/machine/sun2/sun2-mainbus.c 2009-08-30 10:32:29.000000000 -0400 +++ tme-0.8/machine/sun2/sun2-mainbus.c 2011-06-30 08:09:20.000000000 -0400 @@ -616,11 +616,11 @@ /* try to read in the IDPROM: */ idprom_fp = fopen(idprom_filename, "r"); if (idprom_fp == NULL) { - tme_output_append_error(_output, idprom_filename); + tme_output_append_error(_output, "%s", idprom_filename); return (errno); } if (fread(idprom, sizeof(tme_uint8_t), sizeof(idprom), idprom_fp) != sizeof(idprom)) { - tme_output_append_error(_output, idprom_filename); + tme_output_append_error(_output, "%s", idprom_filename); fclose(idprom_fp); return (ENOEXEC); } diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/machine/sun2/sun2-mmu.c tme-0.8/machine/sun2/sun2-mmu.c --- tme-0.8-orig/machine/sun2/sun2-mmu.c 2009-08-30 10:39:47.000000000 -0400 +++ tme-0.8/machine/sun2/sun2-mmu.c 2011-07-20 08:33:53.000000000 -0400 @@ -70,6 +70,9 @@ /* 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_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 @@ /* 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 @@ _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 @@ 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 @@ 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 @@ /* 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 @@ 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); } diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/machine/sun3/sun3-mainbus.c tme-0.8/machine/sun3/sun3-mainbus.c --- tme-0.8-orig/machine/sun3/sun3-mainbus.c 2009-08-30 10:17:53.000000000 -0400 +++ tme-0.8/machine/sun3/sun3-mainbus.c 2011-06-30 08:10:05.000000000 -0400 @@ -710,11 +710,11 @@ /* try to read in the IDPROM: */ idprom_fp = fopen(idprom_filename, "r"); if (idprom_fp == NULL) { - tme_output_append_error(_output, idprom_filename); + tme_output_append_error(_output, "%s", idprom_filename); return (errno); } if (fread(idprom, sizeof(tme_uint8_t), sizeof(idprom), idprom_fp) != sizeof(idprom)) { - tme_output_append_error(_output, idprom_filename); + tme_output_append_error(_output, "%s", idprom_filename); fclose(idprom_fp); return (ENOEXEC); } diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/machine/sun4/sun4-mainbus.c tme-0.8/machine/sun4/sun4-mainbus.c --- tme-0.8-orig/machine/sun4/sun4-mainbus.c 2009-08-30 10:03:11.000000000 -0400 +++ tme-0.8/machine/sun4/sun4-mainbus.c 2011-06-30 09:13:42.000000000 -0400 @@ -757,11 +757,11 @@ if (idprom_filename != NULL) { idprom_fp = fopen(idprom_filename, "r"); if (idprom_fp == NULL) { - tme_output_append_error(_output, idprom_filename); + tme_output_append_error(_output, "%s", idprom_filename); return (errno); } if (fread(idprom, sizeof(tme_uint8_t), sizeof(idprom), idprom_fp) != sizeof(idprom)) { - tme_output_append_error(_output, idprom_filename); + tme_output_append_error(_output, "%s", idprom_filename); fclose(idprom_fp); return (ENOEXEC); } diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/scsi/emulexmt02.c tme-0.8/scsi/emulexmt02.c --- tme-0.8-orig/scsi/emulexmt02.c 2007-08-25 18:54:59.000000000 -0400 +++ tme-0.8/scsi/emulexmt02.c 2011-07-20 07:25:43.000000000 -0400 @@ -110,6 +110,9 @@ } sense->tme_scsi_device_sense_data[8] = error; + /* set transfer length */ + sense->tme_scsi_device_sense_valid = transfer_length; + /* the Emulex retry count: */ sense->tme_scsi_device_sense_data[9] = 0x00; sense->tme_scsi_device_sense_data[10] = 0x10; diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/tmesh/tmesh.c tme-0.8/tmesh/tmesh.c --- tme-0.8-orig/tmesh/tmesh.c 2009-08-30 13:06:38.000000000 -0400 +++ tme-0.8/tmesh/tmesh.c 2011-07-16 09:49:48.000000000 -0400 @@ -77,6 +77,7 @@ /* globals: */ const char *argv0; +int _tme_dead; /* our shell instance: */ static void *_tmesh; @@ -170,6 +171,7 @@ /* set the new, emerging input: */ _tmesh_io = io_new; + if (io_new) _tmesh_remove_consumed(io_new->tmesh_io_private); } @@ -458,6 +460,12 @@ break; } + /* shutdown */ + if (_tmesh_io == NULL) { + _tme_dead = 1; + return; + } + /* this command may have changed the current io, so reload: */ io = _tmesh_io; input = io->tmesh_io_private; @@ -601,7 +609,7 @@ input_stdin->_tmesh_input_buffer_head = strlen(input_stdin->_tmesh_input_buffer); /* create our stdin io: */ - io.tmesh_io_name = "*stdin*"; + io.tmesh_io_name = strdup("*stdin*"); io.tmesh_io_private = input_stdin; io.tmesh_io_input_line = 0; io.tmesh_io_getc = _tmesh_getc; diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/tmesh/tmesh-cmds.c tme-0.8/tmesh/tmesh-cmds.c --- tme-0.8-orig/tmesh/tmesh-cmds.c 2006-11-15 18:12:30.000000000 -0500 +++ tme-0.8/tmesh/tmesh-cmds.c 2011-06-30 09:22:14.000000000 -0400 @@ -238,7 +238,7 @@ args += skip; for (; argc-- > 0; ) { tme_output_append(_output, " "); - tme_output_append(_output, *(args++)); + tme_output_append(_output, "%s", *(args++)); } } @@ -524,7 +524,7 @@ /* this must be an element: */ if (entry->tmesh_fs_dirent_type != TMESH_FS_DIRENT_ELEMENT) { - tme_output_append(_output, element1_args[0]); + tme_output_append(_output, "%s", element1_args[0]); return (ENOTSOCK); } element1 = entry->tmesh_fs_dirent_value; @@ -546,7 +546,7 @@ /* it must be an element: */ if (entry->tmesh_fs_dirent_type != TMESH_FS_DIRENT_ELEMENT) { - tme_output_append(_output, value->tmesh_parser_value_pathname0); + tme_output_append(_output, "%s", value->tmesh_parser_value_pathname0); return (ENOTSOCK); } element0 = entry->tmesh_fs_dirent_value; diff -urb --exclude '*.o' --exclude '*~' --exclude '*.la' --exclude .deps --exclude .libs --exclude '*.lo' --exclude '*.log' --exclude '*.status' tme-0.8-orig/tmesh/tmesh-input.y tme-0.8/tmesh/tmesh-input.y --- tme-0.8-orig/tmesh/tmesh-input.y 2006-11-15 18:11:31.000000000 -0500 +++ tme-0.8/tmesh/tmesh-input.y 2011-06-30 09:21:13.000000000 -0400 @@ -58,6 +58,10 @@ #define YYDEBUG 1 #define YYMAXDEPTH 10000 +//brad +#define YYLTYPE_IS_TRIVIAL 0 +#define YYENABLE_NLS 0 + /* types: */ /* globals: */ @@ -301,7 +305,7 @@ static void yyerror(char *msg) { - tme_output_append(_tmesh_output, msg); + tme_output_append(_tmesh_output, "%s", msg); _tmesh_input->tmesh_scanner.tmesh_scanner_in_args = FALSE; }