diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2019-10-04 12:33:02 -0400 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2019-10-04 12:33:07 -0400 |
commit | 20677c7a1ba8e97fd87d681efa25bb90bd828667 (patch) | |
tree | a9f03ca5a06c36d74f87bd7eb55e18f907e7bac9 /src/emu | |
parent | 87da937b7f94464d2e7bd128bee024d39cfe901e (diff) |
Add rudimentary validity checking for address_space_config objects (nw)
Diffstat (limited to 'src/emu')
-rw-r--r-- | src/emu/dimemory.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/emu/dimemory.cpp b/src/emu/dimemory.cpp index fd8d4311a3a..30a3e395afa 100644 --- a/src/emu/dimemory.cpp +++ b/src/emu/dimemory.cpp @@ -97,8 +97,19 @@ void device_memory_interface::interface_validity_check(validity_checker &valid) const int max_spaces = std::max(m_address_map.size(), m_address_config.size()); for (int spacenum = 0; spacenum < max_spaces; ++spacenum) { - if (space_config(spacenum)) + const address_space_config *config = space_config(spacenum); + if (config != nullptr) { + // validate data width + int width = config->data_width(); + if (width != 8 && width != 16 && width != 32 && width != 64) + osd_printf_error("Invalid data width %d specified for address space %d\n", width, spacenum); + + // validate address shift + int shift = config->addr_shift(); + if (shift < 0 && (width >> -shift) < 8) + osd_printf_error("Invalid shift %d specified for address space %d\n", shift, spacenum); + // construct the map ::address_map addrmap(const_cast<device_t &>(device()), spacenum); |