Previous 199869 Revisions Next

r33261 Friday 7th November, 2014 at 10:20:27 UTC by Oliver Stöneberg
added command-line option -[no]drc_log_uml to control DRC UML disassembly logging [Oliver Stöneberg]

allows logging of DRC UML disassembly without re-compiling / removes
DRCUML_OPTION_LOG_UML and all the core-specific LOG_UML defines
[src/emu]emuopts.c emuopts.h
[src/emu/cpu]drcuml.c 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 rspdrc.c
[src/emu/cpu/sh2]sh2.c sh2drc.c

trunk/src/emu/cpu/arm7/arm7drc.inc
r241772r241773
4141    DEBUGGING
4242***************************************************************************/
4343
44#define LOG_UML                         (0)
4544#define LOG_NATIVE                      (0)
4645
4746#define SINGLE_INSTRUCTION_MODE         (0)
r241772r241773
154153   m_impstate.cache = cache;
155154
156155   /* initialize the UML generator */
157   if (LOG_UML)
158      flags |= DRCUML_OPTION_LOG_UML;
159156   if (LOG_NATIVE)
160157      flags |= DRCUML_OPTION_LOG_NATIVE;
161158   m_impstate.drcuml = new drcuml_state(*this, *cache, flags, 1, 32, 1);
r241772r241773
355352   /* get a description of this sequence */
356353   // TODO FIXME
357354   const opcode_desc *desclist = NULL; //m_impstate.drcfe->describe_code(pc); // TODO
358//  if (LOG_UML || LOG_NATIVE)
355//  if (drcuml->logging() || LOG_NATIVE)
359356//      log_opcode_desc(drcuml, desclist, 0);
360357
361358   /* if we get an error back, flush the cache and try again */
r241772r241773
374371            UINT32 nextpc;
375372
376373            /* add a code log entry */
377            if (LOG_UML)
374            if (drcuml->logging())
378375               block->append_comment("-------------------------");                     // comment
379376
380377            /* determine the last instruction in this sequence */
r241772r241773
12091206void arm7_cpu_device::generate_checksum_block(drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast)
12101207{
12111208   const opcode_desc *curdesc;
1212   if (LOG_UML)
1209   if (m_impstate.drcuml->logging())
12131210   {
12141211      block->append_comment("[Validation for %08X]", seqhead->pc);                // comment
12151212   }
r241772r241773
12781275
12791276   /* add an entry for the log */
12801277   // TODO FIXME
1281//  if (LOG_UML && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
1278//  if (m_impstate.drcuml->logging() && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
12821279//      log_add_disasm_comment(block, desc->pc, desc->opptr.l[0]);
12831280
12841281   /* set the PC map variable */
trunk/src/emu/cpu/drcuml.c
r241772r241773
121121drcuml_state::drcuml_state(device_t &device, drc_cache &cache, UINT32 flags, int modes, int addrbits, int ignorebits)
122122   : m_device(device),
123123      m_cache(cache),
124      m_beintf((device.machine().options().drc_use_c()) ?
124      m_beintf(device.machine().options().drc_use_c() ?
125125         *static_cast<drcbe_interface *>(auto_alloc(device.machine(), drcbe_c(*this, device, cache, flags, modes, addrbits, ignorebits))) :
126126         *static_cast<drcbe_interface *>(auto_alloc(device.machine(), drcbe_native(*this, device, cache, flags, modes, addrbits, ignorebits)))),
127127      m_umllog(NULL)
128128{
129129   // if we're to log, create the logfile
130   if (flags & DRCUML_OPTION_LOG_UML)
130   if (device.machine().options().drc_log_uml())
131131      m_umllog = fopen("drcuml.asm", "w");
132132}
133133
trunk/src/emu/cpu/drcuml.h
r241772r241773
2222//**************************************************************************
2323
2424// these options are passed into drcuml_alloc() and control global behaviors
25const UINT32 DRCUML_OPTION_LOG_UML      = 0x0002;       // generate a UML disassembly of each block
2625const UINT32 DRCUML_OPTION_LOG_NATIVE   = 0x0004;       // tell the back-end to generate a native disassembly of each block
2726
2827
trunk/src/emu/cpu/mips/mips3.c
r241772r241773
355355
356356   UINT32 flags = 0;
357357   /* initialize the UML generator */
358   if (LOG_UML)
359      flags |= DRCUML_OPTION_LOG_UML;
360358   if (LOG_NATIVE)
361359      flags |= DRCUML_OPTION_LOG_NATIVE;
362360   m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, flags, 8, 32, 2));
trunk/src/emu/cpu/mips/mips3com.h
r241772r241773
2222#define PRINTF_TLB              (0)
2323#define USE_ABI_REG_NAMES       (1)
2424
25#define LOG_UML                         (0)
2625#define LOG_NATIVE                      (0)
2726
2827#define DISABLE_FAST_REGISTERS          (0)
trunk/src/emu/cpu/mips/mips3drc.c
r241772r241773
275275
276276   /* get a description of this sequence */
277277   desclist = m_drcfe->describe_code(pc);
278   if (LOG_UML || LOG_NATIVE)
278   if (drcuml->logging() || LOG_NATIVE)
279279      log_opcode_desc(drcuml, desclist, 0);
280280
281281   /* if we get an error back, flush the cache and try again */
r241772r241773
294294            UINT32 nextpc;
295295
296296            /* add a code log entry */
297            if (LOG_UML)
297            if (drcuml->logging())
298298               block->append_comment("-------------------------");                     // comment
299299
300300            /* determine the last instruction in this sequence */
r241772r241773
10701070void mips3_device::generate_checksum_block(drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast)
10711071{
10721072   const opcode_desc *curdesc;
1073   if (LOG_UML)
1073   if (m_drcuml->logging())
10741074      block->append_comment("[Validation for %08X]", seqhead->pc);                // comment
10751075
10761076   /* loose verify or single instruction: just compare and fail */
r241772r241773
11471147   int hotnum;
11481148
11491149   /* add an entry for the log */
1150   if (LOG_UML && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
1150   if (m_drcuml->logging() && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
11511151      log_add_disasm_comment(block, desc->pc, desc->opptr.l[0]);
11521152
11531153   /* set the PC map variable */
r241772r241773
31293129
31303130void mips3_device::log_add_disasm_comment(drcuml_block *block, UINT32 pc, UINT32 op)
31313131{
3132#if (LOG_UML)
3133   char buffer[100];
3134   dasmmips3(buffer, pc, op);
3135   block->append_comment("%08X: %s", pc, buffer);                                  // comment
3136#endif
3132   if (m_drcuml->logging())
3133   {
3134      char buffer[100];
3135      dasmmips3(buffer, pc, op);
3136      block->append_comment("%08X: %s", pc, buffer);                                  // comment
3137   }
31373138}
31383139
31393140
r241772r241773
32633264      char buffer[100];
32643265
32653266      /* disassemle the current instruction and output it to the log */
3266#if (LOG_UML || LOG_NATIVE)
3267      if (desclist->flags & OPFLAG_VIRTUAL_NOOP)
3268         strcpy(buffer, "<virtual nop>");
3267      if (drcuml->logging() || LOG_NATIVE)
3268      {
3269         if (desclist->flags & OPFLAG_VIRTUAL_NOOP)
3270            strcpy(buffer, "<virtual nop>");
3271         else
3272            dasmmips3(buffer, desclist->pc, desclist->opptr.l[0]);
3273      }
32693274      else
3270         dasmmips3(buffer, desclist->pc, desclist->opptr.l[0]);
3271#else
3272      strcpy(buffer, "???");
3273#endif
3275         strcpy(buffer, "???");
32743276      drcuml->log_printf("%08X [%08X] t:%08X f:%s: %-30s", desclist->pc, desclist->physpc, desclist->targetpc, log_desc_flags_to_string(desclist->flags), buffer);
32753277
32763278      /* output register states */
trunk/src/emu/cpu/powerpc/ppccom.c
r241772r241773
880880
881881   UINT32 flags = 0;
882882   /* initialize the UML generator */
883   if (LOG_UML)
884      flags |= DRCUML_OPTION_LOG_UML;
885883   if (LOG_NATIVE)
886884      flags |= DRCUML_OPTION_LOG_NATIVE;
887885   m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, flags, 8, 32, 2));
trunk/src/emu/cpu/powerpc/ppccom.h
r241772r241773
1818    DEBUGGING
1919***************************************************************************/
2020
21#define LOG_UML                         (0)
2221#define LOG_NATIVE                      (0)
2322
2423#define DISABLE_FLAG_OPTIMIZATIONS      (0)
trunk/src/emu/cpu/powerpc/ppcdrc.c
r241772r241773
368368
369369   /* get a description of this sequence */
370370   desclist = m_drcfe->describe_code(pc);
371   if (LOG_UML || LOG_NATIVE)
371   if (m_drcuml->logging() || LOG_NATIVE)
372372      log_opcode_desc(m_drcuml, desclist, 0);
373373
374374   bool succeeded = false;
r241772r241773
386386            UINT32 nextpc;
387387
388388            /* add a code log entry */
389            if (LOG_UML)
389            if (m_drcuml->logging())
390390               block->append_comment("-------------------------");                         // comment
391391
392392            /* determine the last instruction in this sequence */
r241772r241773
15871587void ppc_device::generate_checksum_block(drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast)
15881588{
15891589   const opcode_desc *curdesc;
1590   if (LOG_UML)
1590   if (m_drcuml->logging())
15911591      block->append_comment("[Validation for %08X]", seqhead->pc);                        // comment
15921592
15931593   /* loose verify or single instruction: just compare and fail */
r241772r241773
16441644   int hotnum;
16451645
16461646   /* add an entry for the log */
1647   if (LOG_UML && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
1647   if (m_drcuml->logging() && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
16481648      log_add_disasm_comment(block, desc->pc, desc->opptr.l[0]);
16491649
16501650   /* set the PC map variable */
r241772r241773
37123712void ppc_device::log_add_disasm_comment(drcuml_block *block, UINT32 pc, UINT32 op)
37133713{
37143714   char buffer[100];
3715   if (LOG_UML)
3715   if (m_drcuml->logging())
37163716   {
37173717      ppc_dasm_one(buffer, pc, op);
37183718      block->append_comment("%08X: %s", pc, buffer);                                  // comment
r241772r241773
38953895      char buffer[100];
38963896
38973897      /* disassemle the current instruction and output it to the log */
3898      if (LOG_UML || LOG_NATIVE)
3898      if (drcuml->logging() || LOG_NATIVE)
38993899      {
39003900         if (desclist->flags & OPFLAG_VIRTUAL_NOOP)
39013901            strcpy(buffer, "<virtual nop>");
trunk/src/emu/cpu/rsp/rsp.c
r241772r241773
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_UML ? DRCUML_OPTION_LOG_UML : 0 ) | ( RSP_LOG_NATIVE ? DRCUML_OPTION_LOG_NATIVE : 0 ), 8, 32, 2)
124//  , m_drcuml(*this, m_cache, ( RSP_LOG_NATIVE ? DRCUML_OPTION_LOG_NATIVE : 0 ), 8, 32, 2)
125125   , m_drcfe(NULL)
126126   , m_drcoptions(0)
127127   , m_cache_dirty(TRUE)
r241772r241773
432432
433433   /* initialize the UML generator */
434434   UINT32 drc_flags = 0;
435   if (RSP_LOG_UML)
436   {
437      drc_flags |= DRCUML_OPTION_LOG_UML;
438   }
439435   if (RSP_LOG_NATIVE)
440436   {
441437      drc_flags |= DRCUML_OPTION_LOG_NATIVE;
trunk/src/emu/cpu/rsp/rsp.h
r241772r241773
2222
2323#define USE_SIMD        (0)
2424#define SIMUL_SIMD      (0)
25#define RSP_LOG_UML     (0)
2625#define RSP_LOG_NATIVE  (0)
2726
2827#if USE_SIMD
trunk/src/emu/cpu/rsp/rspdrc.c
r241772r241773
71227122            UINT32 nextpc;
71237123
71247124            /* add a code log entry */
7125            if (RSP_LOG_UML)
7125            if (drcuml->logging())
71267126               block->append_comment("-------------------------");                 // comment
71277127
71287128            /* determine the last instruction in this sequence */
r241772r241773
74037403void rsp_device::generate_checksum_block(drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast)
74047404{
74057405   const opcode_desc *curdesc;
7406   if (RSP_LOG_UML)
7406   if (m_drcuml->logging())
74077407   {
74087408      block->append_comment("[Validation for %08X]", seqhead->pc | 0x1000);       // comment
74097409   }
r241772r241773
74707470   offs_t expc;
74717471
74727472   /* add an entry for the log */
7473   if (RSP_LOG_UML && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
7473   if (m_drcuml->logging() && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
74747474      log_add_disasm_comment(block, desc->pc, desc->opptr.l[0]);
74757475
74767476   /* set the PC map variable */
r241772r241773
92469246
92479247void rsp_device::log_add_disasm_comment(drcuml_block *block, UINT32 pc, UINT32 op)
92489248{
9249#if (RSP_LOG_UML)
9250   char buffer[100];
9251   rsp_dasm_one(buffer, pc, op);
9252   block->append_comment("%08X: %s", pc, buffer);                                  // comment
9253#endif
9249   if (m_drcuml->logging())
9250   {
9251      char buffer[100];
9252      rsp_dasm_one(buffer, pc, op);
9253      block->append_comment("%08X: %s", pc, buffer);                                  // comment
9254   }
92549255}
trunk/src/emu/cpu/sh2/sh2.c
r241772r241773
115115    DEBUGGING
116116***************************************************************************/
117117
118#define LOG_UML                     (0) // log UML assembly
119118#define LOG_NATIVE                  (0) // log native assembly
120119
121120#define DISABLE_FAST_REGISTERS              (0) // set to 1 to turn off usage of register caching
r241772r241773
170169   , m_cpu_type(CPU_TYPE_SH2)
171170   , m_cache(CACHE_SIZE + sizeof(internal_sh2_state))
172171   , m_drcuml(NULL)
173//  , m_drcuml(*this, m_cache, ( LOG_UML ? DRCUML_OPTION_LOG_UML : 0 ) | ( LOG_NATIVE ? DRCUML_OPTION_LOG_NATIVE : 0 ), 1, 32, 1)
172//  , m_drcuml(*this, m_cache, ( LOG_NATIVE ? DRCUML_OPTION_LOG_NATIVE : 0 ), 1, 32, 1)
174173   , m_drcfe(NULL)
175174   , m_drcoptions(0)
176175   , m_sh2_state(NULL)
r241772r241773
207206   , m_cpu_type(cpu_type)
208207   , m_cache(CACHE_SIZE + sizeof(internal_sh2_state))
209208   , m_drcuml(NULL)
210//  , m_drcuml(*this, m_cache, ( LOG_UML ? DRCUML_OPTION_LOG_UML : 0 ) | ( LOG_NATIVE ? DRCUML_OPTION_LOG_NATIVE : 0 ), 1, 32, 1)
209//  , m_drcuml(*this, m_cache, ( LOG_NATIVE ? DRCUML_OPTION_LOG_NATIVE : 0 ), 1, 32, 1)
211210   , m_drcfe(NULL)
212211   , m_drcoptions(0)
213212   , m_sh2_state(NULL)
r241772r241773
25612560
25622561   /* initialize the UML generator */
25632562   UINT32 flags = 0;
2564   if (LOG_UML)
2565      flags |= DRCUML_OPTION_LOG_UML;
25662563   if (LOG_NATIVE)
25672564      flags |= DRCUML_OPTION_LOG_NATIVE;
25682565   m_drcuml = auto_alloc(machine(), drcuml_state(*this, m_cache, flags, 1, 32, 1));
trunk/src/emu/cpu/sh2/sh2drc.c
r241772r241773
675675
676676   /* get a description of this sequence */
677677   desclist = m_drcfe->describe_code(pc);
678   if (LOG_UML || LOG_NATIVE)
678   if (drcuml->logging() || LOG_NATIVE)
679679      log_opcode_desc(drcuml, desclist, 0);
680680
681681   bool succeeded = false;
r241772r241773
693693            UINT32 nextpc;
694694
695695            /* add a code log entry */
696            if (LOG_UML)
696            if (drcuml->logging())
697697               block->append_comment("-------------------------");                 // comment
698698
699699            /* determine the last instruction in this sequence */
r241772r241773
11741174      char buffer[100];
11751175
11761176      /* disassemle the current instruction and output it to the log */
1177#if (LOG_UML || LOG_NATIVE)
1178      if (desclist->flags & OPFLAG_VIRTUAL_NOOP)
1179         strcpy(buffer, "<virtual nop>");
1177      if (drcuml->logging() || LOG_NATIVE)
1178      {
1179         if (desclist->flags & OPFLAG_VIRTUAL_NOOP)
1180            strcpy(buffer, "<virtual nop>");
1181         else
1182            DasmSH2(buffer, desclist->pc, desclist->opptr.w[0]);
1183      }
11801184      else
1181         DasmSH2(buffer, desclist->pc, desclist->opptr.w[0]);
1182#else
1183      strcpy(buffer, "???");
1184#endif
1185         strcpy(buffer, "???");
11851186      drcuml->log_printf("%08X [%08X] t:%08X f:%s: %-30s", desclist->pc, desclist->physpc, desclist->targetpc, log_desc_flags_to_string(desclist->flags), buffer);
11861187
11871188      /* output register states */
r241772r241773
12061207
12071208void sh2_device::log_add_disasm_comment(drcuml_block *block, UINT32 pc, UINT32 op)
12081209{
1209#if (LOG_UML)
1210   char buffer[100];
1211   DasmSH2(buffer, pc, op);
1212   block->append_comment("%08X: %s", pc, buffer);                  // comment
1213#endif
1210   if (m_drcuml->logging())
1211   {
1212      char buffer[100];
1213      DasmSH2(buffer, pc, op);
1214      block->append_comment("%08X: %s", pc, buffer);                  // comment
1215   }
12141216}
12151217
12161218/*-------------------------------------------------
r241772r241773
12991301void sh2_device::generate_checksum_block(drcuml_block *block, compiler_state *compiler, const opcode_desc *seqhead, const opcode_desc *seqlast)
13001302{
13011303   const opcode_desc *curdesc;
1302   if (LOG_UML)
1304   if (m_drcuml->logging())
13031305      block->append_comment("[Validation for %08X]", seqhead->pc);                // comment
13041306
13051307   /* loose verify or single instruction: just compare and fail */
r241772r241773
13561358   offs_t expc;
13571359
13581360   /* add an entry for the log */
1359   if (LOG_UML && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
1361   if (m_drcuml->logging() && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
13601362      log_add_disasm_comment(block, desc->pc, desc->opptr.w[0]);
13611363
13621364   /* set the PC map variable */
trunk/src/emu/emuopts.c
r241772r241773
157157   { NULL,                                              NULL,        OPTION_HEADER,     "CORE MISC OPTIONS" },
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" },
160   { OPTION_DRC_LOG_UML,                                "0",         OPTION_BOOLEAN,    "write DRC UML disassembly log" },
160161   { OPTION_BIOS,                                       NULL,        OPTION_STRING,     "select the system BIOS to use" },
161162   { OPTION_CHEAT ";c",                                 "0",         OPTION_BOOLEAN,    "enable cheat subsystem" },
162163   { OPTION_SKIP_GAMEINFO,                              "0",         OPTION_BOOLEAN,    "skip displaying the information screen at startup" },
trunk/src/emu/emuopts.h
r241772r241773
160160// core misc options
161161#define OPTION_DRC                  "drc"
162162#define OPTION_DRC_USE_C            "drc_use_c"
163#define OPTION_DRC_LOG_UML          "drc_log_uml"
163164#define OPTION_BIOS                 "bios"
164165#define OPTION_CHEAT                "cheat"
165166#define OPTION_SKIP_GAMEINFO        "skip_gameinfo"
r241772r241773
320321   // core misc options
321322   bool drc() const { return bool_value(OPTION_DRC); }
322323   bool drc_use_c() const { return bool_value(OPTION_DRC_USE_C); }
324   bool drc_log_uml() const { return bool_value(OPTION_DRC_LOG_UML); }
323325   const char *bios() const { return value(OPTION_BIOS); }
324326   bool cheat() const { return bool_value(OPTION_CHEAT); }
325327   bool skip_gameinfo() const { return bool_value(OPTION_SKIP_GAMEINFO); }


Previous 199869 Revisions Next


© 1997-2024 The MAME Team