1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
// handler_entry_read_passthrough/handler_entry_write_passthrough
// parent class for handlers which want to tap the access and usually pass it on to another handler
template<int Width, int AddrShift> class handler_entry_read_passthrough : public handler_entry_read<Width, AddrShift>
{
public:
using uX = emu::detail::handler_entry_size_t<Width>;
handler_entry_read_passthrough(address_space *space, emu::detail::memory_passthrough_handler_impl &mph, u32 prio) : handler_entry_read<Width, AddrShift>(space, handler_entry::f_pt(prio)), m_mph(mph), m_next(nullptr) {}
~handler_entry_read_passthrough();
virtual handler_entry_read_passthrough<Width, AddrShift> *instantiate(handler_entry_read<Width, AddrShift> *next) const = 0;
handler_entry_read<Width, AddrShift> *get_subhandler() const { return m_next; }
void detach(const std::unordered_set<handler_entry *> &handlers) override;
protected:
emu::detail::memory_passthrough_handler_impl &m_mph;
handler_entry_read<Width, AddrShift> *m_next;
handler_entry_read_passthrough(address_space *space, emu::detail::memory_passthrough_handler_impl &mph, u32 prio, handler_entry_read<Width, AddrShift> *next) : handler_entry_read<Width, AddrShift>(space, handler_entry::f_pt(prio)), m_mph(mph), m_next(next) { next->ref(); mph.add_handler(this); }
};
template<int Width, int AddrShift> class handler_entry_write_passthrough : public handler_entry_write<Width, AddrShift>
{
public:
using uX = emu::detail::handler_entry_size_t<Width>;
handler_entry_write_passthrough(address_space *space, emu::detail::memory_passthrough_handler_impl &mph, u32 prio) : handler_entry_write<Width, AddrShift>(space, handler_entry::f_pt(prio)), m_mph(mph), m_next(nullptr) {}
~handler_entry_write_passthrough();
virtual handler_entry_write_passthrough<Width, AddrShift> *instantiate(handler_entry_write<Width, AddrShift> *next) const = 0;
handler_entry_write<Width, AddrShift> *get_subhandler() const { return m_next; }
void detach(const std::unordered_set<handler_entry *> &handlers) override;
protected:
emu::detail::memory_passthrough_handler_impl &m_mph;
handler_entry_write<Width, AddrShift> *m_next;
handler_entry_write_passthrough(address_space *space, emu::detail::memory_passthrough_handler_impl &mph, u32 prio, handler_entry_write<Width, AddrShift> *next) : handler_entry_write<Width, AddrShift>(space, handler_entry::f_pt(prio)), m_mph(mph), m_next(next) { next->ref(); mph.add_handler(this); }
};
|