mirror of
https://github.com/holub/mame
synced 2025-05-29 00:53:09 +03:00
Fix some range computation issues with some weird views.
This commit is contained in:
parent
f101d1f27f
commit
4faede1905
@ -17,7 +17,7 @@ public:
|
||||
using mapping = typename handler_entry_read<Width, AddrShift>::mapping;
|
||||
|
||||
handler_entry_read_dispatch(address_space *space, const handler_entry::range &init, handler_entry_read<Width, AddrShift> *handler);
|
||||
handler_entry_read_dispatch(address_space *space, memory_view &view);
|
||||
handler_entry_read_dispatch(address_space *space, memory_view &view, offs_t addrstart, offs_t addrend);
|
||||
handler_entry_read_dispatch(handler_entry_read_dispatch<HighBits, Width, AddrShift> *src);
|
||||
~handler_entry_read_dispatch();
|
||||
|
||||
@ -92,6 +92,8 @@ private:
|
||||
handler_entry_read<Width, AddrShift> **m_u_dispatch;
|
||||
handler_entry::range *m_u_ranges;
|
||||
|
||||
handler_entry::range m_global_range;
|
||||
|
||||
void populate_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read<Width, AddrShift> *handler);
|
||||
void populate_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read<Width, AddrShift> *handler);
|
||||
|
||||
|
@ -25,6 +25,7 @@ template<int HighBits, int Width, int AddrShift> handler_entry_read_dispatch<Hig
|
||||
m_a_dispatch = m_dispatch_array[0].data();
|
||||
m_u_ranges = m_ranges_array[0].data();
|
||||
m_u_dispatch = m_dispatch_array[0].data();
|
||||
m_global_range = init;
|
||||
|
||||
if (!handler)
|
||||
handler = space->get_unmap_r<Width, AddrShift>();
|
||||
@ -35,7 +36,7 @@ template<int HighBits, int Width, int AddrShift> handler_entry_read_dispatch<Hig
|
||||
}
|
||||
}
|
||||
|
||||
template<int HighBits, int Width, int AddrShift> handler_entry_read_dispatch<HighBits, Width, AddrShift>::handler_entry_read_dispatch(address_space *space, memory_view &view) : handler_entry_read<Width, AddrShift>(space, handler_entry::F_VIEW), m_view(&view), m_a_dispatch(nullptr), m_a_ranges(nullptr), m_u_dispatch(nullptr), m_u_ranges(nullptr)
|
||||
template<int HighBits, int Width, int AddrShift> handler_entry_read_dispatch<HighBits, Width, AddrShift>::handler_entry_read_dispatch(address_space *space, memory_view &view, offs_t addrstart, offs_t addrend) : handler_entry_read<Width, AddrShift>(space, handler_entry::F_VIEW), m_view(&view), m_a_dispatch(nullptr), m_a_ranges(nullptr), m_u_dispatch(nullptr), m_u_ranges(nullptr)
|
||||
{
|
||||
m_ranges_array.resize(1);
|
||||
m_dispatch_array.resize(1);
|
||||
@ -43,12 +44,15 @@ template<int HighBits, int Width, int AddrShift> handler_entry_read_dispatch<Hig
|
||||
m_a_dispatch = m_dispatch_array[0].data();
|
||||
m_u_ranges = m_ranges_array[0].data();
|
||||
m_u_dispatch = m_dispatch_array[0].data();
|
||||
m_global_range.start = addrstart;
|
||||
m_global_range.end = addrend;
|
||||
|
||||
auto handler = space->get_unmap_r<Width, AddrShift>();
|
||||
handler->ref(COUNT);
|
||||
for(unsigned int i=0; i != COUNT; i++) {
|
||||
m_u_dispatch[i] = handler;
|
||||
m_u_ranges[i].set(0, 0);
|
||||
m_u_ranges[i].start = addrstart;
|
||||
m_u_ranges[i].end = addrend;
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,6 +64,7 @@ template<int HighBits, int Width, int AddrShift> handler_entry_read_dispatch<Hig
|
||||
m_a_dispatch = m_dispatch_array[0].data();
|
||||
m_u_ranges = m_ranges_array[0].data();
|
||||
m_u_dispatch = m_dispatch_array[0].data();
|
||||
m_global_range = src->m_global_range;
|
||||
|
||||
for(unsigned int i=0; i != COUNT; i++) {
|
||||
m_u_dispatch[i] = src->m_u_dispatch[i]->dup();
|
||||
@ -92,10 +97,12 @@ template<int HighBits, int Width, int AddrShift> offs_t handler_entry_read_dispa
|
||||
template<int HighBits, int Width, int AddrShift> void handler_entry_read_dispatch<HighBits, Width, AddrShift>::dump_map(std::vector<memory_entry> &map) const
|
||||
{
|
||||
if(m_view) {
|
||||
offs_t base_cur = map.empty() ? m_view->m_addrstart & HIGHMASK : map.back().end + 1;
|
||||
for(u32 i = 0; i != m_dispatch_array.size(); i++) {
|
||||
u32 j = map.size();
|
||||
offs_t cur = map.empty() ? m_view->m_addrstart & HIGHMASK : map.back().end + 1;
|
||||
offs_t end = m_view->m_addrend + 1;
|
||||
offs_t cur = base_cur;
|
||||
offs_t end = m_global_range.end + 1;
|
||||
|
||||
do {
|
||||
offs_t entry = (cur >> LowBits) & BITMASK;
|
||||
if(m_dispatch_array[i][entry]->is_dispatch() || m_dispatch_array[i][entry]->is_view())
|
||||
@ -116,6 +123,7 @@ template<int HighBits, int Width, int AddrShift> void handler_entry_read_dispatc
|
||||
} else {
|
||||
offs_t cur = map.empty() ? 0 : map.back().end + 1;
|
||||
offs_t base = cur & UPMASK;
|
||||
offs_t end = m_global_range.end + 1;
|
||||
do {
|
||||
offs_t entry = (cur >> LowBits) & BITMASK;
|
||||
if(m_a_dispatch[entry]->is_dispatch() || m_a_dispatch[entry]->is_view())
|
||||
@ -123,7 +131,7 @@ template<int HighBits, int Width, int AddrShift> void handler_entry_read_dispatc
|
||||
else
|
||||
map.emplace_back(memory_entry{ m_a_ranges[entry].start, m_a_ranges[entry].end, m_a_dispatch[entry] });
|
||||
cur = map.back().end + 1;
|
||||
} while(cur && !((cur ^ base) & UPMASK));
|
||||
} while(cur != end && !((cur ^ base) & UPMASK));
|
||||
}
|
||||
}
|
||||
|
||||
@ -343,7 +351,7 @@ template<int HighBits, int Width, int AddrShift> void handler_entry_read_dispatc
|
||||
template<int HighBits, int Width, int AddrShift> void handler_entry_read_dispatch<HighBits, Width, AddrShift>::populate_mismatched_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift> &descriptor, u8 rkey, std::vector<mapping> &mappings)
|
||||
{
|
||||
auto cur = m_u_dispatch[entry];
|
||||
if(cur->is_dispatch())
|
||||
if(cur->is_dispatch() && !cur->is_view())
|
||||
cur->populate_mismatched_nomirror(start, end, ostart, oend, descriptor, rkey, mappings);
|
||||
else {
|
||||
auto subdispatch = new handler_entry_read_dispatch<LowBits, Width, AddrShift>(this->m_space, m_u_ranges[entry], cur);
|
||||
@ -654,9 +662,7 @@ template<int HighBits, int Width, int AddrShift> void handler_entry_read_dispatc
|
||||
u32 dt = lowbits - LowBits;
|
||||
u32 ne = 1 << dt;
|
||||
u32 ee = end_entry - start_entry;
|
||||
if(m_view) {
|
||||
auto filter = [s = m_view->m_addrstart, e = m_view->m_addrend] (handler_entry::range r) { r.intersect(s, e); return r; };
|
||||
|
||||
auto filter = [s = m_global_range.start, e = m_global_range.end] (handler_entry::range r) { r.intersect(s, e); return r; };
|
||||
for(offs_t entry = 0; entry <= ee; entry++) {
|
||||
dispatch[entry]->ref(ne);
|
||||
u32 e0 = (entry << dt) & BITMASK;
|
||||
@ -669,25 +675,9 @@ template<int HighBits, int Width, int AddrShift> void handler_entry_read_dispatc
|
||||
m_u_ranges[e1] = filter(ranges[entry]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(offs_t entry = 0; entry <= ee; entry++) {
|
||||
dispatch[entry]->ref(ne);
|
||||
u32 e0 = (entry << dt) & BITMASK;
|
||||
for(offs_t e = 0; e != ne; e++) {
|
||||
offs_t e1 = e0 | e;
|
||||
if(!(m_u_dispatch[e1]->flags() & handler_entry::F_UNMAP))
|
||||
fatalerror("Collision on multiple init_handlers calls");
|
||||
m_u_dispatch[e1]->unref();
|
||||
m_u_dispatch[e1] = dispatch[entry];
|
||||
m_u_ranges[e1] = ranges[entry];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if(m_view) {
|
||||
auto filter = [s = m_view->m_addrstart, e = m_view->m_addrend] (handler_entry::range r) { r.intersect(s, e); return r; };
|
||||
|
||||
auto filter = [s = m_global_range.start, e = m_global_range.end] (handler_entry::range r) { r.intersect(s, e); return r; };
|
||||
for(offs_t entry = start_entry & BITMASK; entry <= (end_entry & BITMASK); entry++) {
|
||||
if(!(m_u_dispatch[entry]->flags() & handler_entry::F_UNMAP))
|
||||
fatalerror("Collision on multiple init_handlers calls");
|
||||
@ -696,16 +686,6 @@ template<int HighBits, int Width, int AddrShift> void handler_entry_read_dispatc
|
||||
m_u_ranges[entry] = filter(ranges[entry]);
|
||||
dispatch[entry]->ref();
|
||||
}
|
||||
} else {
|
||||
for(offs_t entry = start_entry & BITMASK; entry <= (end_entry & BITMASK); entry++) {
|
||||
if(!(m_u_dispatch[entry]->flags() & handler_entry::F_UNMAP))
|
||||
fatalerror("Collision on multiple init_handlers calls");
|
||||
m_u_dispatch[entry]->unref();
|
||||
m_u_dispatch[entry] = dispatch[entry];
|
||||
m_u_ranges[entry] = ranges[entry];
|
||||
dispatch[entry]->ref();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
using mapping = typename handler_entry_write<Width, AddrShift>::mapping;
|
||||
|
||||
handler_entry_write_dispatch(address_space *space, const handler_entry::range &init, handler_entry_write<Width, AddrShift> *handler);
|
||||
handler_entry_write_dispatch(address_space *space, memory_view &view);
|
||||
handler_entry_write_dispatch(address_space *space, memory_view &view, offs_t addrstart, offs_t addrend);
|
||||
handler_entry_write_dispatch(handler_entry_write_dispatch<HighBits, Width, AddrShift> *src);
|
||||
~handler_entry_write_dispatch();
|
||||
|
||||
@ -92,6 +92,8 @@ private:
|
||||
handler_entry_write<Width, AddrShift> **m_u_dispatch;
|
||||
handler_entry::range *m_u_ranges;
|
||||
|
||||
handler_entry::range m_global_range;
|
||||
|
||||
void populate_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write<Width, AddrShift> *handler);
|
||||
void populate_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write<Width, AddrShift> *handler);
|
||||
|
||||
|
@ -25,6 +25,7 @@ template<int HighBits, int Width, int AddrShift> handler_entry_write_dispatch<Hi
|
||||
m_a_dispatch = m_dispatch_array[0].data();
|
||||
m_u_ranges = m_ranges_array[0].data();
|
||||
m_u_dispatch = m_dispatch_array[0].data();
|
||||
m_global_range = init;
|
||||
|
||||
if (!handler)
|
||||
handler = space->get_unmap_w<Width, AddrShift>();
|
||||
@ -35,7 +36,7 @@ template<int HighBits, int Width, int AddrShift> handler_entry_write_dispatch<Hi
|
||||
}
|
||||
}
|
||||
|
||||
template<int HighBits, int Width, int AddrShift> handler_entry_write_dispatch<HighBits, Width, AddrShift>::handler_entry_write_dispatch(address_space *space, memory_view &view) : handler_entry_write<Width, AddrShift>(space, handler_entry::F_VIEW), m_view(&view), m_a_dispatch(nullptr), m_a_ranges(nullptr), m_u_dispatch(nullptr), m_u_ranges(nullptr)
|
||||
template<int HighBits, int Width, int AddrShift> handler_entry_write_dispatch<HighBits, Width, AddrShift>::handler_entry_write_dispatch(address_space *space, memory_view &view, offs_t addrstart, offs_t addrend) : handler_entry_write<Width, AddrShift>(space, handler_entry::F_VIEW), m_view(&view), m_a_dispatch(nullptr), m_a_ranges(nullptr), m_u_dispatch(nullptr), m_u_ranges(nullptr)
|
||||
{
|
||||
m_ranges_array.resize(1);
|
||||
m_dispatch_array.resize(1);
|
||||
@ -43,11 +44,16 @@ template<int HighBits, int Width, int AddrShift> handler_entry_write_dispatch<Hi
|
||||
m_a_dispatch = m_dispatch_array[0].data();
|
||||
m_u_ranges = m_ranges_array[0].data();
|
||||
m_u_dispatch = m_dispatch_array[0].data();
|
||||
m_global_range.start = addrstart;
|
||||
m_global_range.end = addrend;
|
||||
|
||||
auto handler = space->get_unmap_w<Width, AddrShift>();
|
||||
handler->ref(COUNT);
|
||||
for(unsigned int i=0; i != COUNT; i++)
|
||||
for(unsigned int i=0; i != COUNT; i++) {
|
||||
m_u_dispatch[i] = handler;
|
||||
m_u_ranges[i].start = addrstart;
|
||||
m_u_ranges[i].end = addrend;
|
||||
}
|
||||
}
|
||||
|
||||
template<int HighBits, int Width, int AddrShift> handler_entry_write_dispatch<HighBits, Width, AddrShift>::handler_entry_write_dispatch(handler_entry_write_dispatch<HighBits, Width, AddrShift> *src) : handler_entry_write<Width, AddrShift>(src->m_space, handler_entry::F_DISPATCH), m_view(nullptr)
|
||||
@ -58,6 +64,7 @@ template<int HighBits, int Width, int AddrShift> handler_entry_write_dispatch<Hi
|
||||
m_a_dispatch = m_dispatch_array[0].data();
|
||||
m_u_ranges = m_ranges_array[0].data();
|
||||
m_u_dispatch = m_dispatch_array[0].data();
|
||||
m_global_range = src->m_global_range;
|
||||
|
||||
for(unsigned int i=0; i != COUNT; i++) {
|
||||
m_u_dispatch[i] = src->m_u_dispatch[i]->dup();
|
||||
@ -91,10 +98,11 @@ template<int HighBits, int Width, int AddrShift> offs_t handler_entry_write_disp
|
||||
template<int HighBits, int Width, int AddrShift> void handler_entry_write_dispatch<HighBits, Width, AddrShift>::dump_map(std::vector<memory_entry> &map) const
|
||||
{
|
||||
if(m_view) {
|
||||
offs_t base_cur = map.empty() ? m_view->m_addrstart & HIGHMASK : map.back().end + 1;
|
||||
for(u32 i = 0; i != m_dispatch_array.size(); i++) {
|
||||
u32 j = map.size();
|
||||
offs_t cur = map.empty() ? m_view->m_addrstart & HIGHMASK : map.back().end + 1;
|
||||
offs_t end = m_view->m_addrend + 1;
|
||||
offs_t cur = base_cur;
|
||||
offs_t end = m_global_range.end + 1;
|
||||
do {
|
||||
offs_t entry = (cur >> LowBits) & BITMASK;
|
||||
if(m_dispatch_array[i][entry]->is_dispatch() || m_dispatch_array[i][entry]->is_view())
|
||||
@ -115,6 +123,7 @@ template<int HighBits, int Width, int AddrShift> void handler_entry_write_dispat
|
||||
} else {
|
||||
offs_t cur = map.empty() ? 0 : map.back().end + 1;
|
||||
offs_t base = cur & UPMASK;
|
||||
offs_t end = m_global_range.end + 1;
|
||||
do {
|
||||
offs_t entry = (cur >> LowBits) & BITMASK;
|
||||
if(m_a_dispatch[entry]->is_dispatch() || m_a_dispatch[entry]->is_view())
|
||||
@ -122,7 +131,7 @@ template<int HighBits, int Width, int AddrShift> void handler_entry_write_dispat
|
||||
else
|
||||
map.emplace_back(memory_entry{ m_a_ranges[entry].start, m_a_ranges[entry].end, m_a_dispatch[entry] });
|
||||
cur = map.back().end + 1;
|
||||
} while(cur && !((cur ^ base) & UPMASK));
|
||||
} while(cur != end && !((cur ^ base) & UPMASK));
|
||||
}
|
||||
}
|
||||
|
||||
@ -655,9 +664,7 @@ template<int HighBits, int Width, int AddrShift> void handler_entry_write_dispat
|
||||
u32 dt = lowbits - LowBits;
|
||||
u32 ne = 1 << dt;
|
||||
u32 ee = end_entry - start_entry;
|
||||
if(m_view) {
|
||||
auto filter = [s = m_view->m_addrstart, e = m_view->m_addrend] (handler_entry::range r) { r.intersect(s, e); return r; };
|
||||
|
||||
auto filter = [s = m_global_range.start, e = m_global_range.end] (handler_entry::range r) { r.intersect(s, e); return r; };
|
||||
for(offs_t entry = 0; entry <= ee; entry++) {
|
||||
dispatch[entry]->ref(ne);
|
||||
u32 e0 = (entry << dt) & BITMASK;
|
||||
@ -670,25 +677,9 @@ template<int HighBits, int Width, int AddrShift> void handler_entry_write_dispat
|
||||
m_u_ranges[e1] = filter(ranges[entry]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(offs_t entry = 0; entry <= ee; entry++) {
|
||||
dispatch[entry]->ref(ne);
|
||||
u32 e0 = (entry << dt) & BITMASK;
|
||||
for(offs_t e = 0; e != ne; e++) {
|
||||
offs_t e1 = e0 | e;
|
||||
if(!(m_u_dispatch[e1]->flags() & handler_entry::F_UNMAP))
|
||||
fatalerror("Collision on multiple init_handlers calls");
|
||||
m_u_dispatch[e1]->unref();
|
||||
m_u_dispatch[e1] = dispatch[entry];
|
||||
m_u_ranges[e1] = ranges[entry];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
if(m_view) {
|
||||
auto filter = [s = m_view->m_addrstart, e = m_view->m_addrend] (handler_entry::range r) { r.intersect(s, e); return r; };
|
||||
|
||||
auto filter = [s = m_global_range.start, e = m_global_range.end] (handler_entry::range r) { r.intersect(s, e); return r; };
|
||||
for(offs_t entry = start_entry & BITMASK; entry <= (end_entry & BITMASK); entry++) {
|
||||
if(!(m_u_dispatch[entry]->flags() & handler_entry::F_UNMAP))
|
||||
fatalerror("Collision on multiple init_handlers calls");
|
||||
@ -697,16 +688,6 @@ template<int HighBits, int Width, int AddrShift> void handler_entry_write_dispat
|
||||
m_u_ranges[entry] = filter(ranges[entry]);
|
||||
dispatch[entry]->ref();
|
||||
}
|
||||
} else {
|
||||
for(offs_t entry = start_entry & BITMASK; entry <= (end_entry & BITMASK); entry++) {
|
||||
if(!(m_u_dispatch[entry]->flags() & handler_entry::F_UNMAP))
|
||||
fatalerror("Collision on multiple init_handlers calls");
|
||||
m_u_dispatch[entry]->unref();
|
||||
m_u_dispatch[entry] = dispatch[entry];
|
||||
m_u_ranges[entry] = ranges[entry];
|
||||
dispatch[entry]->ref();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -556,60 +556,60 @@ void memory_view::initialize_from_address_map(offs_t addrstart, offs_t addrend,
|
||||
}
|
||||
|
||||
namespace {
|
||||
template<int Width, int AddrShift> void h_make_1(int HighBits, address_space &space, memory_view &view, handler_entry *&r, handler_entry *&w) {
|
||||
template<int Width, int AddrShift> void h_make_1(int HighBits, address_space &space, memory_view &view, offs_t addrstart, offs_t addrend, handler_entry *&r, handler_entry *&w) {
|
||||
switch(HighBits) {
|
||||
case 0: r = new handler_entry_read_dispatch<std::max(0, Width), Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<std::max(0, Width), Width, AddrShift>(&space, view); break;
|
||||
case 1: r = new handler_entry_read_dispatch<std::max(1, Width), Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<std::max(1, Width), Width, AddrShift>(&space, view); break;
|
||||
case 2: r = new handler_entry_read_dispatch<std::max(2, Width), Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<std::max(2, Width), Width, AddrShift>(&space, view); break;
|
||||
case 3: r = new handler_entry_read_dispatch<std::max(3, Width), Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<std::max(3, Width), Width, AddrShift>(&space, view); break;
|
||||
case 4: r = new handler_entry_read_dispatch< 4, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch< 4, Width, AddrShift>(&space, view); break;
|
||||
case 5: r = new handler_entry_read_dispatch< 5, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch< 5, Width, AddrShift>(&space, view); break;
|
||||
case 6: r = new handler_entry_read_dispatch< 6, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch< 6, Width, AddrShift>(&space, view); break;
|
||||
case 7: r = new handler_entry_read_dispatch< 7, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch< 7, Width, AddrShift>(&space, view); break;
|
||||
case 8: r = new handler_entry_read_dispatch< 8, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch< 8, Width, AddrShift>(&space, view); break;
|
||||
case 9: r = new handler_entry_read_dispatch< 9, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch< 9, Width, AddrShift>(&space, view); break;
|
||||
case 10: r = new handler_entry_read_dispatch<10, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<10, Width, AddrShift>(&space, view); break;
|
||||
case 11: r = new handler_entry_read_dispatch<11, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<11, Width, AddrShift>(&space, view); break;
|
||||
case 12: r = new handler_entry_read_dispatch<12, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<12, Width, AddrShift>(&space, view); break;
|
||||
case 13: r = new handler_entry_read_dispatch<13, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<13, Width, AddrShift>(&space, view); break;
|
||||
case 14: r = new handler_entry_read_dispatch<14, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<14, Width, AddrShift>(&space, view); break;
|
||||
case 15: r = new handler_entry_read_dispatch<15, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<15, Width, AddrShift>(&space, view); break;
|
||||
case 16: r = new handler_entry_read_dispatch<16, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<16, Width, AddrShift>(&space, view); break;
|
||||
case 17: r = new handler_entry_read_dispatch<17, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<17, Width, AddrShift>(&space, view); break;
|
||||
case 18: r = new handler_entry_read_dispatch<18, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<18, Width, AddrShift>(&space, view); break;
|
||||
case 19: r = new handler_entry_read_dispatch<19, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<19, Width, AddrShift>(&space, view); break;
|
||||
case 20: r = new handler_entry_read_dispatch<20, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<20, Width, AddrShift>(&space, view); break;
|
||||
case 21: r = new handler_entry_read_dispatch<21, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<21, Width, AddrShift>(&space, view); break;
|
||||
case 22: r = new handler_entry_read_dispatch<22, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<22, Width, AddrShift>(&space, view); break;
|
||||
case 23: r = new handler_entry_read_dispatch<23, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<23, Width, AddrShift>(&space, view); break;
|
||||
case 24: r = new handler_entry_read_dispatch<24, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<24, Width, AddrShift>(&space, view); break;
|
||||
case 25: r = new handler_entry_read_dispatch<25, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<25, Width, AddrShift>(&space, view); break;
|
||||
case 26: r = new handler_entry_read_dispatch<26, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<26, Width, AddrShift>(&space, view); break;
|
||||
case 27: r = new handler_entry_read_dispatch<27, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<27, Width, AddrShift>(&space, view); break;
|
||||
case 28: r = new handler_entry_read_dispatch<28, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<28, Width, AddrShift>(&space, view); break;
|
||||
case 29: r = new handler_entry_read_dispatch<29, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<29, Width, AddrShift>(&space, view); break;
|
||||
case 30: r = new handler_entry_read_dispatch<30, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<30, Width, AddrShift>(&space, view); break;
|
||||
case 31: r = new handler_entry_read_dispatch<31, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<31, Width, AddrShift>(&space, view); break;
|
||||
case 32: r = new handler_entry_read_dispatch<32, Width, AddrShift>(&space, view); w = new handler_entry_write_dispatch<32, Width, AddrShift>(&space, view); break;
|
||||
case 0: r = new handler_entry_read_dispatch<std::max(0, Width), Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<std::max(0, Width), Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 1: r = new handler_entry_read_dispatch<std::max(1, Width), Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<std::max(1, Width), Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 2: r = new handler_entry_read_dispatch<std::max(2, Width), Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<std::max(2, Width), Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 3: r = new handler_entry_read_dispatch<std::max(3, Width), Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<std::max(3, Width), Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 4: r = new handler_entry_read_dispatch< 4, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch< 4, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 5: r = new handler_entry_read_dispatch< 5, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch< 5, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 6: r = new handler_entry_read_dispatch< 6, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch< 6, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 7: r = new handler_entry_read_dispatch< 7, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch< 7, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 8: r = new handler_entry_read_dispatch< 8, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch< 8, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 9: r = new handler_entry_read_dispatch< 9, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch< 9, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 10: r = new handler_entry_read_dispatch<10, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<10, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 11: r = new handler_entry_read_dispatch<11, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<11, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 12: r = new handler_entry_read_dispatch<12, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<12, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 13: r = new handler_entry_read_dispatch<13, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<13, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 14: r = new handler_entry_read_dispatch<14, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<14, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 15: r = new handler_entry_read_dispatch<15, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<15, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 16: r = new handler_entry_read_dispatch<16, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<16, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 17: r = new handler_entry_read_dispatch<17, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<17, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 18: r = new handler_entry_read_dispatch<18, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<18, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 19: r = new handler_entry_read_dispatch<19, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<19, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 20: r = new handler_entry_read_dispatch<20, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<20, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 21: r = new handler_entry_read_dispatch<21, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<21, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 22: r = new handler_entry_read_dispatch<22, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<22, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 23: r = new handler_entry_read_dispatch<23, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<23, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 24: r = new handler_entry_read_dispatch<24, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<24, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 25: r = new handler_entry_read_dispatch<25, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<25, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 26: r = new handler_entry_read_dispatch<26, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<26, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 27: r = new handler_entry_read_dispatch<27, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<27, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 28: r = new handler_entry_read_dispatch<28, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<28, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 29: r = new handler_entry_read_dispatch<29, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<29, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 30: r = new handler_entry_read_dispatch<30, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<30, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 31: r = new handler_entry_read_dispatch<31, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<31, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
case 32: r = new handler_entry_read_dispatch<32, Width, AddrShift>(&space, view, addrstart, addrend); w = new handler_entry_write_dispatch<32, Width, AddrShift>(&space, view, addrstart, addrend); break;
|
||||
default: abort();
|
||||
}
|
||||
}
|
||||
|
||||
void h_make(int HighBits, int Width, int AddrShift, address_space &space, memory_view &view, handler_entry *&r, handler_entry *&w) {
|
||||
void h_make(int HighBits, int Width, int AddrShift, address_space &space, memory_view &view, offs_t addrstart, offs_t addrend, handler_entry *&r, handler_entry *&w) {
|
||||
switch (Width | (AddrShift + 4)) {
|
||||
case 8|(4+1): h_make_1<0, 1>(HighBits, space, view, r, w); break;
|
||||
case 8|(4-0): h_make_1<0, 0>(HighBits, space, view, r, w); break;
|
||||
case 16|(4+3): h_make_1<1, 3>(HighBits, space, view, r, w); break;
|
||||
case 16|(4-0): h_make_1<1, 0>(HighBits, space, view, r, w); break;
|
||||
case 16|(4-1): h_make_1<1, -1>(HighBits, space, view, r, w); break;
|
||||
case 32|(4+3): h_make_1<2, 3>(HighBits, space, view, r, w); break;
|
||||
case 32|(4-0): h_make_1<2, 0>(HighBits, space, view, r, w); break;
|
||||
case 32|(4-1): h_make_1<2, -1>(HighBits, space, view, r, w); break;
|
||||
case 32|(4-2): h_make_1<2, -2>(HighBits, space, view, r, w); break;
|
||||
case 64|(4-0): h_make_1<3, 0>(HighBits, space, view, r, w); break;
|
||||
case 64|(4-1): h_make_1<3, -1>(HighBits, space, view, r, w); break;
|
||||
case 64|(4-2): h_make_1<3, -2>(HighBits, space, view, r, w); break;
|
||||
case 64|(4-3): h_make_1<3, -3>(HighBits, space, view, r, w); break;
|
||||
case 8|(4+1): h_make_1<0, 1>(HighBits, space, view, addrstart, addrend, r, w); break;
|
||||
case 8|(4-0): h_make_1<0, 0>(HighBits, space, view, addrstart, addrend, r, w); break;
|
||||
case 16|(4+3): h_make_1<1, 3>(HighBits, space, view, addrstart, addrend, r, w); break;
|
||||
case 16|(4-0): h_make_1<1, 0>(HighBits, space, view, addrstart, addrend, r, w); break;
|
||||
case 16|(4-1): h_make_1<1, -1>(HighBits, space, view, addrstart, addrend, r, w); break;
|
||||
case 32|(4+3): h_make_1<2, 3>(HighBits, space, view, addrstart, addrend, r, w); break;
|
||||
case 32|(4-0): h_make_1<2, 0>(HighBits, space, view, addrstart, addrend, r, w); break;
|
||||
case 32|(4-1): h_make_1<2, -1>(HighBits, space, view, addrstart, addrend, r, w); break;
|
||||
case 32|(4-2): h_make_1<2, -2>(HighBits, space, view, addrstart, addrend, r, w); break;
|
||||
case 64|(4-0): h_make_1<3, 0>(HighBits, space, view, addrstart, addrend, r, w); break;
|
||||
case 64|(4-1): h_make_1<3, -1>(HighBits, space, view, addrstart, addrend, r, w); break;
|
||||
case 64|(4-2): h_make_1<3, -2>(HighBits, space, view, addrstart, addrend, r, w); break;
|
||||
case 64|(4-3): h_make_1<3, -3>(HighBits, space, view, addrstart, addrend, r, w); break;
|
||||
default: abort();
|
||||
}
|
||||
}
|
||||
@ -635,7 +635,7 @@ std::pair<handler_entry *, handler_entry *> memory_view::make_handlers(address_s
|
||||
offs_t span = addrstart ^ addrend;
|
||||
u32 awidth = 32 - count_leading_zeros_32(span);
|
||||
|
||||
h_make(awidth, m_config->data_width(), m_config->addr_shift(), space, *this, m_handler_read, m_handler_write);
|
||||
h_make(awidth, m_config->data_width(), m_config->addr_shift(), space, *this, addrstart, addrend, m_handler_read, m_handler_write);
|
||||
m_handler_read->ref();
|
||||
m_handler_write->ref();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user