ioctl.h
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 #ifndef IOCTL_H
23 #define IOCTL_H
24 
25 #include <memory>
26 
27 #include <file.h>
28 #include <vmcall_interface.h>
29 #include <debug_ring_interface.h>
30 
36 {
37 public:
38  ioctl_private_base() = default;
39  virtual ~ioctl_private_base() = default;
40 };
41 
48 class ioctl
49 {
50 public:
51 
54  using drr_pointer = drr_type *;
55  using cpuid_type = uint64_t;
56  using vcpuid_type = uint64_t;
57  using status_type = int64_t;
61 
67  ioctl();
68 
74  virtual ~ioctl() = default;
75 
83  virtual void open();
84 
94  virtual void call_ioctl_add_module(const binary_data &module_data);
95 
103  virtual void call_ioctl_load_vmm();
104 
112  virtual void call_ioctl_unload_vmm();
113 
121  virtual void call_ioctl_start_vmm();
122 
130  virtual void call_ioctl_stop_vmm();
131 
142  virtual void call_ioctl_dump_vmm(gsl::not_null<drr_pointer> drr, vcpuid_type vcpuid);
143 
153  virtual void call_ioctl_vmm_status(gsl::not_null<status_pointer> status);
154 
165  virtual void call_ioctl_vmcall(gsl::not_null<registers_pointer> regs, cpuid_type cpuid);
166 
167 private:
168 
169  std::unique_ptr<ioctl_private_base> m_d;
170 };
171 
172 #endif
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
virtual ~ioctl()=default
virtual ~ioctl_private_base()=default
status_type * status_pointer
Definition: ioctl.h:58
Definition: vcpuid.h:29
debug_ring_resources_t * drr
virtual void call_ioctl_stop_vmm()
Definition: ioctl.cpp:68
int64_t status_type
Definition: ioctl.h:57
virtual void call_ioctl_unload_vmm()
Definition: ioctl.cpp:54
ioctl_private_base()=default
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
Definition: ioctl.h:48
uint64_t cpuid_type
Definition: ioctl.h:55
std::vector< char > binary_data
Definition: file.h:40
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