dimemory: Remove the magic bypass [O. Galibert]

This commit is contained in:
Olivier Galibert 2016-12-10 13:11:40 +01:00
parent 898090ffe9
commit 998e196d55
3 changed files with 0 additions and 97 deletions

View File

@ -369,16 +369,11 @@ u8 debugger_cpu::read_byte(address_space &space, offs_t address, bool apply_tran
space.set_debugger_access(true);
/* translate if necessary; if not mapped, return 0xff */
u64 custom;
u8 result;
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
{
result = 0xff;
}
else if (memory.read(space.spacenum(), address, 1, custom))
{ /* if there is a custom read handler, and it returns true, use that value */
result = custom;
}
else
{ /* otherwise, call the byte reading function for the translated address */
result = space.read_byte(address);
@ -422,15 +417,10 @@ u16 debugger_cpu::read_word(address_space &space, offs_t address, bool apply_tra
space.set_debugger_access(true);
/* translate if necessary; if not mapped, return 0xffff */
u64 custom;
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
{
result = 0xffff;
}
else if (memory.read(space.spacenum(), address, 2, custom))
{ /* if there is a custom read handler, and it returns true, use that value */
result = custom;
}
else
{ /* otherwise, call the byte reading function for the translated address */
result = space.read_word(address);
@ -475,15 +465,10 @@ u32 debugger_cpu::read_dword(address_space &space, offs_t address, bool apply_tr
m_debugger_access = true;
space.set_debugger_access(true);
u64 custom;
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
{ /* translate if necessary; if not mapped, return 0xffffffff */
result = 0xffffffff;
}
else if (memory.read(space.spacenum(), address, 4, custom))
{ /* if there is a custom read handler, and it returns true, use that value */
result = custom;
}
else
{ /* otherwise, call the byte reading function for the translated address */
result = space.read_dword(address);
@ -529,15 +514,10 @@ u64 debugger_cpu::read_qword(address_space &space, offs_t address, bool apply_tr
space.set_debugger_access(true);
/* translate if necessary; if not mapped, return 0xffffffffffffffff */
u64 custom;
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_READ_DEBUG, address))
{
result = ~u64(0);
}
else if (memory.read(space.spacenum(), address, 8, custom))
{ /* if there is a custom read handler, and it returns true, use that value */
result = custom;
}
else
{ /* otherwise, call the byte reading function for the translated address */
result = space.read_qword(address);
@ -591,10 +571,6 @@ void debugger_cpu::write_byte(address_space &space, offs_t address, u8 data, boo
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address))
;
/* if there is a custom write handler, and it returns true, use that */
else if (memory.write(space.spacenum(), address, 1, data))
;
/* otherwise, call the byte reading function for the translated address */
else
space.write_byte(address, data);
@ -645,10 +621,6 @@ void debugger_cpu::write_word(address_space &space, offs_t address, u16 data, bo
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address))
;
/* if there is a custom write handler, and it returns true, use that */
else if (memory.write(space.spacenum(), address, 2, data))
;
/* otherwise, call the byte reading function for the translated address */
else
space.write_word(address, data);
@ -699,10 +671,6 @@ void debugger_cpu::write_dword(address_space &space, offs_t address, u32 data, b
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address))
;
/* if there is a custom write handler, and it returns true, use that */
else if (memory.write(space.spacenum(), address, 4, data))
;
/* otherwise, call the byte reading function for the translated address */
else
space.write_dword(address, data);
@ -754,10 +722,6 @@ void debugger_cpu::write_qword(address_space &space, offs_t address, u64 data, b
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address))
;
/* if there is a custom write handler, and it returns true, use that */
else if (memory.write(space.spacenum(), address, 8, data))
;
/* otherwise, call the byte reading function for the translated address */
else
space.write_qword(address, data);
@ -802,15 +766,8 @@ u64 debugger_cpu::read_opcode(address_space &space, offs_t address, int size)
/* keep in logical range */
address &= space.logbytemask();
/* return early if we got the result directly */
m_debugger_access = true;
space.set_debugger_access(true);
if (memory.readop(address, size, result2))
{
m_debugger_access = false;
space.set_debugger_access(false);
return result2;
}
/* if we're bigger than the address bus, break into smaller pieces */
if (size > space.data_width() / 8)

View File

@ -181,52 +181,6 @@ bool device_memory_interface::memory_translate(address_spacenum spacenum, int in
}
//-------------------------------------------------
// memory_read - perform internal memory
// operations that bypass the memory system;
// designed to be overridden by the actual device
// implementation if internal read operations are
// handled by bypassing the memory system
//-------------------------------------------------
bool device_memory_interface::memory_read(address_spacenum spacenum, offs_t offset, int size, u64 &value)
{
// by default, we don't do anything
return false;
}
//-------------------------------------------------
// memory_write - perform internal memory
// operations that bypass the memory system;
// designed to be overridden by the actual device
// implementation if internal write operations are
// handled by bypassing the memory system
//-------------------------------------------------
bool device_memory_interface::memory_write(address_spacenum spacenum, offs_t offset, int size, u64 value)
{
// by default, we don't do anything
return false;
}
//-------------------------------------------------
// memory_readop - perform internal memory
// operations that bypass the memory system;
// designed to be overridden by the actual device
// implementation if internal opcode fetching
// operations are handled by bypassing the memory
// system
//-------------------------------------------------
bool device_memory_interface::memory_readop(offs_t offset, int size, u64 &value)
{
// by default, we don't do anything
return false;
}
//-------------------------------------------------
// interface_validity_check - perform validity
// checks on the memory configuration

View File

@ -99,11 +99,6 @@ public:
// address translation
bool translate(address_spacenum spacenum, int intention, offs_t &address) { return memory_translate(spacenum, intention, address); }
// read/write access
bool read(address_spacenum spacenum, offs_t offset, int size, u64 &value) { return memory_read(spacenum, offset, size, value); }
bool write(address_spacenum spacenum, offs_t offset, int size, u64 value) { return memory_write(spacenum, offset, size, value); }
bool readop(offs_t offset, int size, u64 &value) { return memory_readop(offset, size, value); }
// deliberately ambiguous functions; if you have the memory interface
// just use it
device_memory_interface &memory() { return *this; }
@ -114,9 +109,6 @@ protected:
// optional operation overrides
virtual bool memory_translate(address_spacenum spacenum, int intention, offs_t &address);
virtual bool memory_read(address_spacenum spacenum, offs_t offset, int size, u64 &value);
virtual bool memory_write(address_spacenum spacenum, offs_t offset, int size, u64 value);
virtual bool memory_readop(offs_t offset, int size, u64 &value);
// interface-level overrides
virtual void interface_validity_check(validity_checker &valid) const override;