#include <palacios/svm_halt.h>
#include <palacios/svm_pause.h>
#include <palacios/vmm_intr.h>
-
+#include <palacios/vmm_emulator.h>
int handle_svm_exit(struct guest_info * info) {
vmcb_ctrl_t * guest_ctrl = 0;
info->ctrl_regs.cr4 = guest_state->cr4;
info->ctrl_regs.cr8 = guest_ctrl->guest_ctrl.V_TPR;
info->ctrl_regs.rflags = guest_state->rflags;
+ info->ctrl_regs.efer = guest_state->efer;
get_vmcb_segments((vmcb_t*)(info->vmm_data), &(info->segments));
+ info->cpu_mode = get_cpu_mode(info);
+ info->mem_mode = get_mem_mode(info);
exit_code = guest_ctrl->exit_code;
if (handle_svm_pause(info) == -1) {
return -1;
}
+ } else if (exit_code == VMEXIT_VMMCALL) {
+ PrintDebug("VMMCALL\n");
+ if (info->run_state == VM_EMULATING) {
+ if (v3_emulation_exit_handler(info) == -1) {
+ return -1;
+ }
+ } else {
+ PrintError("VMMCALL with not emulator...\n");
+ return -1;
+ }
+
} else {
addr_t rip_addr;
char buf[15];
return -1;
}
+ } else {
+#ifdef DEBUG_INTERRUPTS
+ PrintDebug("No interrupts/exceptions pending\n");
+#endif
}
-
guest_state->cr0 = info->ctrl_regs.cr0;
guest_state->cr2 = info->ctrl_regs.cr2;
guest_state->cr3 = info->ctrl_regs.cr3;
guest_state->cr4 = info->ctrl_regs.cr4;
guest_ctrl->guest_ctrl.V_TPR = info->ctrl_regs.cr8 & 0xff;
guest_state->rflags = info->ctrl_regs.rflags;
-
+ guest_state->efer = info->ctrl_regs.efer;
guest_state->cpl = info->cpl;