portio_x64_mock.cpp
Go to the documentation of this file.
1 //
2 // Bareflank Hypervisor
3 //
4 // Copyright (C) 2015 Assured Information Security, Inc.
5 // Author: Rian Quinn <quinnr@ainfosec.com>
6 // Author: Brendan Kerrigan <kerriganb@ainfosec.com>
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 
22 #include <gsl/gsl>
23 #include <debug.h>
24 
25 extern "C" uint8_t
26 __attribute__((weak)) __inb(uint16_t port) noexcept
27 {
28  std::cerr << __FUNC__ << " called with: " << '\n';
29  std::cerr << " - port: " << view_as_pointer(port) << '\n';
30  abort();
31 }
32 
33 extern "C" uint16_t
34 __attribute__((weak)) __inw(uint16_t port) noexcept
35 {
36  std::cerr << __FUNC__ << " called with: " << '\n';
37  std::cerr << " - port: " << view_as_pointer(port) << '\n';
38  abort();
39 }
40 
41 extern "C" uint32_t
42 __attribute__((weak)) __ind(uint16_t port) noexcept
43 {
44  std::cerr << __FUNC__ << " called with: " << '\n';
45  std::cerr << " - port: " << view_as_pointer(port) << '\n';
46  abort();
47 }
48 
49 extern "C" void
50 __attribute__((weak)) __insb(uint16_t port, uint64_t m8) noexcept
51 {
52  std::cerr << __FUNC__ << " called with: " << '\n';
53  std::cerr << " - port: " << view_as_pointer(port) << '\n';
54  std::cerr << " - m8: " << view_as_pointer(m8) << '\n';
55  abort();
56 }
57 
58 extern "C" void
59 __attribute__((weak)) __insw(uint16_t port, uint64_t m16) noexcept
60 {
61  std::cerr << __FUNC__ << " called with: " << '\n';
62  std::cerr << " - port: " << view_as_pointer(port) << '\n';
63  std::cerr << " - m16: " << view_as_pointer(m16) << '\n';
64  abort();
65 }
66 
67 extern "C" void
68 __attribute__((weak)) __insd(uint16_t port, uint64_t m32) noexcept
69 {
70  std::cerr << __FUNC__ << " called with: " << '\n';
71  std::cerr << " - port: " << view_as_pointer(port) << '\n';
72  std::cerr << " - m32: " << view_as_pointer(m32) << '\n';
73  abort();
74 }
75 
76 extern "C" void
77 __attribute__((weak)) __insbrep(uint16_t port, uint64_t m8, uint32_t count) noexcept
78 {
79  std::cerr << __FUNC__ << " called with: " << '\n';
80  std::cerr << " - port: " << view_as_pointer(port) << '\n';
81  std::cerr << " - m8: " << view_as_pointer(m8) << '\n';
82  std::cerr << " - count: " << view_as_pointer(count) << '\n';
83  abort();
84 }
85 
86 extern "C" void
87 __attribute__((weak)) __inswrep(uint16_t port, uint64_t m16, uint32_t count) noexcept
88 {
89  std::cerr << __FUNC__ << " called with: " << '\n';
90  std::cerr << " - port: " << view_as_pointer(port) << '\n';
91  std::cerr << " - m16: " << view_as_pointer(m16) << '\n';
92  std::cerr << " - count: " << view_as_pointer(count) << '\n';
93  abort();
94 }
95 
96 extern "C" void
97 __attribute__((weak)) __insdrep(uint16_t port, uint64_t m32, uint32_t count) noexcept
98 {
99  std::cerr << __FUNC__ << " called with: " << '\n';
100  std::cerr << " - port: " << view_as_pointer(port) << '\n';
101  std::cerr << " - m32: " << view_as_pointer(m32) << '\n';
102  std::cerr << " - count: " << view_as_pointer(count) << '\n';
103  abort();
104 }
105 
106 extern "C" void
107 __attribute__((weak)) __outb(uint16_t port, uint8_t val) noexcept
108 {
109  std::cerr << __FUNC__ << " called with: " << '\n';
110  std::cerr << " - port: " << view_as_pointer(port) << '\n';
111  std::cerr << " - val: " << view_as_pointer(val) << '\n';
112  abort();
113 }
114 
115 extern "C" void
116 __attribute__((weak)) __outw(uint16_t port, uint16_t val) noexcept
117 {
118  std::cerr << __FUNC__ << " called with: " << '\n';
119  std::cerr << " - port: " << view_as_pointer(port) << '\n';
120  std::cerr << " - val: " << view_as_pointer(val) << '\n';
121  abort();
122 }
123 
124 extern "C" void
125 __attribute__((weak)) __outd(uint16_t port, uint32_t val) noexcept
126 {
127  std::cerr << __FUNC__ << " called with: " << '\n';
128  std::cerr << " - port: " << view_as_pointer(port) << '\n';
129  std::cerr << " - val: " << view_as_pointer(val) << '\n';
130  abort();
131 }
132 
133 extern "C" void
134 __attribute__((weak)) __outsb(uint16_t port, uint64_t m8) noexcept
135 {
136  std::cerr << __FUNC__ << " called with: " << '\n';
137  std::cerr << " - port: " << view_as_pointer(port) << '\n';
138  std::cerr << " - m8: " << view_as_pointer(m8) << '\n';
139  abort();
140 }
141 
142 extern "C" void
143 __attribute__((weak)) __outsw(uint16_t port, uint64_t m16) noexcept
144 {
145  std::cerr << __FUNC__ << " called with: " << '\n';
146  std::cerr << " - port: " << view_as_pointer(port) << '\n';
147  std::cerr << " - m16: " << view_as_pointer(m16) << '\n';
148  abort();
149 }
150 
151 extern "C" void
152 __attribute__((weak)) __outsd(uint16_t port, uint64_t m32) noexcept
153 {
154  std::cerr << __FUNC__ << " called with: " << '\n';
155  std::cerr << " - port: " << view_as_pointer(port) << '\n';
156  std::cerr << " - m32: " << view_as_pointer(m32) << '\n';
157  abort();
158 }
159 
160 extern "C" void
161 __attribute__((weak)) __outsbrep(uint16_t port, uint64_t m8, uint32_t count) noexcept
162 {
163  std::cerr << __FUNC__ << " called with: " << '\n';
164  std::cerr << " - port: " << view_as_pointer(port) << '\n';
165  std::cerr << " - m8: " << view_as_pointer(m8) << '\n';
166  std::cerr << " - count: " << view_as_pointer(count) << '\n';
167  abort();
168 }
169 
170 extern "C" void
171 __attribute__((weak)) __outswrep(uint16_t port, uint64_t m16, uint32_t count) noexcept
172 {
173  std::cerr << __FUNC__ << " called with: " << '\n';
174  std::cerr << " - port: " << view_as_pointer(port) << '\n';
175  std::cerr << " - m16: " << view_as_pointer(m16) << '\n';
176  std::cerr << " - count: " << view_as_pointer(count) << '\n';
177  abort();
178 }
179 
180 extern "C" void
181 __attribute__((weak)) __outsdrep(uint16_t port, uint64_t m32, uint32_t count) noexcept
182 {
183  std::cerr << __FUNC__ << " called with: " << '\n';
184  std::cerr << " - port: " << view_as_pointer(port) << '\n';
185  std::cerr << " - m32: " << view_as_pointer(m32) << '\n';
186  std::cerr << " - count: " << view_as_pointer(count) << '\n';
187  abort();
188 }
void __outsb(uint16_t port, uint64_t m8) noexcept
uint32_t __ind(uint16_t port) noexcept
void __inswrep(uint16_t port, uint64_t m16, uint32_t count) noexcept
void __insw(uint16_t port, uint64_t m16) noexcept
uint8_t __attribute__((weak)) __inb(uint16_t port) noexcept
void __insdrep(uint16_t port, uint64_t m32, uint32_t count) noexcept
void __outsdrep(uint16_t port, uint64_t m32, uint32_t count) noexcept
void __outsbrep(uint16_t port, uint64_t m8, uint32_t count) noexcept
uint16_t __inw(uint16_t port) noexcept
void __outd(uint16_t port, uint32_t val) noexcept
void __outsw(uint16_t port, uint64_t m16) noexcept
void uint64_t m8 noexcept
void __insb(uint16_t port, uint64_t m8) noexcept
void __insbrep(uint16_t port, uint64_t m8, uint32_t count) noexcept
uint8_t __inb(uint16_t port) noexcept
void __outw(uint16_t port, uint16_t val) noexcept
const void * view_as_pointer(const T val)
void __outsd(uint16_t port, uint64_t m32) noexcept
void __outswrep(uint16_t port, uint64_t m16, uint32_t count) noexcept
void __insd(uint16_t port, uint64_t m32) noexcept
void __outb(uint16_t port, uint8_t val) noexcept