#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
-#if 0
- if (info->cpu_id==1) {
- V3_Print("Core 1 SVM Exit: %s rip=0x%p\n", vmexit_code_to_str(exit_code), (void *) get_addr_linear(info, info->rip, &(info->segments.cs)));
- }
-#endif
//PrintDebug("SVM Returned: Exit Code: %x\n",exit_code);
switch (exit_code) {
PrintDebug("PageFault at %p (error=%d)\n",
(void *)fault_addr, *(uint_t *)error_code);
#endif
-#if 0
- if (info->cpu_id==1) {
- V3_Print("SVM Core 1: PageFault at %p (error=%d)\n",
- (void *)fault_addr, *(uint_t *)error_code);
- }
-#endif
if (info->shdw_pg_mode == SHADOW_PAGING) {
if (v3_handle_shadow_pagefault(info, fault_addr, *error_code) == -1) {
return -1;
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));