Exemple #1
0
        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 handler)
        {
            var cur = m_dispatch[entry];

            if (cur.is_dispatch())
            {
                cur.populate_mirror(start, end, ostart, oend, mirror, handler);
            }
            else
            {
                var subdispatch = new handler_entry_read_dispatch((int)LowBits, Width, AddrShift, Endian, m_space, m_ranges[entry], cur);
                cur.unref();
                m_dispatch[entry] = subdispatch;
                subdispatch.populate_mirror(start, end, ostart, oend, mirror, handler);
            }
        }
Exemple #2
0
        void populate_mismatched_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, memory_units_descriptor <int_Width, int_AddrShift> descriptor, std.vector <mapping> mappings)
        {
            var cur = m_u_dispatch[entry];

            if (cur.is_dispatch())
            {
                cur.populate_mismatched_mirror(start, end, ostart, oend, mirror, descriptor, mappings);
            }
            else
            {
                var subdispatch = new handler_entry_read_dispatch <int_const_LowBits, int_Width, int_AddrShift>(m_space, m_u_ranges[entry], cur);  //auto subdispatch = new handler_entry_read_dispatch<LowBits, Width, AddrShift>(handler_entry::m_space, m_u_ranges[entry], cur);
                cur.unref();
                m_u_dispatch[entry] = subdispatch;
                subdispatch.populate_mismatched_mirror(start, end, ostart, oend, mirror, descriptor, mappings);
            }
        }
Exemple #3
0
        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 <int_Width, int_AddrShift> handler)
        {
            var cur = m_u_dispatch[entry];

            if (cur.is_dispatch())
            {
                cur.populate_mirror(start, end, ostart, oend, mirror, handler);
            }
            else
            {
                var subdispatch = new handler_entry_read_dispatch <int_const_LowBits, int_Width, int_AddrShift>(m_space, m_u_ranges[entry], cur);  //auto subdispatch = new handler_entry_read_dispatch<LowBits, Width, AddrShift>(handler_entry::m_space, m_u_ranges[entry], cur);
                cur.unref();
                m_u_dispatch[entry] = subdispatch;
                subdispatch.populate_mirror(start, end, ostart, oend, mirror, handler);
            }
        }
Exemple #4
0
        //handler_entry_read_dispatch(address_space *space, memory_view &view);


        handler_entry_read_dispatch(handler_entry_read_dispatch <int_HighBits, int_Width, int_AddrShift> src)
            : base(src.m_space, handler_entry.F_DISPATCH)
        {
            m_view = null;


            m_ranges_array.resize(1);
            m_dispatch_array.resize(1);
            m_a_ranges   = m_ranges_array[0].data();
            m_a_dispatch = m_dispatch_array[0].data();
            m_u_ranges   = m_ranges_array[0].data();
            m_u_dispatch = m_dispatch_array[0].data();

            for (unsigned i = 0; i != COUNT; i++)
            {
                m_u_dispatch[i] = src.m_u_dispatch[i].dup();
                m_u_ranges[i]   = src.m_u_ranges[i];
            }
        }
Exemple #5
0
        public override void init_handlers(offs_t start_entry, offs_t end_entry, u32 lowbits, offs_t ostart, offs_t oend, Pointer <handler_entry_read <int_Width, int_AddrShift> > dispatch, Pointer <handler_entry.range> ranges)  //template<int HighBits, int Width, int AddrShift> void handler_entry_read_dispatch<HighBits, Width, AddrShift>::init_handlers(offs_t start_entry, offs_t end_entry, u32 lowbits, handler_entry_read<Width, AddrShift> **dispatch, handler_entry::range *ranges)
        {
            if (lowbits < LowBits)
            {
                offs_t entry = start_entry >> (int)LowBits;
                if (entry != (end_entry >> (int)LowBits))
                {
                    fatalerror("Recursive init_handlers spanning multiple entries.\n");
                }
                entry &= BITMASK;
                handler_entry_read_dispatch <int_const_LowBits, int_Width, int_AddrShift> subdispatch = null;
                if ((m_u_dispatch[entry].flags() & handler_entry.F_DISPATCH) != 0)
                {
                    subdispatch = (handler_entry_read_dispatch <int_const_LowBits, int_Width, int_AddrShift>)m_u_dispatch[entry];
                }
                else if ((m_u_dispatch[entry].flags() & handler_entry.F_UNMAP) == 0)
                {
                    fatalerror("Collision on multiple init_handlers calls");
                }
                else
                {
                    m_u_dispatch[entry].unref();
                    m_u_dispatch[entry] = subdispatch = new handler_entry_read_dispatch <int_const_LowBits, int_Width, int_AddrShift>(this.m_space, m_u_ranges[entry], null);
                }

                int delta = (int)(dispatch_entry(ostart) - subdispatch.dispatch_entry(ostart));
                subdispatch.init_handlers(start_entry, end_entry, lowbits, ostart, oend, dispatch + delta, ranges + delta);
            }
            else if (lowbits != LowBits)
            {
                u32 dt = lowbits - LowBits;
                u32 ne = 1U << (int)dt;
                u32 ee = end_entry - start_entry;
                if (m_view != null)
                {
                    Func <handler_entry.range, handler_entry.range> filter = (handler_entry.range r) => { var s = m_view.m_addrstart; var e = m_view.m_addrend; r.intersect(s, e); return(r); };  //auto filter = [s = m_view->m_addrstart, e = m_view->m_addrend] (handler_entry::range r) { r.intersect(s, e); return r; };

                    for (offs_t entry = 0; entry <= ee; entry++)
                    {
                        dispatch[entry].ref_((int)ne);
                        u32 e0 = (entry << (int)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) == 0)
                            {
                                fatalerror("Collision on multiple init_handlers calls");
                            }

                            m_u_dispatch[e1].unref();
                            m_u_dispatch[e1] = dispatch[entry];
                            m_u_ranges[e1]   = filter(ranges[entry]);
                        }
                    }
                }
                else
                {
                    for (offs_t entry = 0; entry <= ee; entry++)
                    {
                        dispatch[entry].ref_((int)ne);
                        u32 e0 = (entry << (int)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) == 0)
                            {
                                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 != null)
                {
                    Func <handler_entry.range, handler_entry.range> filter = (handler_entry.range r) => { var s = m_view.m_addrstart; var e = m_view.m_addrend; r.intersect(s, e); return(r); };  //auto filter = [s = m_view->m_addrstart, e = m_view->m_addrend] (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) == 0)
                        {
                            fatalerror("Collision on multiple init_handlers calls");
                        }

                        m_u_dispatch[entry].unref();
                        m_u_dispatch[entry] = dispatch[entry];
                        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) == 0)
                        {
                            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_();
                    }
                }
            }
        }