mirror of
https://github.com/holub/mame
synced 2025-05-23 06:08:48 +03:00
debug: Simplify now obsolete and buggy memory access code [O. Galibert]
This commit is contained in:
parent
4c24f25845
commit
74301434ae
@ -482,39 +482,20 @@ void debugger_cpu::write_byte(address_space &space, offs_t address, u8 data, boo
|
||||
|
||||
void debugger_cpu::write_word(address_space &space, offs_t address, u16 data, bool apply_translation)
|
||||
{
|
||||
device_memory_interface &memory = space.device().memory();
|
||||
|
||||
/* mask against the logical byte mask */
|
||||
address &= space.logaddrmask();
|
||||
|
||||
/* if this is a misaligned write, or if there are no word writers, just read two bytes */
|
||||
if (!WORD_ALIGNED(address))
|
||||
{
|
||||
if (space.endianness() == ENDIANNESS_LITTLE)
|
||||
{
|
||||
write_byte(space, address + 0, data >> 0, apply_translation);
|
||||
write_byte(space, address + 1, data >> 8, apply_translation);
|
||||
}
|
||||
else
|
||||
{
|
||||
write_byte(space, address + 0, data >> 8, apply_translation);
|
||||
write_byte(space, address + 1, data >> 0, apply_translation);
|
||||
}
|
||||
}
|
||||
/* translate if necessary; if not mapped, we're done */
|
||||
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address))
|
||||
;
|
||||
|
||||
/* otherwise, this proceeds like the byte case */
|
||||
/* otherwise, call the byte reading function for the translated address */
|
||||
else
|
||||
{
|
||||
device_memory_interface &memory = space.device().memory();
|
||||
space.write_word_unaligned(address, data);
|
||||
|
||||
/* translate if necessary; if not mapped, we're done */
|
||||
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address))
|
||||
;
|
||||
|
||||
/* otherwise, call the byte reading function for the translated address */
|
||||
else
|
||||
space.write_word(address, data);
|
||||
|
||||
m_memory_modified = true;
|
||||
}
|
||||
m_memory_modified = true;
|
||||
}
|
||||
|
||||
|
||||
@ -525,39 +506,20 @@ void debugger_cpu::write_word(address_space &space, offs_t address, u16 data, bo
|
||||
|
||||
void debugger_cpu::write_dword(address_space &space, offs_t address, u32 data, bool apply_translation)
|
||||
{
|
||||
device_memory_interface &memory = space.device().memory();
|
||||
|
||||
/* mask against the logical byte mask */
|
||||
address &= space.logaddrmask();
|
||||
|
||||
/* if this is a misaligned write, or if there are no dword writers, just read two words */
|
||||
if (!DWORD_ALIGNED(address))
|
||||
{
|
||||
if (space.endianness() == ENDIANNESS_LITTLE)
|
||||
{
|
||||
write_word(space, address + 0, data >> 0, apply_translation);
|
||||
write_word(space, address + 2, data >> 16, apply_translation);
|
||||
}
|
||||
else
|
||||
{
|
||||
write_word(space, address + 0, data >> 16, apply_translation);
|
||||
write_word(space, address + 2, data >> 0, apply_translation);
|
||||
}
|
||||
}
|
||||
/* translate if necessary; if not mapped, we're done */
|
||||
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address))
|
||||
;
|
||||
|
||||
/* otherwise, this proceeds like the byte case */
|
||||
/* otherwise, call the byte reading function for the translated address */
|
||||
else
|
||||
{
|
||||
device_memory_interface &memory = space.device().memory();
|
||||
space.write_dword_unaligned(address, data);
|
||||
|
||||
/* translate if necessary; if not mapped, we're done */
|
||||
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address))
|
||||
;
|
||||
|
||||
/* otherwise, call the byte reading function for the translated address */
|
||||
else
|
||||
space.write_dword(address, data);
|
||||
|
||||
m_memory_modified = true;
|
||||
}
|
||||
m_memory_modified = true;
|
||||
}
|
||||
|
||||
|
||||
@ -568,39 +530,20 @@ void debugger_cpu::write_dword(address_space &space, offs_t address, u32 data, b
|
||||
|
||||
void debugger_cpu::write_qword(address_space &space, offs_t address, u64 data, bool apply_translation)
|
||||
{
|
||||
device_memory_interface &memory = space.device().memory();
|
||||
|
||||
/* mask against the logical byte mask */
|
||||
address &= space.logaddrmask();
|
||||
|
||||
/* if this is a misaligned write, or if there are no qword writers, just read two dwords */
|
||||
if (!QWORD_ALIGNED(address))
|
||||
{
|
||||
if (space.endianness() == ENDIANNESS_LITTLE)
|
||||
{
|
||||
write_dword(space, address + 0, data >> 0, apply_translation);
|
||||
write_dword(space, address + 4, data >> 32, apply_translation);
|
||||
}
|
||||
else
|
||||
{
|
||||
write_dword(space, address + 0, data >> 32, apply_translation);
|
||||
write_dword(space, address + 4, data >> 0, apply_translation);
|
||||
}
|
||||
}
|
||||
/* translate if necessary; if not mapped, we're done */
|
||||
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address))
|
||||
;
|
||||
|
||||
/* otherwise, this proceeds like the byte case */
|
||||
/* otherwise, call the byte reading function for the translated address */
|
||||
else
|
||||
{
|
||||
device_memory_interface &memory = space.device().memory();
|
||||
space.write_qword_unaligned(address, data);
|
||||
|
||||
/* translate if necessary; if not mapped, we're done */
|
||||
if (apply_translation && !memory.translate(space.spacenum(), TRANSLATE_WRITE_DEBUG, address))
|
||||
;
|
||||
|
||||
/* otherwise, call the byte reading function for the translated address */
|
||||
else
|
||||
space.write_qword(address, data);
|
||||
|
||||
m_memory_modified = true;
|
||||
}
|
||||
m_memory_modified = true;
|
||||
}
|
||||
|
||||
|
||||
@ -635,19 +578,6 @@ u64 debugger_cpu::read_opcode(address_space &space, offs_t address, int size)
|
||||
/* keep in logical range */
|
||||
address &= space.logaddrmask();
|
||||
|
||||
/* if we're bigger than the address bus, break into smaller pieces */
|
||||
if (size > space.data_width() / 8)
|
||||
{
|
||||
int halfsize = size / 2;
|
||||
u64 r0 = read_opcode(space, address + 0, halfsize);
|
||||
u64 r1 = read_opcode(space, address + halfsize, halfsize);
|
||||
|
||||
if (space.endianness() == ENDIANNESS_LITTLE)
|
||||
return r0 | (r1 << (8 * halfsize));
|
||||
else
|
||||
return r1 | (r0 << (8 * halfsize));
|
||||
}
|
||||
|
||||
/* translate to physical first */
|
||||
if (!memory.translate(space.spacenum(), TRANSLATE_FETCH_DEBUG, address))
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user