Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/devices/cpu/mips/mips3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#include "emuopts.h"

#include "debug/express.h"

#include <cmath>

#define ENABLE_OVERFLOWS (0)
Expand Down Expand Up @@ -180,6 +182,7 @@ mips3_device::mips3_device(const machine_config &mconfig, device_type type, cons
, m_drcfe(nullptr)
, m_drcoptions(0)
, m_drc_cache_dirty(0)
, m_drc_iregs_dirty(0)
, m_entry(nullptr)
, m_nocode(nullptr)
, m_out_of_cycles(nullptr)
Expand Down Expand Up @@ -239,6 +242,14 @@ void mips3_device::device_stop()
}
}

void mips3_device::device_debug_setup()
{
if (!m_isdrc) return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also should be Allman style.

debug()->symtable().set_memory_modified_func(
[this]() { m_drc_cache_dirty = true; }
);
Comment on lines +248 to +250
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't want to be doing this for every memory modification from the debugger - it's too expensive when most of the time, people will just be modifying data memory.

Copy link
Author

@nekuz0r nekuz0r Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The cache invalidation is triggered when editing the ':maincpu' program space, not through any other spaces/regions.
What is your suggestion ?

}

/***************************************************************************
EXECEPTION HANDLING
***************************************************************************/
Expand Down Expand Up @@ -826,7 +837,7 @@ void mips3_device::state_import(const device_state_entry &entry)
// this refers to HI as R32 and LO as R33 because I'm lazy
const unsigned regnum = entry.index() - MIPS3_R0;
if (m_regmap[regnum].is_int_register())
logerror("debugger R%u = %08X, must update UML I%u\n", regnum, m_core->r[regnum], m_regmap[regnum].ireg() - uml::REG_I0);
m_drc_iregs_dirty = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of this file uses Allman brace style, so this should too for consistency.

Copy link
Author

@nekuz0r nekuz0r Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's quite a few one line if/else statements in the file without braces, i kept it as it, should i update it and update the other occurrences or leave it ?

}
}

Expand Down
2 changes: 2 additions & 0 deletions src/devices/cpu/mips/mips3.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ class mips3_device : public cpu_device, public device_vtlb_interface {

protected:
// device_t implementation
virtual void device_debug_setup() override ATTR_COLD;
virtual void device_start() override ATTR_COLD;
virtual void device_reset() override ATTR_COLD;
virtual void device_stop() override ATTR_COLD;
Expand Down Expand Up @@ -486,6 +487,7 @@ class mips3_device : public cpu_device, public device_vtlb_interface {

/* internal stuff */
uint8_t m_drc_cache_dirty; /* true if we need to flush the cache */
uint32_t m_drc_iregs_dirty; /* true if debugger modified fast integer registers */

/* tables */
uint8_t m_fpmode[4]; /* FPU mode table */
Expand Down
9 changes: 8 additions & 1 deletion src/devices/cpu/mips/mips3drc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#define DEBUG_STRICT_VERIFY 0



/***************************************************************************
MACROS
***************************************************************************/
Expand Down Expand Up @@ -1366,9 +1367,15 @@ void mips3_device::generate_sequence_instruction(drcuml_block &block, compiler_s
/* if we are debugging, call the debugger */
if (debugger_enabled())
{
uml::code_label skip_reload = compiler.labelnum++;
UML_MOV(block, mem(&m_core->pc), desc->pc); // mov [pc],desc->pc
save_fast_iregs(block);
UML_DEBUG(block, desc->pc); // debug desc->pc
UML_DEBUG(block, desc->pc); // debug desc->pc
UML_TEST(block, mem(&m_drc_iregs_dirty), 1); // test [debugger_iregs_dirty],1
UML_JMPc(block, COND_Z, skip_reload); // jmp skip_reload,Z
UML_MOV(block, mem(&m_drc_iregs_dirty), 0); // mov [debugger_iregs_dirty],0
load_fast_iregs(block); // <load fast integer registers>
UML_LABEL(block, skip_reload); // skip_reload:
Comment on lines -1371 to +1378
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering how frequently this is going to occur, would it be better to turn it into a helper function to keep generated code size down?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure to understand what's expected to be done, any guidance ?

}

/* if we hit an unmapped address, fatal error */
Expand Down