Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


enabled VMX exit hooks
Jack Lange [Fri, 27 Jul 2012 18:42:35 +0000 (14:42 -0400)]
palacios/include/palacios/vmx_exits.h [new file with mode: 0644]
palacios/src/palacios/Makefile
palacios/src/palacios/vm_guest.c
palacios/src/palacios/vmx_exits.c [new file with mode: 0644]

diff --git a/palacios/include/palacios/vmx_exits.h b/palacios/include/palacios/vmx_exits.h
new file mode 100644 (file)
index 0000000..8858f97
--- /dev/null
@@ -0,0 +1,34 @@
+/* 
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National 
+ * Science Foundation and the Department of Energy.  
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico.  You can find out more at 
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2012, Jack Lange <jarusl@cs.northwestern.edu> 
+ * Copyright (c) 2012, The V3VEE Project <http://www.v3vee.org> 
+ * All rights reserved.
+ *
+ * Author: Jack Lange <jarusl@cs.northwestern.edu>
+ *
+ * This is free software.  You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+
+
+#ifndef __VMX_EXITS_H__
+#define __VMX_EXITS_H__
+
+
+#ifdef __V3VEE__
+
+int v3_init_vmx_exits(struct v3_vm_info * vm);
+
+
+
+#endif
+
+#endif
index 5cde6ea..6d14934 100644 (file)
@@ -66,7 +66,8 @@ obj-$(V3_CONFIG_VMX) +=       vmx.o \
                                vmcs.o \
                                vmx_ctrl_regs.o \
                                vmx_assist.o \
-                               vmx_ept.o 
+                               vmx_ept.o \
+                               vmx_exits.o
 
 
 
index d94d465..dc47a46 100644 (file)
@@ -211,6 +211,7 @@ static int info_hcall(struct guest_info * core, uint_t hcall_id, void * priv_dat
 #include <palacios/vmx.h>
 #include <palacios/vmx_io.h>
 #include <palacios/vmx_msr.h>
+#include <palacios/vmx_exits.h>
 #endif
 
 
@@ -277,6 +278,7 @@ int v3_init_vm(struct v3_vm_info * vm) {
        case V3_VMX_EPT_UG_CPU:
            v3_init_vmx_io_map(vm);
            v3_init_vmx_msr_map(vm);
+           v3_init_vmx_exits(vm);
            break;
 #endif
        default:
diff --git a/palacios/src/palacios/vmx_exits.c b/palacios/src/palacios/vmx_exits.c
new file mode 100644 (file)
index 0000000..b3f5ad9
--- /dev/null
@@ -0,0 +1,78 @@
+/* 
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National 
+ * Science Foundation and the Department of Energy.  
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico.  You can find out more at 
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2012, Jack Lange <jarusl@cs.northwestern.edu> 
+ * Copyright (c) 2012, The V3VEE Project <http://www.v3vee.org> 
+ * All rights reserved.
+ *
+ * Author: Jack Lange <jarusl@cs.northwestern.edu>
+ *
+ * This is free software.  You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+
+#include <palacios/vmm.h>
+#include <palacios/vmcb.h>
+#include <palacios/vmm_exits.h>
+
+
+
+static int enable_exit(struct guest_info * core, v3_exit_type_t exit_type) {
+    vmcb_ctrl_t * ctrl_area = GET_VMCB_CTRL_AREA((vmcb_t *)(core->vmm_data));
+
+    switch (exit_type) {
+
+       case V3_EXIT_RDTSC:
+           ctrl_area->instrs.RDTSC = 1;
+           break;
+       case V3_EXIT_RDTSCP:
+           ctrl_area->svm_instrs.RDTSCP = 1;
+           break;
+
+       default:
+           PrintError("Unhandled Exit Type (%d)\n", exit_type);
+           return -1;
+    }
+
+    return 0;
+}
+
+
+static int disable_exit(struct guest_info * core, v3_exit_type_t exit_type) {
+    vmcb_ctrl_t * ctrl_area = GET_VMCB_CTRL_AREA((vmcb_t *)(core->vmm_data));
+
+    switch (exit_type) {
+
+       case V3_EXIT_RDTSC:
+           ctrl_area->instrs.RDTSC = 0;
+           break;
+       case V3_EXIT_RDTSCP:
+           ctrl_area->svm_instrs.RDTSCP = 0;
+           break;
+
+       default:
+           PrintError("Unhandled Exit Type (%d)\n", exit_type);
+           return -1;
+    }
+
+    return 0;
+
+}
+
+
+int v3_init_vmx_exits(struct v3_vm_info * vm) {
+
+    int ret = 0;
+
+    ret |= v3_register_exit(vm, V3_EXIT_RDTSC, enable_exit, disable_exit);
+    ret |= v3_register_exit(vm, V3_EXIT_RDTSCP, enable_exit, disable_exit);
+    
+    return ret;
+}