--- previous/src/dimension/i860dbg.cpp 2018/04/24 19:30:01 1.1 +++ previous/src/dimension/i860dbg.cpp 2018/04/24 19:33:28 1.1.1.3 @@ -15,13 +15,15 @@ ***************************************************************************/ -extern int i860_disassembler(UINT32 pc, UINT32 insn, char* buffer); +int i860_disassembler(UINT32 pc, UINT32 insn, char* buffer); /* A simple internal debugger. */ void i860_cpu_device::debugger() { debugger(0, ""); } +extern volatile int mainPauseEmulation; + void i860_cpu_device::debugger(char cmd, const char* format, ...) { if(!(isatty(fileno(stdin)))) return; @@ -36,7 +38,7 @@ void i860_cpu_device::debugger(char cmd, if (m_single_stepping > 1 && m_single_stepping != m_pc) return; - lock(&m_debugger_lock); + mainPauseEmulation = 1; if(format) { va_list ap; @@ -123,7 +125,7 @@ void i860_cpu_device::debugger(char cmd, m_single_stepping = 1; break; case 'w': - nd_dbg_cmd(buf); + nd->dbg_cmd(buf); break; case 'k': m_console[m_console_idx] = 0; @@ -138,7 +140,7 @@ void i860_cpu_device::debugger(char cmd, case 'm': if (buf[1] == '0') sscanf (buf + 1, "%x", &curr_dumpdb); - dbg_db (curr_dumpdb, 32); + dbg_memdump (curr_dumpdb, 32); curr_dumpdb += 32; break; case 't': { @@ -179,10 +181,10 @@ void i860_cpu_device::debugger(char cmd, " b: break - set trap on next instruction\n" " t: dump traceback buffer (t[count])\n" " x: give virt->phys translation (x{0xaddress})\n"); - nd_dbg_cmd(0); + nd->dbg_cmd(0); break; default: - if(!(nd_dbg_cmd(buf))) + if(!(nd->dbg_cmd(buf))) fprintf (stderr, "Bad command '%s'. Type '?' for help.\n", buf); break; } @@ -193,8 +195,8 @@ void i860_cpu_device::debugger(char cmd, fprintf (stderr, "Debugger done, continuing emulation.\n"); if(m_single_stepping == 2) m_single_stepping = 0; } - - unlock(&m_debugger_lock); + + mainPauseEmulation = 2; } /* Disassemble `len' instructions starting at `addr'. */ @@ -217,29 +219,25 @@ UINT32 i860_cpu_device::disasm (UINT32 a /* Dump `len' bytes starting at `addr'. */ -void i860_cpu_device::dbg_db (UINT32 addr, int len) -{ +void i860_cpu_device::dbg_memdump (UINT32 addr, int len) { UINT8 b[16]; int i; /* This will always dump a multiple of 16 bytes, even if 'len' isn't. */ - while (len > 0) - { + while (len > 0) { /* Note that we print the incoming (possibly virtual) address rather than the translated address. */ fprintf (stderr, "0x%08x: ", addr); - for (i = 0; i < 16; i++) - { + for (i = 0; i < 16; i++) { UINT32 phys_addr = addr; if (GET_DIRBASE_ATE ()) phys_addr = get_address_translation (addr, 1 /* is_dataref */, 0 /* is_write */); - rdmem[1](phys_addr, (UINT32*)&b[i]); + rdmem[1](nd, phys_addr, (UINT32*)&b[i]); fprintf (stderr, "%02x ", b[i]); addr++; } fprintf (stderr, "| "); - for (i = 0; i < 16; i++) - { + for (i = 0; i < 16; i++) { if (isprint (b[i])) fprintf (stderr, "%c", b[i]); else @@ -337,7 +335,7 @@ void i860_cpu_device::dump_state() /* FR's (as 32-bits), 4 per line. */ for (rn = 0; rn < 32; rn++) { - float ff = get_fregval_s (rn); + FLOAT32 ff = get_fregval_s (rn); if ((rn % 4) == 0) fprintf (stderr, "\n"); fprintf (stderr, "%%f%-3d: 0x%08x ", rn, *(UINT32 *)&ff); @@ -364,6 +362,16 @@ void i860_cpu_device::halt(bool state) { } } +void i860_cpu_device::pause(bool state) { + if(state) { + m_halt = true; + Log_Printf(LOG_WARN, "[i860] **** PAUSED ****"); + } else { + Log_Printf(LOG_WARN, "[i860] **** RESUMED ****"); + m_halt = false; + } +} + void i860_cpu_device::dbg_check_wr(UINT32 addr, int size, UINT8* data) { if(addr == 0xF83FE800 || addr == 0xF80FF800) { switch(*((UINT32*)data)) {