From 98c4b826c31fd13201bf28310957e1c9cac993ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20St=C3=B6neberg?= Date: Fri, 7 Nov 2014 21:24:35 +0100 Subject: =?UTF-8?q?added=20command-line=20option=20-[no]drc=5Flog=5Fnative?= =?UTF-8?q?=20to=20control=20DRC=20native=20diassembly=20logging=20[Oliver?= =?UTF-8?q?=20St=C3=B6neberg]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit allows logging of DRC native disassembly without re-compiling / removes DRCUML_OPTION_LOG_NATIVE and all the core-specific LOG_NATIVE defines / added logging() to drcbe_interface / added logging_native() to drcuml_state --- src/emu/cpu/arm7/arm7drc.inc | 6 +----- src/emu/cpu/drcbex64.c | 7 +++++-- src/emu/cpu/drcbex64.h | 1 + src/emu/cpu/drcbex86.c | 7 +++++-- src/emu/cpu/drcbex86.h | 1 + src/emu/cpu/drcuml.h | 3 ++- src/emu/cpu/mips/mips3.c | 2 -- src/emu/cpu/mips/mips3com.h | 2 -- src/emu/cpu/mips/mips3drc.c | 4 ++-- src/emu/cpu/powerpc/ppccom.c | 2 -- src/emu/cpu/powerpc/ppccom.h | 2 -- src/emu/cpu/powerpc/ppcdrc.c | 4 ++-- src/emu/cpu/rsp/rsp.c | 6 +----- src/emu/cpu/rsp/rsp.h | 1 - src/emu/cpu/sh2/sh2.c | 8 ++------ src/emu/cpu/sh2/sh2drc.c | 4 ++-- src/emu/emuopts.c | 1 + src/emu/emuopts.h | 2 ++ 18 files changed, 27 insertions(+), 36 deletions(-) diff --git a/src/emu/cpu/arm7/arm7drc.inc b/src/emu/cpu/arm7/arm7drc.inc index f41ad5a170e..78678b2d89b 100644 --- a/src/emu/cpu/arm7/arm7drc.inc +++ b/src/emu/cpu/arm7/arm7drc.inc @@ -41,8 +41,6 @@ DEBUGGING ***************************************************************************/ -#define LOG_NATIVE (0) - #define SINGLE_INSTRUCTION_MODE (0) /*************************************************************************** @@ -153,8 +151,6 @@ void arm7_cpu_device::arm7_drc_init() m_impstate.cache = cache; /* initialize the UML generator */ - if (LOG_NATIVE) - flags |= DRCUML_OPTION_LOG_NATIVE; m_impstate.drcuml = new drcuml_state(*this, *cache, flags, 1, 32, 1); /* add symbols for our stuff */ @@ -352,7 +348,7 @@ void arm7_cpu_device::code_compile_block(UINT8 mode, offs_t pc) /* get a description of this sequence */ // TODO FIXME const opcode_desc *desclist = NULL; //m_impstate.drcfe->describe_code(pc); // TODO -// if (drcuml->logging() || LOG_NATIVE) +// if (drcuml->logging() || drcuml->logging_native()) // log_opcode_desc(drcuml, desclist, 0); /* if we get an error back, flush the cache and try again */ diff --git a/src/emu/cpu/drcbex64.c b/src/emu/cpu/drcbex64.c index 5684a2f6bd6..0c2c638cf19 100644 --- a/src/emu/cpu/drcbex64.c +++ b/src/emu/cpu/drcbex64.c @@ -652,8 +652,11 @@ drcbe_x64::drcbe_x64(drcuml_state &drcuml, device_t &device, drc_cache &cache, U s_opcode_table[s_opcode_table_source[opnum].opcode] = s_opcode_table_source[opnum].func; // create the log - if (flags & DRCUML_OPTION_LOG_NATIVE) - m_log = x86log_create_context("drcbex64.asm"); + if (device.machine().options().drc_log_native()) + { + astring filename("drcbex64_", device.shortname(), ".asm"); + m_log = x86log_create_context(filename.cstr()); + } } diff --git a/src/emu/cpu/drcbex64.h b/src/emu/cpu/drcbex64.h index 94fa8676012..6b6cf729b64 100644 --- a/src/emu/cpu/drcbex64.h +++ b/src/emu/cpu/drcbex64.h @@ -41,6 +41,7 @@ public: virtual void generate(drcuml_block &block, const uml::instruction *instlist, UINT32 numinst); virtual bool hash_exists(UINT32 mode, UINT32 pc); virtual void get_info(drcbe_info &info); + virtual bool logging() const { return m_log != NULL; } private: // a be_parameter is similar to a uml::parameter but maps to native registers/memory diff --git a/src/emu/cpu/drcbex86.c b/src/emu/cpu/drcbex86.c index 71eb7bf5265..2e0dd7704d4 100644 --- a/src/emu/cpu/drcbex86.c +++ b/src/emu/cpu/drcbex86.c @@ -566,8 +566,11 @@ drcbe_x86::drcbe_x86(drcuml_state &drcuml, device_t &device, drc_cache &cache, U s_opcode_table[s_opcode_table_source[opnum].opcode] = s_opcode_table_source[opnum].func; // create the log - if (flags & DRCUML_OPTION_LOG_NATIVE) - m_log = x86log_create_context("drcbex86.asm"); + if (device.machine().options().drc_log_native()) + { + astring filename("drcbex86_", device.shortname(), ".asm"); + m_log = x86log_create_context(filename.cstr()); + } } diff --git a/src/emu/cpu/drcbex86.h b/src/emu/cpu/drcbex86.h index 657e5431b0f..3c3af63d0d0 100644 --- a/src/emu/cpu/drcbex86.h +++ b/src/emu/cpu/drcbex86.h @@ -41,6 +41,7 @@ public: virtual void generate(drcuml_block &block, const uml::instruction *instlist, UINT32 numinst); virtual bool hash_exists(UINT32 mode, UINT32 pc); virtual void get_info(drcbe_info &info); + virtual bool logging() const { return m_log != NULL; } private: // a be_parameter is similar to a uml::parameter but maps to native registers/memory diff --git a/src/emu/cpu/drcuml.h b/src/emu/cpu/drcuml.h index 072bbcfa9d1..aef1f5c76ff 100644 --- a/src/emu/cpu/drcuml.h +++ b/src/emu/cpu/drcuml.h @@ -22,7 +22,6 @@ //************************************************************************** // these options are passed into drcuml_alloc() and control global behaviors -const UINT32 DRCUML_OPTION_LOG_NATIVE = 0x0004; // tell the back-end to generate a native disassembly of each block @@ -148,6 +147,7 @@ public: virtual void generate(drcuml_block &block, const uml::instruction *instlist, UINT32 numinst) = 0; virtual bool hash_exists(UINT32 mode, UINT32 pc) = 0; virtual void get_info(drcbe_info &info) = 0; + virtual bool logging() const { return false; } protected: // internal state @@ -195,6 +195,7 @@ public: bool logging() const { return (m_umllog != NULL); } void log_printf(const char *format, ...) ATTR_PRINTF(2,3); void log_flush() { if (logging()) fflush(m_umllog); } + bool logging_native() const { return m_beintf.logging(); } private: // symbol class diff --git a/src/emu/cpu/mips/mips3.c b/src/emu/cpu/mips/mips3.c index 74a997832e6..2234a4f86a6 100644 --- a/src/emu/cpu/mips/mips3.c +++ b/src/emu/cpu/mips/mips3.c @@ -355,8 +355,6 @@ void mips3_device::device_start() UINT32 flags = 0; /* initialize the UML generator */ - if (LOG_NATIVE) - flags |= DRCUML_OPTION_LOG_NATIVE; m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, flags, 8, 32, 2)); /* add symbols for our stuff */ diff --git a/src/emu/cpu/mips/mips3com.h b/src/emu/cpu/mips/mips3com.h index 3e53d18a7a0..a3e26a11df3 100644 --- a/src/emu/cpu/mips/mips3com.h +++ b/src/emu/cpu/mips/mips3com.h @@ -22,8 +22,6 @@ #define PRINTF_TLB (0) #define USE_ABI_REG_NAMES (1) -#define LOG_NATIVE (0) - #define DISABLE_FAST_REGISTERS (0) #define SINGLE_INSTRUCTION_MODE (0) diff --git a/src/emu/cpu/mips/mips3drc.c b/src/emu/cpu/mips/mips3drc.c index 2bef5c36bf4..0fa12f3f670 100644 --- a/src/emu/cpu/mips/mips3drc.c +++ b/src/emu/cpu/mips/mips3drc.c @@ -275,7 +275,7 @@ void mips3_device::code_compile_block(UINT8 mode, offs_t pc) /* get a description of this sequence */ desclist = m_drcfe->describe_code(pc); - if (drcuml->logging() || LOG_NATIVE) + if (drcuml->logging() || drcuml->logging_native()) log_opcode_desc(drcuml, desclist, 0); /* if we get an error back, flush the cache and try again */ @@ -3264,7 +3264,7 @@ void mips3_device::log_opcode_desc(drcuml_state *drcuml, const opcode_desc *desc char buffer[100]; /* disassemle the current instruction and output it to the log */ - if (drcuml->logging() || LOG_NATIVE) + if (drcuml->logging() || drcuml->logging_native()) { if (desclist->flags & OPFLAG_VIRTUAL_NOOP) strcpy(buffer, ""); diff --git a/src/emu/cpu/powerpc/ppccom.c b/src/emu/cpu/powerpc/ppccom.c index 1f03c28f250..b0b12409e7f 100644 --- a/src/emu/cpu/powerpc/ppccom.c +++ b/src/emu/cpu/powerpc/ppccom.c @@ -880,8 +880,6 @@ void ppc_device::device_start() UINT32 flags = 0; /* initialize the UML generator */ - if (LOG_NATIVE) - flags |= DRCUML_OPTION_LOG_NATIVE; m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, flags, 8, 32, 2)); /* add symbols for our stuff */ diff --git a/src/emu/cpu/powerpc/ppccom.h b/src/emu/cpu/powerpc/ppccom.h index ab93ff2f63a..980d8114043 100644 --- a/src/emu/cpu/powerpc/ppccom.h +++ b/src/emu/cpu/powerpc/ppccom.h @@ -18,8 +18,6 @@ DEBUGGING ***************************************************************************/ -#define LOG_NATIVE (0) - #define DISABLE_FLAG_OPTIMIZATIONS (0) #define DISABLE_FAST_REGISTERS (0) #define SINGLE_INSTRUCTION_MODE (0) diff --git a/src/emu/cpu/powerpc/ppcdrc.c b/src/emu/cpu/powerpc/ppcdrc.c index 15c88ef0bcd..61037b8de9a 100644 --- a/src/emu/cpu/powerpc/ppcdrc.c +++ b/src/emu/cpu/powerpc/ppcdrc.c @@ -368,7 +368,7 @@ void ppc_device::code_compile_block(UINT8 mode, offs_t pc) /* get a description of this sequence */ desclist = m_drcfe->describe_code(pc); - if (m_drcuml->logging() || LOG_NATIVE) + if (m_drcuml->logging() || m_drcuml->logging_native()) log_opcode_desc(m_drcuml, desclist, 0); bool succeeded = false; @@ -3895,7 +3895,7 @@ void ppc_device::log_opcode_desc(drcuml_state *drcuml, const opcode_desc *descli char buffer[100]; /* disassemle the current instruction and output it to the log */ - if (drcuml->logging() || LOG_NATIVE) + if (drcuml->logging() || drcuml->logging_native()) { if (desclist->flags & OPFLAG_VIRTUAL_NOOP) strcpy(buffer, ""); diff --git a/src/emu/cpu/rsp/rsp.c b/src/emu/cpu/rsp/rsp.c index 3d7464a47c6..07a91450562 100644 --- a/src/emu/cpu/rsp/rsp.c +++ b/src/emu/cpu/rsp/rsp.c @@ -121,7 +121,7 @@ rsp_device::rsp_device(const machine_config &mconfig, const char *tag, device_t , m_program_config("program", ENDIANNESS_BIG, 32, 32) , m_cache(CACHE_SIZE + sizeof(internal_rsp_state)) , m_drcuml(NULL) -// , m_drcuml(*this, m_cache, ( RSP_LOG_NATIVE ? DRCUML_OPTION_LOG_NATIVE : 0 ), 8, 32, 2) +// , m_drcuml(*this, m_cache, 0, 8, 32, 2) , m_drcfe(NULL) , m_drcoptions(0) , m_cache_dirty(TRUE) @@ -432,10 +432,6 @@ void rsp_device::device_start() /* initialize the UML generator */ UINT32 drc_flags = 0; - if (RSP_LOG_NATIVE) - { - drc_flags |= DRCUML_OPTION_LOG_NATIVE; - } m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, drc_flags, 8, 32, 2)); /* add symbols for our stuff */ diff --git a/src/emu/cpu/rsp/rsp.h b/src/emu/cpu/rsp/rsp.h index e8243ffda61..02c4e14c138 100644 --- a/src/emu/cpu/rsp/rsp.h +++ b/src/emu/cpu/rsp/rsp.h @@ -22,7 +22,6 @@ #define USE_SIMD (0) #define SIMUL_SIMD (0) -#define RSP_LOG_NATIVE (0) #if USE_SIMD #include diff --git a/src/emu/cpu/sh2/sh2.c b/src/emu/cpu/sh2/sh2.c index 0d3e184a4b4..92c06d08291 100644 --- a/src/emu/cpu/sh2/sh2.c +++ b/src/emu/cpu/sh2/sh2.c @@ -115,8 +115,6 @@ DEBUGGING ***************************************************************************/ -#define LOG_NATIVE (0) // log native assembly - #define DISABLE_FAST_REGISTERS (0) // set to 1 to turn off usage of register caching #define SINGLE_INSTRUCTION_MODE (0) @@ -169,7 +167,7 @@ sh2_device::sh2_device(const machine_config &mconfig, const char *tag, device_t , m_cpu_type(CPU_TYPE_SH2) , m_cache(CACHE_SIZE + sizeof(internal_sh2_state)) , m_drcuml(NULL) -// , m_drcuml(*this, m_cache, ( LOG_NATIVE ? DRCUML_OPTION_LOG_NATIVE : 0 ), 1, 32, 1) +// , m_drcuml(*this, m_cache, 0, 1, 32, 1) , m_drcfe(NULL) , m_drcoptions(0) , m_sh2_state(NULL) @@ -206,7 +204,7 @@ sh2_device::sh2_device(const machine_config &mconfig, device_type type, const ch , m_cpu_type(cpu_type) , m_cache(CACHE_SIZE + sizeof(internal_sh2_state)) , m_drcuml(NULL) -// , m_drcuml(*this, m_cache, ( LOG_NATIVE ? DRCUML_OPTION_LOG_NATIVE : 0 ), 1, 32, 1) +// , m_drcuml(*this, m_cache, 0, 1, 32, 1) , m_drcfe(NULL) , m_drcoptions(0) , m_sh2_state(NULL) @@ -2560,8 +2558,6 @@ void sh2_device::device_start() /* initialize the UML generator */ UINT32 flags = 0; - if (LOG_NATIVE) - flags |= DRCUML_OPTION_LOG_NATIVE; m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, flags, 1, 32, 1)); /* add symbols for our stuff */ diff --git a/src/emu/cpu/sh2/sh2drc.c b/src/emu/cpu/sh2/sh2drc.c index 3e2c124c910..3ed2807b5c4 100644 --- a/src/emu/cpu/sh2/sh2drc.c +++ b/src/emu/cpu/sh2/sh2drc.c @@ -675,7 +675,7 @@ void sh2_device::code_compile_block(UINT8 mode, offs_t pc) /* get a description of this sequence */ desclist = m_drcfe->describe_code(pc); - if (drcuml->logging() || LOG_NATIVE) + if (drcuml->logging() || drcuml->logging_native()) log_opcode_desc(drcuml, desclist, 0); bool succeeded = false; @@ -1174,7 +1174,7 @@ void sh2_device::log_opcode_desc(drcuml_state *drcuml, const opcode_desc *descli char buffer[100]; /* disassemle the current instruction and output it to the log */ - if (drcuml->logging() || LOG_NATIVE) + if (drcuml->logging() || drcuml->logging_native()) { if (desclist->flags & OPFLAG_VIRTUAL_NOOP) strcpy(buffer, ""); diff --git a/src/emu/emuopts.c b/src/emu/emuopts.c index 31a533a518c..2f968850031 100644 --- a/src/emu/emuopts.c +++ b/src/emu/emuopts.c @@ -158,6 +158,7 @@ const options_entry emu_options::s_option_entries[] = { OPTION_DRC, "1", OPTION_BOOLEAN, "enable DRC cpu core if available" }, { OPTION_DRC_USE_C, "0", OPTION_BOOLEAN, "force DRC use C backend" }, { OPTION_DRC_LOG_UML, "0", OPTION_BOOLEAN, "write DRC UML disassembly log" }, + { OPTION_DRC_LOG_NATIVE, "0", OPTION_BOOLEAN, "write DRC native disassembly log" }, { OPTION_BIOS, NULL, OPTION_STRING, "select the system BIOS to use" }, { OPTION_CHEAT ";c", "0", OPTION_BOOLEAN, "enable cheat subsystem" }, { OPTION_SKIP_GAMEINFO, "0", OPTION_BOOLEAN, "skip displaying the information screen at startup" }, diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index a951f2dc12c..a0a561a124b 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -161,6 +161,7 @@ enum #define OPTION_DRC "drc" #define OPTION_DRC_USE_C "drc_use_c" #define OPTION_DRC_LOG_UML "drc_log_uml" +#define OPTION_DRC_LOG_NATIVE "drc_log_native" #define OPTION_BIOS "bios" #define OPTION_CHEAT "cheat" #define OPTION_SKIP_GAMEINFO "skip_gameinfo" @@ -322,6 +323,7 @@ public: bool drc() const { return bool_value(OPTION_DRC); } bool drc_use_c() const { return bool_value(OPTION_DRC_USE_C); } bool drc_log_uml() const { return bool_value(OPTION_DRC_LOG_UML); } + bool drc_log_native() const { return bool_value(OPTION_DRC_LOG_NATIVE); } const char *bios() const { return value(OPTION_BIOS); } bool cheat() const { return bool_value(OPTION_CHEAT); } bool skip_gameinfo() const { return bool_value(OPTION_SKIP_GAMEINFO); } -- cgit v1.2.3