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.


c8943f0d59b644b6ce7cf1b28e7286504da8cbc0
[palacios.git] / palacios / src / palacios / vmm_symbiotic.c
1 /* 
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.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
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.
13  *
14  * Author: Jack Lange <jarusl@cs.northwestern.edu>
15  *
16  * This is free software.  You are permitted to use,
17  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
18  */
19
20
21 #include <palacios/vmm_symbiotic.h>
22 #include <palacios/vm_guest.h>
23
24
25 #define SYM_CPUID_NUM 0x90000000
26
27 static int cpuid_fn(struct guest_info * core, uint32_t cpuid, 
28                     uint32_t * eax, uint32_t * ebx,
29                     uint32_t * ecx, uint32_t * edx,
30                     void * private_data) {
31     extern v3_cpu_arch_t v3_cpu_types[];
32
33     *eax = *(uint32_t *)"V3V";
34
35     if ((v3_cpu_types[core->cpu_id] == V3_SVM_CPU) || 
36         (v3_cpu_types[core->cpu_id] == V3_SVM_REV3_CPU)) {
37         *ebx = *(uint32_t *)"SVM";
38     } else if ((v3_cpu_types[core->cpu_id] == V3_VMX_CPU) || 
39                (v3_cpu_types[core->cpu_id] == V3_VMX_EPT_CPU)) {
40         *ebx = *(uint32_t *)"VMX";
41     }
42
43
44     return 0;
45 }
46
47
48 int v3_init_symbiotic_vm(struct v3_vm_info * vm) {
49     struct v3_sym_vm_state * vm_state = &(vm->sym_vm_state);
50     memset(vm_state, 0, sizeof(struct v3_sym_vm_state));
51
52     v3_hook_cpuid(vm, SYM_CPUID_NUM, cpuid_fn, NULL);
53
54     if (v3_init_symspy_vm(vm, &(vm_state->symspy_state)) == -1) {
55         PrintError("Error initializing global SymSpy state\n");
56         return -1;
57     }
58
59 #ifdef CONFIG_SYMCALL
60     if (v3_init_symcall_vm(vm) == -1) {
61         PrintError("Error intializing global SymCall state\n");
62         return -1;
63     }
64 #endif
65
66 #ifdef CONFIG_SYMMOD
67
68 #endif
69
70
71     return 0;
72 }
73
74
75
76 int v3_init_symbiotic_core(struct guest_info * core) {
77     struct v3_sym_core_state * core_state = &(core->sym_core_state);
78     memset(core_state, 0, sizeof(struct v3_sym_core_state));
79     
80
81     if (v3_init_symspy_core(core, &(core_state->symspy_state)) == -1) {
82         PrintError("Error intializing local SymSpy state\n");
83         return -1;
84     }
85
86     return 0;
87 }