vcpu_intel_x64.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 VCPU_INTEL_X64_H
23 #define VCPU_INTEL_X64_H
24 
25 #include <vcpuid.h>
26 #include <user_data.h>
27 #include <vcpu/vcpu.h>
28 #include <vmxon/vmxon_intel_x64.h>
29 #include <vmcs/vmcs_intel_x64.h>
33 
48 class vcpu_intel_x64 : public vcpu
49 {
50 public:
51 
78  vcpuid::type id,
79  std::unique_ptr<debug_ring> debug_ring = nullptr,
80  std::unique_ptr<vmxon_intel_x64> vmxon = nullptr,
81  std::unique_ptr<vmcs_intel_x64> vmcs = nullptr,
82  std::unique_ptr<exit_handler_intel_x64> exit_handler = nullptr,
83  std::unique_ptr<vmcs_intel_x64_state> vmm_state = nullptr,
84  std::unique_ptr<vmcs_intel_x64_state> guest_state = nullptr);
85 
88  ~vcpu_intel_x64() override = default;
89 
97  void init(user_data *data = nullptr) override;
98 
106  void fini(user_data *data = nullptr) override;
107 
115  void run(user_data *data = nullptr) override;
116 
124  void hlt(user_data *data = nullptr) override;
125 
126 private:
127 
128  bool m_vmcs_launched;
129 
130 protected:
131 
132  std::unique_ptr<vmxon_intel_x64> m_vmxon;
133  std::unique_ptr<vmcs_intel_x64> m_vmcs;
134  std::unique_ptr<exit_handler_intel_x64> m_exit_handler;
135  std::unique_ptr<state_save_intel_x64> m_state_save;
136  std::unique_ptr<vmcs_intel_x64_state> m_vmm_state;
137  std::unique_ptr<vmcs_intel_x64_state> m_guest_state;
138 
139 public:
140 
141  vcpu_intel_x64(vcpu_intel_x64 &&) = default;
142  vcpu_intel_x64 &operator=(vcpu_intel_x64 &&) = default;
143 
144  vcpu_intel_x64(const vcpu_intel_x64 &) = delete;
145  vcpu_intel_x64 &operator=(const vcpu_intel_x64 &) = delete;
146 };
147 
148 #endif
uint64_t type
Definition: vcpuid.h:31
std::unique_ptr< vmcs_intel_x64_state > m_vmm_state
int64_t unsigned long void * data
void exit_handler(exit_handler_intel_x64 *exit_handler) noexcept
vcpu_intel_x64(vcpuid::type id, std::unique_ptr< debug_ring > debug_ring=nullptr, std::unique_ptr< vmxon_intel_x64 > vmxon=nullptr, std::unique_ptr< vmcs_intel_x64 > vmcs=nullptr, std::unique_ptr< exit_handler_intel_x64 > exit_handler=nullptr, std::unique_ptr< vmcs_intel_x64_state > vmm_state=nullptr, std::unique_ptr< vmcs_intel_x64_state > guest_state=nullptr)
std::unique_ptr< vmcs_intel_x64_state > m_guest_state
std::unique_ptr< vmxon_intel_x64 > m_vmxon
Definition: vcpu.h:94
void run(user_data *data=nullptr) override
std::unique_ptr< state_save_intel_x64 > m_state_save
std::unique_ptr< exit_handler_intel_x64 > m_exit_handler
void init(user_data *data=nullptr) override
void fini(user_data *data=nullptr) override
~vcpu_intel_x64() override=default
void hlt(user_data *data=nullptr) override
std::unique_ptr< vmcs_intel_x64 > m_vmcs
vcpu_intel_x64 & operator=(vcpu_intel_x64 &&)=default