ioctl.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 <ioctl.h>
23 #include <ioctl_private.h>
24 
26  m_d {std::make_unique<ioctl_private>()}
27 { }
28 
29 void
31 {
32  if (auto d = dynamic_cast<ioctl_private *>(m_d.get()))
33  d->open();
34 }
35 
36 void
38 {
39  if (auto d = dynamic_cast<ioctl_private *>(m_d.get()))
40  {
41  d->call_ioctl_add_module_length(module_data.size());
42  d->call_ioctl_add_module(module_data.data());
43  }
44 }
45 
46 void
48 {
49  if (auto d = dynamic_cast<ioctl_private *>(m_d.get()))
50  d->call_ioctl_load_vmm();
51 }
52 
53 void
55 {
56  if (auto d = dynamic_cast<ioctl_private *>(m_d.get()))
57  d->call_ioctl_unload_vmm();
58 }
59 
60 void
62 {
63  if (auto d = dynamic_cast<ioctl_private *>(m_d.get()))
64  d->call_ioctl_start_vmm();
65 }
66 
67 void
69 {
70  if (auto d = dynamic_cast<ioctl_private *>(m_d.get()))
71  d->call_ioctl_stop_vmm();
72 }
73 
74 void
75 ioctl::call_ioctl_dump_vmm(gsl::not_null<drr_pointer> drr, vcpuid_type vcpuid)
76 {
77  if (auto d = dynamic_cast<ioctl_private *>(m_d.get()))
78  d->call_ioctl_dump_vmm(drr, vcpuid);
79 }
80 
81 void
82 ioctl::call_ioctl_vmm_status(gsl::not_null<status_pointer> status)
83 {
84  if (auto d = dynamic_cast<ioctl_private *>(m_d.get()))
85  d->call_ioctl_vmm_status(status);
86 }
87 
88 void
89 ioctl::call_ioctl_vmcall(gsl::not_null<registers_pointer> regs, cpuid_type cpuid)
90 {
91  if (auto d = dynamic_cast<ioctl_private *>(m_d.get()))
92  d->call_ioctl_vmcall(regs, cpuid);
93 }
uint64_t vcpuid_type
Definition: ioctl.h:56
file::binary_data binary_data
Definition: ioctl.h:52
virtual void call_ioctl_vmm_status(gsl::not_null< status_pointer > status)
Definition: ioctl.cpp:82
virtual void call_ioctl_start_vmm()
Definition: ioctl.cpp:61
ioctl()
Definition: ioctl.cpp:25
Definition: vcpuid.h:29
debug_ring_resources_t * drr
virtual void call_ioctl_stop_vmm()
Definition: ioctl.cpp:68
virtual void call_ioctl_unload_vmm()
Definition: ioctl.cpp:54
virtual void call_ioctl_dump_vmm(gsl::not_null< drr_pointer > drr, vcpuid_type vcpuid)
Definition: ioctl.cpp:75
virtual void call_ioctl_load_vmm()
Definition: ioctl.cpp:47
virtual void open()
Definition: ioctl.cpp:30
uint64_t cpuid_type
Definition: ioctl.h:55
virtual void call_ioctl_vmcall(gsl::not_null< registers_pointer > regs, cpuid_type cpuid)
Definition: ioctl.cpp:89
virtual void call_ioctl_add_module(const binary_data &module_data)
Definition: ioctl.cpp:37