Previous 199869 Revisions Next

r33273 Friday 7th November, 2014 at 20:24:35 UTC by Oliver Stöneberg
added command-line option -[no]drc_log_native to control DRC native diassembly logging [Oliver Stöneberg]

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]emuopts.c emuopts.h
[src/emu/cpu]drcbex64.c drcbex64.h drcbex86.c drcbex86.h drcuml.h
[src/emu/cpu/arm7]arm7drc.inc
[src/emu/cpu/mips]mips3.c mips3com.h mips3drc.c
[src/emu/cpu/powerpc]ppccom.c ppccom.h ppcdrc.c
[src/emu/cpu/rsp]rsp.c rsp.h
[src/emu/cpu/sh2]sh2.c sh2drc.c

trunk/src/emu/cpu/arm7/arm7drc.inc
r241784r241785
4141    DEBUGGING
4242***************************************************************************/
4343
44#define LOG_NATIVE                      (0)
45
4644#define SINGLE_INSTRUCTION_MODE         (0)
4745
4846/***************************************************************************
r241784r241785
153151   m_impstate.cache = cache;
154152
155153   /* initialize the UML generator */
156   if (LOG_NATIVE)
157      flags |= DRCUML_OPTION_LOG_NATIVE;
158154   m_impstate.drcuml = new drcuml_state(*this, *cache, flags, 1, 32, 1);
159155
160156   /* add symbols for our stuff */
r241784r241785
352348   /* get a description of this sequence */
353349   // TODO FIXME
354350   const opcode_desc *desclist = NULL; //m_impstate.drcfe->describe_code(pc); // TODO
355//  if (drcuml->logging() || LOG_NATIVE)
351//  if (drcuml->logging() || drcuml->logging_native())
356352//      log_opcode_desc(drcuml, desclist, 0);
357353
358354   /* if we get an error back, flush the cache and try again */
trunk/src/emu/cpu/drcbex64.c
r241784r241785
652652      s_opcode_table[s_opcode_table_source[opnum].opcode] = s_opcode_table_source[opnum].func;
653653
654654   // create the log
655   if (flags & DRCUML_OPTION_LOG_NATIVE)
656      m_log = x86log_create_context("drcbex64.asm");
655   if (device.machine().options().drc_log_native())
656   {
657      astring filename("drcbex64_", device.shortname(), ".asm");
658      m_log = x86log_create_context(filename.cstr());
659   }
657660}
658661
659662
trunk/src/emu/cpu/drcbex64.h
r241784r241785
4141   virtual void generate(drcuml_block &block, const uml::instruction *instlist, UINT32 numinst);
4242   virtual bool hash_exists(UINT32 mode, UINT32 pc);
4343   virtual void get_info(drcbe_info &info);
44   virtual bool logging() const { return m_log != NULL; }
4445
4546private:
4647   // a be_parameter is similar to a uml::parameter but maps to native registers/memory
trunk/src/emu/cpu/drcbex86.c
r241784r241785
566566      s_opcode_table[s_opcode_table_source[opnum].opcode] = s_opcode_table_source[opnum].func;
567567
568568   // create the log
569   if (flags & DRCUML_OPTION_LOG_NATIVE)
570      m_log = x86log_create_context("drcbex86.asm");
569   if (device.machine().options().drc_log_native())
570   {
571      astring filename("drcbex86_", device.shortname(), ".asm");
572      m_log = x86log_create_context(filename.cstr());
573   }
571574}
572575
573576
trunk/src/emu/cpu/drcbex86.h
r241784r241785
4141   virtual void generate(drcuml_block &block, const uml::instruction *instlist, UINT32 numinst);
4242   virtual bool hash_exists(UINT32 mode, UINT32 pc);
4343   virtual void get_info(drcbe_info &info);
44   virtual bool logging() const { return m_log != NULL; }
4445
4546private:
4647   // a be_parameter is similar to a uml::parameter but maps to native registers/memory
trunk/src/emu/cpu/drcuml.h
r241784r241785
2222//**************************************************************************
2323
2424// these options are passed into drcuml_alloc() and control global behaviors
25const UINT32 DRCUML_OPTION_LOG_NATIVE   = 0x0004;       // tell the back-end to generate a native disassembly of each block
2625
2726
2827
r241784r241785
148147   virtual void generate(drcuml_block &block, const uml::instruction *instlist, UINT32 numinst) = 0;
149148   virtual bool hash_exists(UINT32 mode, UINT32 pc) = 0;
150149   virtual void get_info(drcbe_info &info) = 0;
150   virtual bool logging() const { return false; }
151151
152152protected:
153153   // internal state
r241784r241785
195195   bool logging() const { return (m_umllog != NULL); }
196196   void log_printf(const char *format, ...) ATTR_PRINTF(2,3);
197197   void log_flush() { if (logging()) fflush(m_umllog); }
198   bool logging_native() const { return m_beintf.logging(); }
198199
199200private:
200201   // symbol class
trunk/src/emu/cpu/mips/mips3.c
r241784r241785
355355
356356   UINT32 flags = 0;
357357   /* initialize the UML generator */
358   if (LOG_NATIVE)
359      flags |= DRCUML_OPTION_LOG_NATIVE;
360358   m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, flags, 8, 32, 2));
361359
362360   /* add symbols for our stuff */
trunk/src/emu/cpu/mips/mips3com.h
r241784r241785
2222#define PRINTF_TLB              (0)
2323#define USE_ABI_REG_NAMES       (1)
2424
25#define LOG_NATIVE                      (0)
26
2725#define DISABLE_FAST_REGISTERS          (0)
2826#define SINGLE_INSTRUCTION_MODE         (0)
2927
trunk/src/emu/cpu/mips/mips3drc.c
r241784r241785
275275
276276   /* get a description of this sequence */
277277   desclist = m_drcfe->describe_code(pc);
278   if (drcuml->logging() || LOG_NATIVE)
278   if (drcuml->logging() || drcuml->logging_native())
279279      log_opcode_desc(drcuml, desclist, 0);
280280
281281   /* if we get an error back, flush the cache and try again */
r241784r241785
32643264      char buffer[100];
32653265
32663266      /* disassemle the current instruction and output it to the log */
3267      if (drcuml->logging() || LOG_NATIVE)
3267      if (drcuml->logging() || drcuml->logging_native())
32683268      {
32693269         if (desclist->flags & OPFLAG_VIRTUAL_NOOP)
32703270            strcpy(buffer, "<virtual nop>");
trunk/src/emu/cpu/powerpc/ppccom.c
r241784r241785
880880
881881   UINT32 flags = 0;
882882   /* initialize the UML generator */
883   if (LOG_NATIVE)
884      flags |= DRCUML_OPTION_LOG_NATIVE;
885883   m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, flags, 8, 32, 2));
886884
887885   /* add symbols for our stuff */
trunk/src/emu/cpu/powerpc/ppccom.h
r241784r241785
1818    DEBUGGING
1919***************************************************************************/
2020
21#define LOG_NATIVE                      (0)
22
2321#define DISABLE_FLAG_OPTIMIZATIONS      (0)
2422#define DISABLE_FAST_REGISTERS          (0)
2523#define SINGLE_INSTRUCTION_MODE         (0)
trunk/src/emu/cpu/powerpc/ppcdrc.c
r241784r241785
368368
369369   /* get a description of this sequence */
370370   desclist = m_drcfe->describe_code(pc);
371   if (m_drcuml->logging() || LOG_NATIVE)
371   if (m_drcuml->logging() || m_drcuml->logging_native())
372372      log_opcode_desc(m_drcuml, desclist, 0);
373373
374374   bool succeeded = false;
r241784r241785
38953895      char buffer[100];
38963896
38973897      /* disassemle the current instruction and output it to the log */
3898      if (drcuml->logging() || LOG_NATIVE)
3898      if (drcuml->logging() || drcuml->logging_native())
38993899      {
39003900         if (desclist->flags & OPFLAG_VIRTUAL_NOOP)
39013901            strcpy(buffer, "<virtual nop>");
trunk/src/emu/cpu/rsp/rsp.c
r241784r241785
121121   , m_program_config("program", ENDIANNESS_BIG, 32, 32)
122122   , m_cache(CACHE_SIZE + sizeof(internal_rsp_state))
123123   , m_drcuml(NULL)
124//  , m_drcuml(*this, m_cache, ( RSP_LOG_NATIVE ? DRCUML_OPTION_LOG_NATIVE : 0 ), 8, 32, 2)
124//  , m_drcuml(*this, m_cache, 0, 8, 32, 2)
125125   , m_drcfe(NULL)
126126   , m_drcoptions(0)
127127   , m_cache_dirty(TRUE)
r241784r241785
432432
433433   /* initialize the UML generator */
434434   UINT32 drc_flags = 0;
435   if (RSP_LOG_NATIVE)
436   {
437      drc_flags |= DRCUML_OPTION_LOG_NATIVE;
438   }
439435   m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, drc_flags, 8, 32, 2));
440436
441437   /* add symbols for our stuff */
trunk/src/emu/cpu/rsp/rsp.h
r241784r241785
2222
2323#define USE_SIMD        (0)
2424#define SIMUL_SIMD      (0)
25#define RSP_LOG_NATIVE  (0)
2625
2726#if USE_SIMD
2827#include <tmmintrin.h>
trunk/src/emu/cpu/sh2/sh2.c
r241784r241785
115115    DEBUGGING
116116***************************************************************************/
117117
118#define LOG_NATIVE                  (0) // log native assembly
119
120118#define DISABLE_FAST_REGISTERS              (0) // set to 1 to turn off usage of register caching
121119#define SINGLE_INSTRUCTION_MODE             (0)
122120
r241784r241785
169167   , m_cpu_type(CPU_TYPE_SH2)
170168   , m_cache(CACHE_SIZE + sizeof(internal_sh2_state))
171169   , m_drcuml(NULL)
172//  , m_drcuml(*this, m_cache, ( LOG_NATIVE ? DRCUML_OPTION_LOG_NATIVE : 0 ), 1, 32, 1)
170//  , m_drcuml(*this, m_cache, 0, 1, 32, 1)
173171   , m_drcfe(NULL)
174172   , m_drcoptions(0)
175173   , m_sh2_state(NULL)
r241784r241785
206204   , m_cpu_type(cpu_type)
207205   , m_cache(CACHE_SIZE + sizeof(internal_sh2_state))
208206   , m_drcuml(NULL)
209//  , m_drcuml(*this, m_cache, ( LOG_NATIVE ? DRCUML_OPTION_LOG_NATIVE : 0 ), 1, 32, 1)
207//  , m_drcuml(*this, m_cache, 0, 1, 32, 1)
210208   , m_drcfe(NULL)
211209   , m_drcoptions(0)
212210   , m_sh2_state(NULL)
r241784r241785
25602558
25612559   /* initialize the UML generator */
25622560   UINT32 flags = 0;
2563   if (LOG_NATIVE)
2564      flags |= DRCUML_OPTION_LOG_NATIVE;
25652561   m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, flags, 1, 32, 1));
25662562
25672563   /* add symbols for our stuff */
trunk/src/emu/cpu/sh2/sh2drc.c
r241784r241785
675675
676676   /* get a description of this sequence */
677677   desclist = m_drcfe->describe_code(pc);
678   if (drcuml->logging() || LOG_NATIVE)
678   if (drcuml->logging() || drcuml->logging_native())
679679      log_opcode_desc(drcuml, desclist, 0);
680680
681681   bool succeeded = false;
r241784r241785
11741174      char buffer[100];
11751175
11761176      /* disassemle the current instruction and output it to the log */
1177      if (drcuml->logging() || LOG_NATIVE)
1177      if (drcuml->logging() || drcuml->logging_native())
11781178      {
11791179         if (desclist->flags & OPFLAG_VIRTUAL_NOOP)
11801180            strcpy(buffer, "<virtual nop>");
trunk/src/emu/emuopts.c
r241784r241785
158158   { OPTION_DRC,                                        "1",         OPTION_BOOLEAN,    "enable DRC cpu core if available" },
159159   { OPTION_DRC_USE_C,                                  "0",         OPTION_BOOLEAN,    "force DRC use C backend" },
160160   { OPTION_DRC_LOG_UML,                                "0",         OPTION_BOOLEAN,    "write DRC UML disassembly log" },
161   { OPTION_DRC_LOG_NATIVE,                             "0",         OPTION_BOOLEAN,    "write DRC native disassembly log" },
161162   { OPTION_BIOS,                                       NULL,        OPTION_STRING,     "select the system BIOS to use" },
162163   { OPTION_CHEAT ";c",                                 "0",         OPTION_BOOLEAN,    "enable cheat subsystem" },
163164   { OPTION_SKIP_GAMEINFO,                              "0",         OPTION_BOOLEAN,    "skip displaying the information screen at startup" },
trunk/src/emu/emuopts.h
r241784r241785
161161#define OPTION_DRC                  "drc"
162162#define OPTION_DRC_USE_C            "drc_use_c"
163163#define OPTION_DRC_LOG_UML          "drc_log_uml"
164#define OPTION_DRC_LOG_NATIVE       "drc_log_native"
164165#define OPTION_BIOS                 "bios"
165166#define OPTION_CHEAT                "cheat"
166167#define OPTION_SKIP_GAMEINFO        "skip_gameinfo"
r241784r241785
322323   bool drc() const { return bool_value(OPTION_DRC); }
323324   bool drc_use_c() const { return bool_value(OPTION_DRC_USE_C); }
324325   bool drc_log_uml() const { return bool_value(OPTION_DRC_LOG_UML); }
326   bool drc_log_native() const { return bool_value(OPTION_DRC_LOG_NATIVE); }
325327   const char *bios() const { return value(OPTION_BIOS); }
326328   bool cheat() const { return bool_value(OPTION_CHEAT); }
327329   bool skip_gameinfo() const { return bool_value(OPTION_SKIP_GAMEINFO); }


Previous 199869 Revisions Next


© 1997-2024 The MAME Team