vmcs_intel_x64.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 
24 #include <constants.h>
25 #include <thread_context.h>
28 
29 #include <vmcs/vmcs_intel_x64.h>
44 
45 using namespace x64;
46 using namespace intel_x64;
47 using namespace vmcs;
48 
50  m_vmcs_region_phys(0),
51  m_state_save(nullptr)
52 { }
53 
54 void
55 vmcs_intel_x64::launch(gsl::not_null<vmcs_intel_x64_state *> host_state,
56  gsl::not_null<vmcs_intel_x64_state *> guest_state)
57 {
58  this->create_vmcs_region();
59 
60  auto ___ = gsl::on_failure([&]
61  { this->release_vmcs_region(); });
62 
64 
65  auto ___ = gsl::on_failure([&]
66  { this->release_exit_handler_stack(); });
67 
68  this->clear();
69  this->load();
70  this->write_fields(host_state, guest_state);
71 
72  auto ___ = gsl::on_failure([&]
73  { vmcs::debug::dump(); });
74 
75  auto ___ = gsl::on_failure([&]
76  { vmcs::check::all(); });
77 
78  if (guest_state->is_guest())
79  {
81  throw std::runtime_error("vmcs resume failed");
82  }
83  else
84  {
86  }
87 }
88 
89 void
91 {
92  vmcs_promote(vmcs::host_gs_base::get());
93  throw std::runtime_error("vmcs promote failed");
94 }
95 
96 void
98 {
100  throw std::runtime_error("vmcs resume failed");
101 }
102 
103 void
106 
107 void
110 
111 void
113 {
114  auto ___ = gsl::on_failure([&]
115  { this->release_vmcs_region(); });
116 
117  m_vmcs_region = std::make_unique<uint32_t[]>(1024);
118  m_vmcs_region_phys = g_mm->virtptr_to_physint(m_vmcs_region.get());
119 
120  gsl::span<uint32_t> id{m_vmcs_region.get(), 1024};
121  id[0] = gsl::narrow<uint32_t>(msrs::ia32_vmx_basic::revision_id::get());
122 }
123 
124 void
126 {
127  m_vmcs_region.reset();
128  m_vmcs_region_phys = 0;
129 }
130 
131 void
133 { m_exit_handler_stack = std::make_unique<char[]>(STACK_SIZE * 2); }
134 
135 void
137 { m_exit_handler_stack.reset(); }
138 
139 void
140 vmcs_intel_x64::write_fields(gsl::not_null<vmcs_intel_x64_state *> host_state,
141  gsl::not_null<vmcs_intel_x64_state *> guest_state)
142 {
143  this->write_16bit_guest_state(guest_state);
144  this->write_64bit_guest_state(guest_state);
145  this->write_32bit_guest_state(guest_state);
146  this->write_natural_guest_state(guest_state);
147 
148  this->write_16bit_control_state(host_state);
149  this->write_64bit_control_state(host_state);
150  this->write_32bit_control_state(host_state);
151  this->write_natural_control_state(host_state);
152 
153  this->write_16bit_host_state(host_state);
154  this->write_64bit_host_state(host_state);
155  this->write_32bit_host_state(host_state);
156  this->write_natural_host_state(host_state);
157 
161  this->vm_exit_controls();
162  this->vm_entry_controls();
163 }
164 
165 void
166 vmcs_intel_x64::write_16bit_control_state(gsl::not_null<vmcs_intel_x64_state *> state)
167 {
168  (void) state;
169 
170  // unused: VMCS_VIRTUAL_PROCESSOR_IDENTIFIER
171  // unused: VMCS_POSTED_INTERRUPT_NOTIFICATION_VECTOR
172  // unused: VMCS_EPTP_INDEX
173 }
174 
175 void
176 vmcs_intel_x64::write_64bit_control_state(gsl::not_null<vmcs_intel_x64_state *> state)
177 {
178  (void) state;
179 
180  // unused: VMCS_ADDRESS_OF_IO_BITMAP_A
181  // unused: VMCS_ADDRESS_OF_IO_BITMAP_B
182  // unused: VMCS_ADDRESS_OF_MSR_BITMAPS
183  // unused: VMCS_VM_EXIT_MSR_STORE_ADDRESS
184  // unused: VMCS_VM_EXIT_MSR_LOAD_ADDRESS
185  // unused: VMCS_VM_ENTRY_MSR_LOAD_ADDRESS
186  // unused: VMCS_EXECUTIVE_VMCS_POINTER
187  // unused: VMCS_TSC_OFFSET
188  // unused: VMCS_VIRTUAL_APIC_ADDRESS
189  // unused: VMCS_APIC_ACCESS_ADDRESS
190  // unused: VMCS_POSTED_INTERRUPT_DESCRIPTOR_ADDRESS
191  // unused: VMCS_VM_FUNCTION_CONTROLS
192  // unused: VMCS_EPT_POINTER
193  // unused: VMCS_EOI_EXIT_BITMAP_0
194  // unused: VMCS_EOI_EXIT_BITMAP_1
195  // unused: VMCS_EOI_EXIT_BITMAP_2
196  // unused: VMCS_EOI_EXIT_BITMAP_3
197  // unused: VMCS_EPTP_LIST_ADDRESS
198  // unused: VMCS_VMREAD_BITMAP_ADDRESS
199  // unused: VMCS_VMWRITE_BITMAP_ADDRESS
200  // unused: VMCS_VIRTUALIZATION_EXCEPTION_INFORMATION_ADDRESS
201  // unused: VMCS_XSS_EXITING_BITMAP
202 }
203 
204 void
205 vmcs_intel_x64::write_32bit_control_state(gsl::not_null<vmcs_intel_x64_state *> state)
206 {
207  (void) state;
208 
211 
212  auto ia32_vmx_pinbased_ctls_msr = msrs::ia32_vmx_true_pinbased_ctls::get();
213  auto ia32_vmx_procbased_ctls_msr = msrs::ia32_vmx_true_procbased_ctls::get();
214  auto ia32_vmx_exit_ctls_msr = msrs::ia32_vmx_true_exit_ctls::get();
215  auto ia32_vmx_entry_ctls_msr = msrs::ia32_vmx_true_entry_ctls::get();
216 
217  lower = ((ia32_vmx_pinbased_ctls_msr >> 0) & 0x00000000FFFFFFFF);
218  upper = ((ia32_vmx_pinbased_ctls_msr >> 32) & 0x00000000FFFFFFFF);
220 
221  lower = ((ia32_vmx_procbased_ctls_msr >> 0) & 0x00000000FFFFFFFF);
222  upper = ((ia32_vmx_procbased_ctls_msr >> 32) & 0x00000000FFFFFFFF);
224 
225  lower = ((ia32_vmx_exit_ctls_msr >> 0) & 0x00000000FFFFFFFF);
226  upper = ((ia32_vmx_exit_ctls_msr >> 32) & 0x00000000FFFFFFFF);
227  vm_exit_controls::set(lower & upper);
228 
229  lower = ((ia32_vmx_entry_ctls_msr >> 0) & 0x00000000FFFFFFFF);
230  upper = ((ia32_vmx_entry_ctls_msr >> 32) & 0x00000000FFFFFFFF);
231  vm_entry_controls::set(lower & upper);
232 
233  // unused: VMCS_EXCEPTION_BITMAP
234  // unused: VMCS_PAGE_FAULT_ERROR_CODE_MASK
235  // unused: VMCS_PAGE_FAULT_ERROR_CODE_MATCH
236  // unused: VMCS_CR3_TARGET_COUNT
237  // unused: VMCS_VM_EXIT_MSR_STORE_COUNT
238  // unused: VMCS_VM_EXIT_MSR_LOAD_COUNT
239  // unused: VMCS_VM_ENTRY_MSR_LOAD_COUNT
240  // unused: VMCS_VM_ENTRY_INTERRUPTION_INFORMATION_FIELD
241  // unused: VMCS_VM_ENTRY_EXCEPTION_ERROR_CODE
242  // unused: VMCS_VM_ENTRY_INSTRUCTION_LENGTH
243  // unused: VMCS_TPR_THRESHOLD
244  // unused: VMCS_SECONDARY_PROCESSOR_BASED_VM_EXECUTION_CONTROLS
245  // unused: VMCS_PLE_GAP
246  // unused: VMCS_PLE_WINDOW
247 }
248 
249 void
250 vmcs_intel_x64::write_natural_control_state(gsl::not_null<vmcs_intel_x64_state *> state)
251 {
252  (void) state;
253 
254  // unused: VMCS_CR0_GUEST_HOST_MASK
255  // unused: VMCS_CR4_GUEST_HOST_MASK
256  // unused: VMCS_CR0_READ_SHADOW
257  // unused: VMCS_CR4_READ_SHADOW
258  // unused: VMCS_CR3_TARGET_VALUE_0
259  // unused: VMCS_CR3_TARGET_VALUE_1
260  // unused: VMCS_CR3_TARGET_VALUE_2
261  // unused: VMCS_CR3_TARGET_VALUE_3
262 }
263 
264 void
265 vmcs_intel_x64::write_16bit_guest_state(gsl::not_null<vmcs_intel_x64_state *> state)
266 {
267  vmcs::guest_es_selector::set(state->es());
268  vmcs::guest_cs_selector::set(state->cs());
269  vmcs::guest_ss_selector::set(state->ss());
270  vmcs::guest_ds_selector::set(state->ds());
271  vmcs::guest_fs_selector::set(state->fs());
272  vmcs::guest_gs_selector::set(state->gs());
273  vmcs::guest_ldtr_selector::set(state->ldtr());
274  vmcs::guest_tr_selector::set(state->tr());
275 
276  // unused: VMCS_GUEST_INTERRUPT_STATUS
277 }
278 
279 void
280 vmcs_intel_x64::write_64bit_guest_state(gsl::not_null<vmcs_intel_x64_state *> state)
281 {
282  vmcs::vmcs_link_pointer::set(0xFFFFFFFFFFFFFFFF);
283  vmcs::guest_ia32_debugctl::set(state->ia32_debugctl_msr());
284  vmcs::guest_ia32_pat::set(state->ia32_pat_msr());
285  vmcs::guest_ia32_efer::set(state->ia32_efer_msr());
286  vmcs::guest_ia32_perf_global_ctrl::set_if_exists(state->ia32_perf_global_ctrl_msr());
287 
288  // unused: VMCS_GUEST_PDPTE0
289  // unused: VMCS_GUEST_PDPTE1
290  // unused: VMCS_GUEST_PDPTE2
291  // unused: VMCS_GUEST_PDPTE3
292 }
293 
294 void
295 vmcs_intel_x64::write_32bit_guest_state(gsl::not_null<vmcs_intel_x64_state *> state)
296 {
297  vmcs::guest_es_limit::set(state->es_limit());
298  vmcs::guest_cs_limit::set(state->cs_limit());
299  vmcs::guest_ss_limit::set(state->ss_limit());
300  vmcs::guest_ds_limit::set(state->ds_limit());
301  vmcs::guest_fs_limit::set(state->fs_limit());
302  vmcs::guest_gs_limit::set(state->gs_limit());
303  vmcs::guest_ldtr_limit::set(state->ldtr_limit());
304  vmcs::guest_tr_limit::set(state->tr_limit());
305 
306  vmcs::guest_gdtr_limit::set(state->gdt_limit());
307  vmcs::guest_idtr_limit::set(state->idt_limit());
308 
309  vmcs::guest_es_access_rights::set(state->es_access_rights());
310  vmcs::guest_cs_access_rights::set(state->cs_access_rights());
311  vmcs::guest_ss_access_rights::set(state->ss_access_rights());
312  vmcs::guest_ds_access_rights::set(state->ds_access_rights());
313  vmcs::guest_fs_access_rights::set(state->fs_access_rights());
314  vmcs::guest_gs_access_rights::set(state->gs_access_rights());
315  vmcs::guest_ldtr_access_rights::set(state->ldtr_access_rights());
316  vmcs::guest_tr_access_rights::set(state->tr_access_rights());
317 
318  vmcs::guest_ia32_sysenter_cs::set(state->ia32_sysenter_cs_msr());
319 
320  // unused: VMCS_GUEST_INTERRUPTIBILITY_STATE
321  // unused: VMCS_GUEST_ACTIVITY_STATE
322  // unused: VMCS_GUEST_SMBASE
323  // unused: VMCS_VMX_PREEMPTION_TIMER_VALUE
324 }
325 
326 void
327 vmcs_intel_x64::write_natural_guest_state(gsl::not_null<vmcs_intel_x64_state *> state)
328 {
329  vmcs::guest_cr0::set(state->cr0());
330  vmcs::guest_cr3::set(state->cr3());
331  vmcs::guest_cr4::set(state->cr4());
332 
333  vmcs::guest_es_base::set(state->es_base());
334  vmcs::guest_cs_base::set(state->cs_base());
335  vmcs::guest_ss_base::set(state->ss_base());
336  vmcs::guest_ds_base::set(state->ds_base());
337  vmcs::guest_fs_base::set(state->ia32_fs_base_msr());
338  vmcs::guest_gs_base::set(state->ia32_gs_base_msr());
339  vmcs::guest_ldtr_base::set(state->ldtr_base());
340  vmcs::guest_tr_base::set(state->tr_base());
341 
342  vmcs::guest_gdtr_base::set(state->gdt_base());
343  vmcs::guest_idtr_base::set(state->idt_base());
344 
345  vmcs::guest_dr7::set(state->dr7());
346  vmcs::guest_rflags::set(state->rflags());
347 
348  vmcs::guest_ia32_sysenter_esp::set(state->ia32_sysenter_esp_msr());
349  vmcs::guest_ia32_sysenter_eip::set(state->ia32_sysenter_eip_msr());
350 
351  // unused: VMCS_GUEST_RSP, see m_intrinsics->vmlaunch()
352  // unused: VMCS_GUEST_RIP, see m_intrinsics->vmlaunch()
353  // unused: VMCS_GUEST_PENDING_DEBUG_EXCEPTIONS
354 }
355 
356 void
357 vmcs_intel_x64::write_16bit_host_state(gsl::not_null<vmcs_intel_x64_state *> state)
358 {
359  vmcs::host_es_selector::set(state->es());
360  vmcs::host_cs_selector::set(state->cs());
361  vmcs::host_ss_selector::set(state->ss());
362  vmcs::host_ds_selector::set(state->ds());
363  vmcs::host_fs_selector::set(state->fs());
364  vmcs::host_gs_selector::set(state->gs());
365  vmcs::host_tr_selector::set(state->tr());
366 }
367 
368 void
369 vmcs_intel_x64::write_64bit_host_state(gsl::not_null<vmcs_intel_x64_state *> state)
370 {
371  vmcs::host_ia32_pat::set(state->ia32_pat_msr());
372  vmcs::host_ia32_efer::set(state->ia32_efer_msr());
373  vmcs::host_ia32_perf_global_ctrl::set_if_exists(state->ia32_perf_global_ctrl_msr());
374 }
375 
376 void
377 vmcs_intel_x64::write_32bit_host_state(gsl::not_null<vmcs_intel_x64_state *> state)
378 {
379  vmcs::host_ia32_sysenter_cs::set(state->ia32_sysenter_cs_msr());
380 }
381 
382 void
383 vmcs_intel_x64::write_natural_host_state(gsl::not_null<vmcs_intel_x64_state *> state)
384 {
385  auto exit_handler_stack = reinterpret_cast<uintptr_t>(m_exit_handler_stack.get());
386 
387  auto stack_top = exit_handler_stack + (STACK_SIZE * 2);
388  stack_top = (stack_top & ~(STACK_SIZE - 1)) - 1;
389  exit_handler_stack = stack_top - sizeof(thread_context_t) - 1;
390 
391  auto tc = reinterpret_cast<thread_context_t *>(stack_top - sizeof(thread_context_t));
392  tc->cpuid = thread_context_cpuid();
393  tc->tlsptr = thread_context_tlsptr();
394 
395  vmcs::host_cr0::set(state->cr0());
396  vmcs::host_cr3::set(state->cr3());
397  vmcs::host_cr4::set(state->cr4());
398 
399  vmcs::host_fs_base::set(state->ia32_fs_base_msr());
400  vmcs::host_gs_base::set(reinterpret_cast<uintptr_t>(m_state_save));
401  vmcs::host_tr_base::set(state->tr_base());
402 
403  vmcs::host_gdtr_base::set(state->gdt_base());
404  vmcs::host_idtr_base::set(state->idt_base());
405 
406  vmcs::host_ia32_sysenter_esp::set(state->ia32_sysenter_esp_msr());
407  vmcs::host_ia32_sysenter_eip::set(state->ia32_sysenter_eip_msr());
408 
409  vmcs::host_rsp::set(reinterpret_cast<uintptr_t>(exit_handler_stack));
410  vmcs::host_rip::set(reinterpret_cast<uintptr_t>(exit_handler_entry));
411 }
412 
413 void
415 {
416  // pin_based_vm_execution_controls::external_interrupt_exiting::enable();
417  // pin_based_vm_execution_controls::nmi_exiting::enable();
418  // pin_based_vm_execution_controls::virtual_nmis::enable();
419  // pin_based_vm_execution_controls::activate_vmx_preemption_timer::enable();
420  // pin_based_vm_execution_controls::process_posted_interrupts::enable();
421 }
422 
423 void
425 {
426  // primary_processor_based_vm_execution_controls::interrupt_window_exiting::enable();
427  // primary_processor_based_vm_execution_controls::use_tsc_offsetting::enable();
428  // primary_processor_based_vm_execution_controls::hlt_exiting::enable();
429  // primary_processor_based_vm_execution_controls::invlpg_exiting::enable();
430  // primary_processor_based_vm_execution_controls::mwait_exiting::enable();
431  // primary_processor_based_vm_execution_controls::rdpmc_exiting::enable();
432  // primary_processor_based_vm_execution_controls::rdtsc_exiting::enable();
433  // primary_processor_based_vm_execution_controls::cr3_load_exiting::enable();
434  // primary_processor_based_vm_execution_controls::cr3_store_exiting::enable();
435  // primary_processor_based_vm_execution_controls::cr8_load_exiting::enable();
436  // primary_processor_based_vm_execution_controls::cr8_store_exiting::enable();
437  // primary_processor_based_vm_execution_controls::use_tpr_shadow::enable();
438  // primary_processor_based_vm_execution_controls::nmi_window_exiting::enable();
439  // primary_processor_based_vm_execution_controls::mov_dr_exiting::enable();
440  // primary_processor_based_vm_execution_controls::unconditional_io_exiting::enable();
441  // primary_processor_based_vm_execution_controls::use_io_bitmaps::enable();
442  // primary_processor_based_vm_execution_controls::monitor_trap_flag::enable();
443  // primary_processor_based_vm_execution_controls::use_msr_bitmaps::enable();
444  // primary_processor_based_vm_execution_controls::monitor_exiting::enable();
445  // primary_processor_based_vm_execution_controls::pause_exiting::enable();
447 }
448 
449 void
451 {
452  bool verbose = SECONDARY_ENABLE_IF_VERBOSE;
453 
454  // secondary_processor_based_vm_execution_controls::virtualize_apic_accesses::enable_if_allowed(verbose);
455  // secondary_processor_based_vm_execution_controls::enable_ept::enable_if_allowed(verbose);
456  // secondary_processor_based_vm_execution_controls::descriptor_table_exiting::enable_if_allowed(verbose);
458  // secondary_processor_based_vm_execution_controls::virtualize_x2apic_mode::enable_if_allowed(verbose);
459  // secondary_processor_based_vm_execution_controls::enable_vpid::enable_if_allowed(verbose);
460  // secondary_processor_based_vm_execution_controls::wbinvd_exiting::enable_if_allowed(verbose);
461  // secondary_processor_based_vm_execution_controls::unrestricted_guest::enable_if_allowed(verbose);
462  // secondary_processor_based_vm_execution_controls::apic_register_virtualization::enable_if_allowed(verbose);
463  // secondary_processor_based_vm_execution_controls::virtual_interrupt_delivery::enable_if_allowed(verbose);
464  // secondary_processor_based_vm_execution_controls::pause_loop_exiting::enable_if_allowed(verbose);
465  // secondary_processor_based_vm_execution_controls::rdrand_exiting::enable_if_allowed(verbose);
467  // secondary_processor_based_vm_execution_controls::enable_vm_functions::enable_if_allowed(verbose);
468  // secondary_processor_based_vm_execution_controls::vmcs_shadowing::enable_if_allowed(verbose);
469  // secondary_processor_based_vm_execution_controls::rdseed_exiting::enable_if_allowed(verbose);
470  // secondary_processor_based_vm_execution_controls::ept_violation_ve::enable_if_allowed(verbose);
472 }
473 
474 void
476 {
477  bool verbose = SECONDARY_ENABLE_IF_VERBOSE;
478 
482 
483  // vm_exit_controls::acknowledge_interrupt_on_exit::enable();
488  // vm_exit_controls::save_vmx_preemption_timer_value::enable();
489 }
490 
491 void
493 {
494  bool verbose = SECONDARY_ENABLE_IF_VERBOSE;
495 
498  // vm_entry_controls::entry_to_smm::enable();
499  // vm_entry_controls::deactivate_dual_monitor_treatment::enable();
501 
504 }
virtual void launch(gsl::not_null< vmcs_intel_x64_state *> host_state, gsl::not_null< vmcs_intel_x64_state *> guest_state)
void release_vmcs_region() noexcept
std::unique_ptr< uint32_t[]> m_vmcs_region
void write_32bit_control_state(gsl::not_null< vmcs_intel_x64_state *> state)
void write_natural_guest_state(gsl::not_null< vmcs_intel_x64_state *> state)
void exit_handler_entry(void)
void create_exit_handler_stack()
void release_exit_handler_stack() noexcept
void write_64bit_control_state(gsl::not_null< vmcs_intel_x64_state *> state)
uint64_t thread_context_cpuid(void)
void write_64bit_host_state(gsl::not_null< vmcs_intel_x64_state *> state)
void vmcs_promote(uintptr_t state_save)
#define SECONDARY_ENABLE_IF_VERBOSE
Definition: constants.h:336
auto upper(T ptr) noexcept
Definition: upper_lower.h:55
virtual void promote()
void vmcs_resume(state_save_intel_x64 *state_save)
virtual void resume()
void clear(gsl::not_null< void *> ptr)
void uint64_t uint64_t uint64_t *rdx noexcept
void secondary_processor_based_vm_execution_controls()
void write_64bit_guest_state(gsl::not_null< vmcs_intel_x64_state *> state)
void pin_based_vm_execution_controls()
std::unique_ptr< char[]> m_exit_handler_stack
state_save_intel_x64 * m_state_save
void primary_processor_based_vm_execution_controls()
virtual void load()
#define g_mm
virtual void clear()
void write_16bit_control_state(gsl::not_null< vmcs_intel_x64_state *> state)
virtual void write_fields(gsl::not_null< vmcs_intel_x64_state *> host_state, gsl::not_null< vmcs_intel_x64_state *> guest_state)
void write_32bit_host_state(gsl::not_null< vmcs_intel_x64_state *> state)
void launch_demote()
void write_16bit_guest_state(gsl::not_null< vmcs_intel_x64_state *> state)
uintptr_t m_vmcs_region_phys
#define STACK_SIZE
Definition: constants.h:225
uint64_t thread_context_tlsptr(void)
void write_natural_host_state(gsl::not_null< vmcs_intel_x64_state *> state)
auto lower(T ptr) noexcept
Definition: upper_lower.h:36
void write_16bit_host_state(gsl::not_null< vmcs_intel_x64_state *> state)
void set(T val) noexcept
Definition: crs_intel_x64.h:52
void write_natural_control_state(gsl::not_null< vmcs_intel_x64_state *> state)
Definition: cache_x64.h:31
void write_32bit_guest_state(gsl::not_null< vmcs_intel_x64_state *> state)
uint64_t value_type
void vmcs_launch(state_save_intel_x64 *state_save)