2 * This file is part of the Palacios Virtual Machine Monitor developed
3 * by the V3VEE Project with funding from the United States National
4 * Science Foundation and the Department of Energy.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu>
11 * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Jack Lange <jarusl@cs.northwestern.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
20 #include <palacios/vmm.h>
21 #include <palacios/svm.h>
22 #include <palacios/vmx.h>
23 #include <palacios/vmm_intr.h>
24 #include <palacios/vmm_config.h>
25 #include <palacios/vm_guest.h>
26 #include <palacios/vmm_instrument.h>
27 #include <palacios/vmm_ctrl_regs.h>
28 #include <palacios/vmm_lowlevel.h>
31 /* These should be the only global variables in Palacios */
32 /* They are architecture specific variables */
33 v3_cpu_arch_t v3_cpu_type;
34 struct v3_os_hooks * os_hooks = NULL;
38 static struct guest_info * allocate_guest() {
39 void * info = V3_Malloc(sizeof(struct guest_info));
40 memset(info, 0, sizeof(struct guest_info));
46 void Init_V3(struct v3_os_hooks * hooks, struct v3_ctrl_ops * vmm_ops) {
48 // Set global variables.
50 v3_cpu_type = V3_INVALID_CPU;
54 v3_init_instrumentation();
57 if (v3_is_svm_capable()) {
59 PrintDebug("Machine is SVM Capable\n");
60 vmm_ops->allocate_guest = &allocate_guest;
64 } else if (is_vmx_capable()) {
65 vmm_cpu_type = VMM_VMX_CPU;
66 PrintDebug("Machine is VMX Capable\n");
69 PrintDebug("CPU has no virtualization Extensions\n");
77 v3_cpu_mode_t v3_get_host_cpu_mode() {
87 cr4 = (struct cr4_32 *)&(cr4_val);
98 v3_cpu_mode_t v3_get_host_cpu_mode() {