mirror of
https://github.com/holub/mame
synced 2025-04-21 07:52:35 +03:00
Apply logical address mask properly in debug disassembly view
Associated core changes (nw) - Move definition of address_space_config from dimemory.cpp to emumem.cpp (declaration was already in emumem.h) - Add getters for more members of address_space_config with future privatization in mind (nw)
This commit is contained in:
parent
9c3661b004
commit
ac355d1559
@ -125,7 +125,7 @@ void dio16_device::device_start()
|
||||
m_out_irq6_cb.resolve_safe();
|
||||
|
||||
m_prgspace = &m_maincpu->space(AS_PROGRAM);
|
||||
m_prgwidth = m_maincpu->space_config(AS_PROGRAM)->m_data_width;
|
||||
m_prgwidth = m_maincpu->space_config(AS_PROGRAM)->data_width();
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -230,9 +230,9 @@ void isa8_device::device_start()
|
||||
else // use host CPU's program and I/O spaces directly
|
||||
{
|
||||
m_iospace = &m_maincpu->space(AS_IO);
|
||||
m_iowidth = m_maincpu->space_config(AS_IO)->m_data_width;
|
||||
m_iowidth = m_maincpu->space_config(AS_IO)->data_width();
|
||||
m_memspace = &m_maincpu->space(AS_PROGRAM);
|
||||
m_memwidth = m_maincpu->space_config(AS_PROGRAM)->m_data_width;
|
||||
m_memwidth = m_maincpu->space_config(AS_PROGRAM)->data_width();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ void nubus_device::add_nubus_card(device_nubus_card_interface *card)
|
||||
void nubus_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler, uint32_t mask)
|
||||
{
|
||||
m_maincpu = machine().device<cpu_device>(m_cputag);
|
||||
int buswidth = m_maincpu->space_config(AS_PROGRAM)->m_data_width;
|
||||
int buswidth = m_maincpu->space_config(AS_PROGRAM)->data_width();
|
||||
switch(buswidth)
|
||||
{
|
||||
case 32:
|
||||
@ -129,7 +129,7 @@ void nubus_device::install_device(offs_t start, offs_t end, read8_delegate rhand
|
||||
void nubus_device::install_device(offs_t start, offs_t end, read16_delegate rhandler, write16_delegate whandler, uint32_t mask)
|
||||
{
|
||||
m_maincpu = machine().device<cpu_device>(m_cputag);
|
||||
int buswidth = m_maincpu->space_config(AS_PROGRAM)->m_data_width;
|
||||
int buswidth = m_maincpu->space_config(AS_PROGRAM)->data_width();
|
||||
switch(buswidth)
|
||||
{
|
||||
case 32:
|
||||
@ -146,7 +146,7 @@ void nubus_device::install_device(offs_t start, offs_t end, read16_delegate rhan
|
||||
void nubus_device::install_device(offs_t start, offs_t end, read32_delegate rhandler, write32_delegate whandler, uint32_t mask)
|
||||
{
|
||||
m_maincpu = machine().device<cpu_device>(m_cputag);
|
||||
int buswidth = m_maincpu->space_config(AS_PROGRAM)->m_data_width;
|
||||
int buswidth = m_maincpu->space_config(AS_PROGRAM)->data_width();
|
||||
switch(buswidth)
|
||||
{
|
||||
case 32:
|
||||
@ -163,7 +163,7 @@ void nubus_device::install_device(offs_t start, offs_t end, read32_delegate rhan
|
||||
void nubus_device::install_readonly_device(offs_t start, offs_t end, read32_delegate rhandler, uint32_t mask)
|
||||
{
|
||||
m_maincpu = machine().device<cpu_device>(m_cputag);
|
||||
int buswidth = m_maincpu->space_config(AS_PROGRAM)->m_data_width;
|
||||
int buswidth = m_maincpu->space_config(AS_PROGRAM)->data_width();
|
||||
switch(buswidth)
|
||||
{
|
||||
case 32:
|
||||
@ -180,7 +180,7 @@ void nubus_device::install_readonly_device(offs_t start, offs_t end, read32_dele
|
||||
void nubus_device::install_writeonly_device(offs_t start, offs_t end, write32_delegate whandler, uint32_t mask)
|
||||
{
|
||||
m_maincpu = machine().device<cpu_device>(m_cputag);
|
||||
int buswidth = m_maincpu->space_config(AS_PROGRAM)->m_data_width;
|
||||
int buswidth = m_maincpu->space_config(AS_PROGRAM)->data_width();
|
||||
switch(buswidth)
|
||||
{
|
||||
case 32:
|
||||
|
@ -259,7 +259,7 @@ void vme_device::device_start()
|
||||
LOG(" - using owner memory spaces for %s\n", m_cputag);
|
||||
m_maincpu = owner()->subdevice<cpu_device>(m_cputag);
|
||||
m_prgspace = &m_maincpu->space(AS_PROGRAM);
|
||||
m_prgwidth = m_maincpu->space_config(AS_PROGRAM)->m_data_width;
|
||||
m_prgwidth = m_maincpu->space_config(AS_PROGRAM)->data_width();
|
||||
LOG(" - Done at %d width\n", m_prgwidth);
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ drc_frontend::drc_frontend(device_t &cpu, u32 window_start, u32 window_end, u32
|
||||
, m_max_sequence(max_sequence)
|
||||
, m_cpudevice(downcast<cpu_device &>(cpu))
|
||||
, m_program(m_cpudevice.space(AS_PROGRAM))
|
||||
, m_pageshift(m_cpudevice.space_config(AS_PROGRAM)->m_page_shift)
|
||||
, m_pageshift(m_cpudevice.space_config(AS_PROGRAM)->page_shift())
|
||||
, m_desc_array(window_end + window_start + 2, nullptr)
|
||||
{
|
||||
}
|
||||
|
@ -52,14 +52,11 @@ i386_device::i386_device(const machine_config &mconfig, const char *tag, device_
|
||||
i386_device::i386_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int program_data_width, int program_addr_width, int io_data_width)
|
||||
: cpu_device(mconfig, type, tag, owner, clock)
|
||||
, device_vtlb_interface(mconfig, *this, AS_PROGRAM)
|
||||
, m_program_config("program", ENDIANNESS_LITTLE, program_data_width, program_addr_width, 0)
|
||||
, m_program_config("program", ENDIANNESS_LITTLE, program_data_width, program_addr_width, 0, 32, 12)
|
||||
, m_io_config("io", ENDIANNESS_LITTLE, io_data_width, 16, 0)
|
||||
, m_smiact(*this)
|
||||
, m_ferr_handler(*this)
|
||||
{
|
||||
m_program_config.m_logaddr_width = 32;
|
||||
m_program_config.m_page_shift = 12;
|
||||
|
||||
// 32 unified
|
||||
set_vtlb_dynamic_entries(32);
|
||||
}
|
||||
|
@ -1193,20 +1193,22 @@ debug_disasm_buffer::debug_disasm_buffer(device_t &device) :
|
||||
m_buf_params(dynamic_cast<device_disasm_interface &>(device).get_disassembler()),
|
||||
m_flags(m_dintf.interface_flags())
|
||||
{
|
||||
address_space &pspace = m_mintf->space(AS_PROGRAM);
|
||||
|
||||
if(m_flags & util::disasm_interface::INTERNAL_DECRYPTION) {
|
||||
m_buf_raw.set_source(m_mintf->space(AS_PROGRAM));
|
||||
m_buf_raw.set_source(pspace);
|
||||
m_buf_opcodes.set_source(m_buf_raw, true);
|
||||
if((m_flags & util::disasm_interface::SPLIT_DECRYPTION) == util::disasm_interface::SPLIT_DECRYPTION)
|
||||
m_buf_params.set_source(m_buf_raw, false);
|
||||
} else {
|
||||
if(m_mintf->has_space(AS_OPCODES)) {
|
||||
m_buf_opcodes.set_source(m_mintf->space(AS_OPCODES));
|
||||
m_buf_params.set_source(m_mintf->space(AS_PROGRAM));
|
||||
m_buf_params.set_source(pspace);
|
||||
} else
|
||||
m_buf_opcodes.set_source(m_mintf->space(AS_PROGRAM));
|
||||
m_buf_opcodes.set_source(pspace);
|
||||
}
|
||||
|
||||
m_pc_mask = m_mintf->space(AS_PROGRAM).logaddrmask();
|
||||
m_pc_mask = pspace.logaddrmask();
|
||||
|
||||
if(m_flags & util::disasm_interface::PAGED)
|
||||
m_page_mask = (1 << m_dintf.page_address_bits()) - 1;
|
||||
@ -1253,8 +1255,8 @@ debug_disasm_buffer::debug_disasm_buffer(device_t &device) :
|
||||
}
|
||||
|
||||
// pc to string conversion
|
||||
int aw = m_mintf->space(AS_PROGRAM).addr_width();
|
||||
bool is_octal = m_mintf->space(AS_PROGRAM).is_octal();
|
||||
int aw = pspace.logaddr_width();
|
||||
bool is_octal = pspace.is_octal();
|
||||
if((m_flags & util::disasm_interface::PAGED2LEVEL) == util::disasm_interface::PAGED2LEVEL) {
|
||||
int bits1 = m_dintf.page_address_bits();
|
||||
int bits2 = m_dintf.page2_address_bits();
|
||||
|
@ -19,66 +19,6 @@
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// ADDRESS SPACE CONFIG
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// address_space_config - constructors
|
||||
//-------------------------------------------------
|
||||
|
||||
address_space_config::address_space_config()
|
||||
: m_name("unknown"),
|
||||
m_endianness(ENDIANNESS_NATIVE),
|
||||
m_data_width(0),
|
||||
m_addr_width(0),
|
||||
m_addr_shift(0),
|
||||
m_logaddr_width(0),
|
||||
m_page_shift(0),
|
||||
m_is_octal(false),
|
||||
m_internal_map(address_map_constructor()),
|
||||
m_default_map(address_map_constructor())
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
@param name
|
||||
@param endian CPU endianness
|
||||
@param datawidth CPU parallelism bits
|
||||
@param addrwidth address bits
|
||||
@param addrshift
|
||||
@param internal
|
||||
@param defmap
|
||||
*/
|
||||
address_space_config::address_space_config(const char *name, endianness_t endian, u8 datawidth, u8 addrwidth, s8 addrshift, address_map_constructor internal, address_map_constructor defmap)
|
||||
: m_name(name),
|
||||
m_endianness(endian),
|
||||
m_data_width(datawidth),
|
||||
m_addr_width(addrwidth),
|
||||
m_addr_shift(addrshift),
|
||||
m_logaddr_width(addrwidth),
|
||||
m_page_shift(0),
|
||||
m_is_octal(false),
|
||||
m_internal_map(internal),
|
||||
m_default_map(defmap)
|
||||
{
|
||||
}
|
||||
|
||||
address_space_config::address_space_config(const char *name, endianness_t endian, u8 datawidth, u8 addrwidth, s8 addrshift, u8 logwidth, u8 pageshift, address_map_constructor internal, address_map_constructor defmap)
|
||||
: m_name(name),
|
||||
m_endianness(endian),
|
||||
m_data_width(datawidth),
|
||||
m_addr_width(addrwidth),
|
||||
m_addr_shift(addrshift),
|
||||
m_logaddr_width(logwidth),
|
||||
m_page_shift(pageshift),
|
||||
m_is_octal(false),
|
||||
m_internal_map(internal),
|
||||
m_default_map(defmap)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// MEMORY DEVICE MANAGEMENT
|
||||
//**************************************************************************
|
||||
|
@ -68,8 +68,8 @@ void device_vtlb_interface::interface_validity_check(validity_checker &valid) co
|
||||
const address_space_config *spaceconfig = intf->space_config(m_space);
|
||||
if (spaceconfig == nullptr)
|
||||
osd_printf_error("No memory address space configuration found for space %d\n", m_space);
|
||||
else if ((1 << spaceconfig->m_page_shift) <= VTLB_FLAGS_MASK || spaceconfig->m_logaddr_width <= spaceconfig->m_page_shift)
|
||||
osd_printf_error("Invalid page shift %d for VTLB\n", spaceconfig->m_page_shift);
|
||||
else if ((1 << spaceconfig->page_shift()) <= VTLB_FLAGS_MASK || spaceconfig->logaddr_width() <= spaceconfig->page_shift())
|
||||
osd_printf_error("Invalid page shift %d for VTLB\n", spaceconfig->page_shift());
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,8 +83,8 @@ void device_vtlb_interface::interface_pre_start()
|
||||
{
|
||||
// fill in CPU information
|
||||
const address_space_config *spaceconfig = device().memory().space_config(m_space);
|
||||
m_pageshift = spaceconfig->m_page_shift;
|
||||
m_addrwidth = spaceconfig->m_logaddr_width;
|
||||
m_pageshift = spaceconfig->page_shift();
|
||||
m_addrwidth = spaceconfig->logaddr_width();
|
||||
|
||||
// allocate the entry array
|
||||
m_live.resize(m_fixed + m_dynamic);
|
||||
|
@ -944,6 +944,66 @@ memory_bank *memory_manager::allocate(address_space &space, offs_t addrstart, of
|
||||
return m_banklist.find(tag)->second.get();
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// ADDRESS SPACE CONFIG
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// address_space_config - constructors
|
||||
//-------------------------------------------------
|
||||
|
||||
address_space_config::address_space_config()
|
||||
: m_name("unknown"),
|
||||
m_endianness(ENDIANNESS_NATIVE),
|
||||
m_data_width(0),
|
||||
m_addr_width(0),
|
||||
m_addr_shift(0),
|
||||
m_logaddr_width(0),
|
||||
m_page_shift(0),
|
||||
m_is_octal(false),
|
||||
m_internal_map(address_map_constructor()),
|
||||
m_default_map(address_map_constructor())
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
@param name
|
||||
@param endian CPU endianness
|
||||
@param datawidth CPU parallelism bits
|
||||
@param addrwidth address bits
|
||||
@param addrshift
|
||||
@param internal
|
||||
@param defmap
|
||||
*/
|
||||
address_space_config::address_space_config(const char *name, endianness_t endian, u8 datawidth, u8 addrwidth, s8 addrshift, address_map_constructor internal, address_map_constructor defmap)
|
||||
: m_name(name),
|
||||
m_endianness(endian),
|
||||
m_data_width(datawidth),
|
||||
m_addr_width(addrwidth),
|
||||
m_addr_shift(addrshift),
|
||||
m_logaddr_width(addrwidth),
|
||||
m_page_shift(0),
|
||||
m_is_octal(false),
|
||||
m_internal_map(internal),
|
||||
m_default_map(defmap)
|
||||
{
|
||||
}
|
||||
|
||||
address_space_config::address_space_config(const char *name, endianness_t endian, u8 datawidth, u8 addrwidth, s8 addrshift, u8 logwidth, u8 pageshift, address_map_constructor internal, address_map_constructor defmap)
|
||||
: m_name(name),
|
||||
m_endianness(endian),
|
||||
m_data_width(datawidth),
|
||||
m_addr_width(addrwidth),
|
||||
m_addr_shift(addrshift),
|
||||
m_logaddr_width(logwidth),
|
||||
m_page_shift(pageshift),
|
||||
m_is_octal(false),
|
||||
m_internal_map(internal),
|
||||
m_default_map(defmap)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// ADDRESS SPACE
|
||||
//**************************************************************************
|
||||
@ -955,14 +1015,14 @@ memory_bank *memory_manager::allocate(address_space &space, offs_t addrstart, of
|
||||
address_space::address_space(memory_manager &manager, device_memory_interface &memory, int spacenum)
|
||||
: m_config(*memory.space_config(spacenum)),
|
||||
m_device(memory.device()),
|
||||
m_addrmask(make_bitmask<offs_t>(m_config.m_addr_width)),
|
||||
m_logaddrmask(make_bitmask<offs_t>(m_config.m_logaddr_width)),
|
||||
m_addrmask(make_bitmask<offs_t>(m_config.addr_width())),
|
||||
m_logaddrmask(make_bitmask<offs_t>(m_config.logaddr_width())),
|
||||
m_unmap(0),
|
||||
m_spacenum(spacenum),
|
||||
m_log_unmap(true),
|
||||
m_name(memory.space_config(spacenum)->name()),
|
||||
m_addrchars((m_config.m_addr_width + 3) / 4),
|
||||
m_logaddrchars((m_config.m_logaddr_width + 3) / 4),
|
||||
m_addrchars((m_config.addr_width() + 3) / 4),
|
||||
m_logaddrchars((m_config.logaddr_width() + 3) / 4),
|
||||
m_notifier_id(0),
|
||||
m_in_notification(0),
|
||||
m_manager(manager)
|
||||
@ -1010,8 +1070,8 @@ void address_space::check_optimize_all(const char *function, int width, offs_t a
|
||||
|
||||
// Check the validity of the addresses given their intrinsic width
|
||||
// We assume that busses with non-zero address shift have a data width matching the shift (reality says yes)
|
||||
offs_t default_lowbits_mask = (m_config.data_width() >> (3 - m_config.m_addr_shift)) - 1;
|
||||
offs_t lowbits_mask = width && !m_config.m_addr_shift ? (width >> 3) - 1 : default_lowbits_mask;
|
||||
offs_t default_lowbits_mask = (m_config.data_width() >> (3 - m_config.addr_shift())) - 1;
|
||||
offs_t lowbits_mask = width && !m_config.addr_shift() ? (width >> 3) - 1 : default_lowbits_mask;
|
||||
|
||||
if (addrstart & lowbits_mask)
|
||||
fatalerror("%s: In range %x-%x mask %x mirror %x select %x, start address has low bits set, did you mean %x ?\n", function, addrstart, addrend, addrmask, addrmirror, addrselect, addrstart & ~lowbits_mask);
|
||||
@ -1117,7 +1177,7 @@ void address_space::check_optimize_mirror(const char *function, offs_t addrstart
|
||||
if (addrend & ~m_addrmask)
|
||||
fatalerror("%s: In range %x-%x mirror %x, end address is outside of the global address mask %x, did you mean %x ?\n", function, addrstart, addrend, addrmirror, m_addrmask, addrend & m_addrmask);
|
||||
|
||||
offs_t lowbits_mask = (m_config.data_width() >> (3 - m_config.m_addr_shift)) - 1;
|
||||
offs_t lowbits_mask = (m_config.data_width() >> (3 - m_config.addr_shift())) - 1;
|
||||
if (addrstart & lowbits_mask)
|
||||
fatalerror("%s: In range %x-%x mirror %x, start address has low bits set, did you mean %x ?\n", function, addrstart, addrend, addrmirror, addrstart & ~lowbits_mask);
|
||||
if ((~addrend) & lowbits_mask)
|
||||
@ -1167,7 +1227,7 @@ void address_space::check_address(const char *function, offs_t addrstart, offs_t
|
||||
if (addrend & ~m_addrmask)
|
||||
fatalerror("%s: In range %x-%x, end address is outside of the global address mask %x, did you mean %x ?\n", function, addrstart, addrend, m_addrmask, addrend & m_addrmask);
|
||||
|
||||
offs_t lowbits_mask = (m_config.data_width() >> (3 - m_config.m_addr_shift)) - 1;
|
||||
offs_t lowbits_mask = (m_config.data_width() >> (3 - m_config.addr_shift())) - 1;
|
||||
if (addrstart & lowbits_mask)
|
||||
fatalerror("%s: In range %x-%x, start address has low bits set, did you mean %x ?\n", function, addrstart, addrend, addrstart & ~lowbits_mask);
|
||||
if ((~addrend) & lowbits_mask)
|
||||
|
@ -1134,6 +1134,8 @@ private:
|
||||
// describes an address space and provides basic functions to map addresses to bytes
|
||||
class address_space_config
|
||||
{
|
||||
friend class address_map;
|
||||
|
||||
public:
|
||||
// construction/destruction
|
||||
address_space_config();
|
||||
@ -1146,6 +1148,9 @@ public:
|
||||
int data_width() const { return m_data_width; }
|
||||
int addr_width() const { return m_addr_width; }
|
||||
int addr_shift() const { return m_addr_shift; }
|
||||
int logaddr_width() const { return m_logaddr_width; }
|
||||
int page_shift() const { return m_page_shift; }
|
||||
bool is_octal() const { return m_is_octal; }
|
||||
|
||||
// Actual alignment of the bus addresses
|
||||
int alignment() const { int bytes = m_data_width / 8; return m_addr_shift < 0 ? bytes >> -m_addr_shift : bytes << m_addr_shift; }
|
||||
@ -1158,7 +1163,7 @@ public:
|
||||
inline offs_t addr2byte_end(offs_t address) const { return (m_addr_shift < 0) ? ((address << -m_addr_shift) | ((1 << -m_addr_shift) - 1)) : (address >> m_addr_shift); }
|
||||
inline offs_t byte2addr_end(offs_t address) const { return (m_addr_shift > 0) ? ((address << m_addr_shift) | ((1 << m_addr_shift) - 1)) : (address >> -m_addr_shift); }
|
||||
|
||||
// state
|
||||
// state (TODO: privatize)
|
||||
const char * m_name;
|
||||
endianness_t m_endianness;
|
||||
u8 m_data_width;
|
||||
@ -1233,11 +1238,12 @@ public:
|
||||
|
||||
int data_width() const { return m_config.data_width(); }
|
||||
int addr_width() const { return m_config.addr_width(); }
|
||||
int logaddr_width() const { return m_config.logaddr_width(); }
|
||||
int alignment() const { return m_config.alignment(); }
|
||||
endianness_t endianness() const { return m_config.endianness(); }
|
||||
int addr_shift() const { return m_config.addr_shift(); }
|
||||
u64 unmap() const { return m_unmap; }
|
||||
bool is_octal() const { return m_config.m_is_octal; }
|
||||
bool is_octal() const { return m_config.is_octal(); }
|
||||
|
||||
offs_t addrmask() const { return m_addrmask; }
|
||||
u8 addrchars() const { return m_addrchars; }
|
||||
|
@ -1257,13 +1257,13 @@ void rom_load_manager::normalize_flags_for_device(const char *rgntag, u8 &width,
|
||||
int buswidth;
|
||||
|
||||
/* set the endianness */
|
||||
if (spaceconfig->m_endianness == ENDIANNESS_LITTLE)
|
||||
if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
|
||||
endian = ENDIANNESS_LITTLE;
|
||||
else
|
||||
endian = ENDIANNESS_BIG;
|
||||
|
||||
/* set the width */
|
||||
buswidth = spaceconfig->m_data_width;
|
||||
buswidth = spaceconfig->data_width();
|
||||
if (buswidth <= 8)
|
||||
width = 1;
|
||||
else if (buswidth <= 16)
|
||||
|
Loading…
Reference in New Issue
Block a user