summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/emumem_hep.cpp
blob: f411dcb522c55bda6e354c5686b12c70e79d42d1 (plain) (blame)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert

#include "emu.h"
#include "emumem_hep.h"

template<int Width, int AddrShift, int Endian> handler_entry_read_passthrough<Width, AddrShift, Endian>::~handler_entry_read_passthrough()
{
	if(m_next) {
		m_mph.remove_handler(this);
		m_next->unref();
	}
}

template<int Width, int AddrShift, int Endian> void handler_entry_read_passthrough<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
{
	if(!m_next->is_passthrough())
		return;
	auto np = static_cast<handler_entry_read_passthrough<Width, AddrShift, Endian> *>(m_next);

	if(handlers.find(np) != handlers.end()) {
		m_next = np->get_subhandler();
		m_next->ref();
		np->unref();

	} else
		np->detach(handlers);
}

template<int Width, int AddrShift, int Endian> handler_entry_write_passthrough<Width, AddrShift, Endian>::~handler_entry_write_passthrough()
{
	if(m_next) {
		m_mph.remove_handler(this);
		m_next->unref();
	}
}

template<int Width, int AddrShift, int Endian> void handler_entry_write_passthrough<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
{
	if(!m_next->is_passthrough())
		return;
	auto np = static_cast<handler_entry_write_passthrough<Width, AddrShift, Endian> *>(m_next);

	if(handlers.find(np) != handlers.end()) {
		m_next = np->get_subhandler();
		m_next->ref();
		np->unref();

	} else
		np->detach(handlers);
}

template class handler_entry_read_passthrough<0,  1, ENDIANNESS_LITTLE>;
template class handler_entry_read_passthrough<0,  1, ENDIANNESS_BIG>;
template class handler_entry_read_passthrough<0,  0, ENDIANNESS_LITTLE>;
template class handler_entry_read_passthrough<0,  0, ENDIANNESS_BIG>;
template class handler_entry_read_passthrough<1,  3, ENDIANNESS_LITTLE>;
template class handler_entry_read_passthrough<1,  3, ENDIANNESS_BIG>;
template class handler_entry_read_passthrough<1,  0, ENDIANNESS_LITTLE>;
template class handler_entry_read_passthrough<1,  0, ENDIANNESS_BIG>;
template class handler_entry_read_passthrough<1, -1, ENDIANNESS_LITTLE>;
template class handler_entry_read_passthrough<1, -1, ENDIANNESS_BIG>;
template class handler_entry_read_passthrough<2,  0, ENDIANNESS_LITTLE>;
template class handler_entry_read_passthrough<2,  0, ENDIANNESS_BIG>;
template class handler_entry_read_passthrough<2, -1, ENDIANNESS_LITTLE>;
template class handler_entry_read_passthrough<2, -1, ENDIANNESS_BIG>;
template class handler_entry_read_passthrough<2, -2, ENDIANNESS_LITTLE>;
template class handler_entry_read_passthrough<2, -2, ENDIANNESS_BIG>;
template class handler_entry_read_passthrough<3,  0, ENDIANNESS_LITTLE>;
template class handler_entry_read_passthrough<3,  0, ENDIANNESS_BIG>;
template class handler_entry_read_passthrough<3, -1, ENDIANNESS_LITTLE>;
template class handler_entry_read_passthrough<3, -1, ENDIANNESS_BIG>;
template class handler_entry_read_passthrough<3, -2, ENDIANNESS_LITTLE>;
template class handler_entry_read_passthrough<3, -2, ENDIANNESS_BIG>;
template class handler_entry_read_passthrough<3, -3, ENDIANNESS_LITTLE>;
template class handler_entry_read_passthrough<3, -3, ENDIANNESS_BIG>;

template class handler_entry_write_passthrough<0,  1, ENDIANNESS_LITTLE>;
template class handler_entry_write_passthrough<0,  1, ENDIANNESS_BIG>;
template class handler_entry_write_passthrough<0,  0, ENDIANNESS_LITTLE>;
template class handler_entry_write_passthrough<0,  0, ENDIANNESS_BIG>;
template class handler_entry_write_passthrough<1,  3, ENDIANNESS_LITTLE>;
template class handler_entry_write_passthrough<1,  3, ENDIANNESS_BIG>;
template class handler_entry_write_passthrough<1,  0, ENDIANNESS_LITTLE>;
template class handler_entry_write_passthrough<1,  0, ENDIANNESS_BIG>;
template class handler_entry_write_passthrough<1, -1, ENDIANNESS_LITTLE>;
template class handler_entry_write_passthrough<1, -1, ENDIANNESS_BIG>;
template class handler_entry_write_passthrough<2,  0, ENDIANNESS_LITTLE>;
template class handler_entry_write_passthrough<2,  0, ENDIANNESS_BIG>;
template class handler_entry_write_passthrough<2, -1, ENDIANNESS_LITTLE>;
template class handler_entry_write_passthrough<2, -1, ENDIANNESS_BIG>;
template class handler_entry_write_passthrough<2, -2, ENDIANNESS_LITTLE>;
template class handler_entry_write_passthrough<2, -2, ENDIANNESS_BIG>;
template class handler_entry_write_passthrough<3,  0, ENDIANNESS_LITTLE>;
template class handler_entry_write_passthrough<3,  0, ENDIANNESS_BIG>;
template class handler_entry_write_passthrough<3, -1, ENDIANNESS_LITTLE>;
template class handler_entry_write_passthrough<3, -1, ENDIANNESS_BIG>;
template class handler_entry_write_passthrough<3, -2, ENDIANNESS_LITTLE>;
template class handler_entry_write_passthrough<3, -2, ENDIANNESS_BIG>;
template class handler_entry_write_passthrough<3, -3, ENDIANNESS_LITTLE>;
template class handler_entry_write_passthrough<3, -3, ENDIANNESS_BIG>;