#include <palacios/vmm_cpuid.h>
#include <palacios/vmm_direct_paging.h>
+#ifndef CONFIG_DEBUG_SVM
+#undef PrintDebug
+#define PrintDebug(fmt, args...)
+#endif
#ifdef CONFIG_TELEMETRY
#include <palacios/vmm_telemetry.h>
#endif
+
int v3_handle_svm_exit(struct guest_info * info, addr_t exit_code, addr_t exit_info1, addr_t exit_info2) {
#ifdef CONFIG_TELEMETRY
- if (info->enable_telemetry) {
+ if (info->vm_info->enable_telemetry) {
v3_telemetry_start_exit(info);
}
#endif
info->rip += 3;
if (v3_handle_hypercall(info) == -1) {
+ PrintError("Error handling Hypercall\n");
return -1;
}
-
+
break;
case VMEXIT_INTR:
// handled by interrupt dispatch earlier
return -1;
}
break;
-
+ case VMEXIT_RDTSC:
+#ifdef CONFIG_DEBUG_TIME
+ PrintDebug("RDTSC/RDTSCP\n");
+#endif
+ if (v3_handle_rdtsc(info) == -1) {
+ PrintError("Error Handling RDTSC instruction\n");
+ return -1;
+ }
+ break;
+ case VMEXIT_RDTSCP:
+#ifdef CONFIG_DEBUG_TIME
+ PrintDebug("RDTSCP\n");
+#endif
+ if (v3_handle_rdtscp(info) == -1) {
+ PrintError("Error Handling RDTSCP instruction\n");
+ return -1;
+ }
+ break;
+ case VMEXIT_SHUTDOWN:
+ PrintDebug("Guest-initiated shutdown\n");
+
+ info->vm_info->run_state = VM_STOPPED;
+ // Force exit on other cores
+ break;
/* Exits Following this line are NOT HANDLED */
addr_t rip_addr;
- PrintDebug("Unhandled SVM Exit: %s\n", vmexit_code_to_str(exit_code));
+ PrintError("Unhandled SVM Exit: %s\n", vmexit_code_to_str(exit_code));
rip_addr = get_addr_linear(info, info->rip, &(info->segments.cs));
// END OF SWITCH (EXIT_CODE)
#ifdef CONFIG_TELEMETRY
- if (info->enable_telemetry) {
+ if (info->vm_info->enable_telemetry) {
v3_telemetry_end_exit(info, exit_code);
}
#endif