Replaced a couple of static_cast downcasts with dynamic_cast for safety, cleaned up some formatting.

This commit is contained in:
Vas Crabb 2022-04-16 07:47:02 +10:00
parent 7b8e04e00c
commit 6985fb1f90
6 changed files with 31 additions and 31 deletions

View File

@ -134,7 +134,7 @@ public:
// describe a block // describe a block
opcode_desc const *describe_code(offs_t startpc); opcode_desc const *describe_code(offs_t startpc);
// get last opcode of block // get last opcode of block
opcode_desc const* get_last() { return m_desc_live_list.last(); }; opcode_desc const *get_last() { return m_desc_live_list.last(); }
protected: protected:
// required overrides // required overrides

View File

@ -969,6 +969,7 @@ private:
/*************************************************************************** /***************************************************************************
COMPILER-SPECIFIC OPTIONS COMPILER-SPECIFIC OPTIONS
***************************************************************************/ ***************************************************************************/
#define MIPS3DRC_STRICT_VERIFY 0x0001 /* verify all instructions */ #define MIPS3DRC_STRICT_VERIFY 0x0001 /* verify all instructions */
#define MIPS3DRC_STRICT_COP0 0x0002 /* validate all COP0 instructions */ #define MIPS3DRC_STRICT_COP0 0x0002 /* validate all COP0 instructions */
#define MIPS3DRC_STRICT_COP1 0x0004 /* validate all COP1 instructions */ #define MIPS3DRC_STRICT_COP1 0x0004 /* validate all COP1 instructions */
@ -981,8 +982,4 @@ COMPILER-SPECIFIC OPTIONS
#define MIPS3DRC_COMPATIBLE_OPTIONS (MIPS3DRC_STRICT_VERIFY | MIPS3DRC_STRICT_COP1 | MIPS3DRC_STRICT_COP0 | MIPS3DRC_STRICT_COP2) #define MIPS3DRC_COMPATIBLE_OPTIONS (MIPS3DRC_STRICT_VERIFY | MIPS3DRC_STRICT_COP1 | MIPS3DRC_STRICT_COP0 | MIPS3DRC_STRICT_COP2)
#define MIPS3DRC_FASTEST_OPTIONS (0) #define MIPS3DRC_FASTEST_OPTIONS (0)
/* Use with STRICT_VERIFY to print debug info to console for extra validation checks */
/* Set to 1 to activate and use MIPS3DRC_STRICT_VERIFY in the drc options */
#define DEBUG_STRICT_VERIFY 0
#endif // MAME_CPU_MIPS_MIPS3_H #endif // MAME_CPU_MIPS_MIPS3_H

View File

@ -33,6 +33,11 @@
#include "cpu/drcumlsh.h" #include "cpu/drcumlsh.h"
/* Use with STRICT_VERIFY to print debug info to console for extra validation checks */
/* Set to 1 to activate and use MIPS3DRC_STRICT_VERIFY in the drc options */
#define DEBUG_STRICT_VERIFY 0
/*************************************************************************** /***************************************************************************
MACROS MACROS
***************************************************************************/ ***************************************************************************/
@ -1203,10 +1208,9 @@ void mips3_device::generate_checksum_block(drcuml_block &block, compiler_state &
if (DEBUG_STRICT_VERIFY) if (DEBUG_STRICT_VERIFY)
{ {
// This code will do additional checks on the last instruction and last delay slot and indicate if the check failed // This code will do additional checks on the last instruction and last delay slot and indicate if the check failed
uml::code_label check_passed, check_failed, check_second; uml::code_label check_second = compiler.labelnum++;
check_second = compiler.labelnum++; uml::code_label check_failed = compiler.labelnum++;
check_failed = compiler.labelnum++; uml::code_label check_passed = compiler.labelnum++;
check_passed = compiler.labelnum++;
// Check the last instruction // Check the last instruction
if (!(codelast->flags & OPFLAG_VIRTUAL_NOOP) && codelast->physpc != seqhead->physpc) if (!(codelast->flags & OPFLAG_VIRTUAL_NOOP) && codelast->physpc != seqhead->physpc)
{ {
@ -1263,21 +1267,19 @@ void mips3_device::generate_checksum_block(drcuml_block &block, compiler_state &
void mips3_device::generate_sequence_instruction(drcuml_block &block, compiler_state &compiler, const opcode_desc *desc) void mips3_device::generate_sequence_instruction(drcuml_block &block, compiler_state &compiler, const opcode_desc *desc)
{ {
offs_t expc;
int hotnum;
/* add an entry for the log */ /* add an entry for the log */
if (m_drcuml->logging() && !(desc->flags & OPFLAG_VIRTUAL_NOOP)) if (m_drcuml->logging() && !(desc->flags & OPFLAG_VIRTUAL_NOOP))
log_add_disasm_comment(block, desc->pc, desc->opptr.l[0]); log_add_disasm_comment(block, desc->pc, desc->opptr.l[0]);
/* set the PC map variable */ /* set the PC map variable */
expc = (desc->flags & OPFLAG_IN_DELAY_SLOT) ? desc->pc - 3 : desc->pc; offs_t expc = (desc->flags & OPFLAG_IN_DELAY_SLOT) ? desc->pc - 3 : desc->pc;
UML_MAPVAR(block, MAPVAR_PC, expc); // mapvar PC,expc UML_MAPVAR(block, MAPVAR_PC, expc); // mapvar PC,expc
/* accumulate total cycles */ /* accumulate total cycles */
compiler.cycles += desc->cycles; compiler.cycles += desc->cycles;
/* is this a hotspot? */ /* is this a hotspot? */
for (hotnum = 0; hotnum < MIPS3_MAX_HOTSPOTS; hotnum++) for (int hotnum = 0; hotnum < MIPS3_MAX_HOTSPOTS; hotnum++)
if (m_hotspot[hotnum].pc != 0 && desc->pc == m_hotspot[hotnum].pc && desc->opptr.l[0] == m_hotspot[hotnum].opcode) if (m_hotspot[hotnum].pc != 0 && desc->pc == m_hotspot[hotnum].pc && desc->opptr.l[0] == m_hotspot[hotnum].opcode)
{ {
compiler.cycles += m_hotspot[hotnum].cycles; compiler.cycles += m_hotspot[hotnum].cycles;

View File

@ -185,20 +185,21 @@
**************************************************************************/ **************************************************************************/
#include "emu.h" #include "emu.h"
#include "audio/cage.h" #include "audio/cage.h"
#include "audio/dcs.h" #include "audio/dcs.h"
#include "machine/midwayic.h"
#include "bus/ata/idehd.h"
#include "cpu/adsp2100/adsp2100.h" #include "cpu/adsp2100/adsp2100.h"
#include "cpu/mips/mips3.h" #include "cpu/mips/mips3.h"
#include "machine/midwayic.h"
#include "machine/nvram.h"
#include "machine/smc91c9x.h"
#include "machine/pci.h"
#include "machine/gt64xxx.h" #include "machine/gt64xxx.h"
#include "machine/nvram.h"
#include "machine/pci-ide.h" #include "machine/pci-ide.h"
#include "bus/ata/idehd.h" #include "machine/pci.h"
#include "machine/smc91c9x.h"
#include "video/voodoo_pci.h" #include "video/voodoo_pci.h"
#include "screen.h" #include "screen.h"
#include "calspeed.lh" #include "calspeed.lh"
@ -2051,7 +2052,7 @@ void seattle_state::seattle_common(machine_config &config)
void seattle_state::hdd_config(device_t *device) void seattle_state::hdd_config(device_t *device)
{ {
// Set the disk dma transfer speed // Set the disk dma transfer speed
static_cast<ide_hdd_device*>(device)->set_dma_transfer_time(attotime::from_usec(15)); dynamic_cast<ide_hdd_device *>(device)->set_dma_transfer_time(attotime::from_usec(15));
} }
void seattle_state::phoenix(machine_config &config) void seattle_state::phoenix(machine_config &config)

View File

@ -274,6 +274,7 @@
#include "emu.h" #include "emu.h"
#include "audio/dcs.h" #include "audio/dcs.h"
#include "machine/midwayic.h"
#include "bus/ata/idehd.h" #include "bus/ata/idehd.h"
#include "bus/rs232/rs232.h" #include "bus/rs232/rs232.h"
@ -282,7 +283,6 @@
#include "machine/idectrl.h" #include "machine/idectrl.h"
#include "machine/input_merger.h" #include "machine/input_merger.h"
#include "machine/ins8250.h" #include "machine/ins8250.h"
#include "machine/midwayic.h"
#include "machine/pci-ide.h" #include "machine/pci-ide.h"
#include "machine/pci.h" #include "machine/pci.h"
#include "machine/smc91c9x.h" #include "machine/smc91c9x.h"
@ -1953,9 +1953,9 @@ void vegas_state::vegascore(machine_config &config)
void vegas_state::hdd_config(device_t *device) void vegas_state::hdd_config(device_t *device)
{ {
// Set the disk dma transfer speed // Set the disk dma transfer speed
static_cast<ide_hdd_device*>(device)->set_dma_transfer_time(attotime::from_usec(15)); dynamic_cast<ide_hdd_device *>(device)->set_dma_transfer_time(attotime::from_usec(15));
// Allow ultra dma // Allow ultra dma
//uint16_t *identify_device = static_cast<ide_hdd_device*>(device)->identify_device_buffer(); //uint16_t *identify_device = dynamic_cast<ide_hdd_device *>(device)->identify_device_buffer();
//identify_device[88] = 0x7f; //identify_device[88] = 0x7f;
} }