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.


remove extraneous dos linefeeds from scheduling files
[palacios.git] / palacios / src / palacios / vmx_exits.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) 2012, Jack Lange <jarusl@cs.northwestern.edu> 
11  * Copyright (c) 2012, 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.h>
22 #include <palacios/vmcb.h>
23 #include <palacios/vmm_exits.h>
24
25
26
27 static int enable_exit(struct guest_info * core, v3_exit_type_t exit_type) {
28     vmcb_ctrl_t * ctrl_area = GET_VMCB_CTRL_AREA((vmcb_t *)(core->vmm_data));
29
30     switch (exit_type) {
31
32         case V3_EXIT_RDTSC:
33             ctrl_area->instrs.RDTSC = 1;
34             break;
35         case V3_EXIT_RDTSCP:
36             ctrl_area->svm_instrs.RDTSCP = 1;
37             break;
38
39         default:
40             PrintError(core->vm_info, core, "Unhandled Exit Type (%d)\n", exit_type);
41             return -1;
42     }
43
44     return 0;
45 }
46
47
48 static int disable_exit(struct guest_info * core, v3_exit_type_t exit_type) {
49     vmcb_ctrl_t * ctrl_area = GET_VMCB_CTRL_AREA((vmcb_t *)(core->vmm_data));
50
51     switch (exit_type) {
52
53         case V3_EXIT_RDTSC:
54             ctrl_area->instrs.RDTSC = 0;
55             break;
56         case V3_EXIT_RDTSCP:
57             ctrl_area->svm_instrs.RDTSCP = 0;
58             break;
59
60         default:
61             PrintError(core->vm_info, core, "Unhandled Exit Type (%d)\n", exit_type);
62             return -1;
63     }
64
65     return 0;
66
67 }
68
69
70 int v3_init_vmx_exits(struct v3_vm_info * vm) {
71
72     int ret = 0;
73
74     ret |= v3_register_exit(vm, V3_EXIT_RDTSC, enable_exit, disable_exit);
75     ret |= v3_register_exit(vm, V3_EXIT_RDTSCP, enable_exit, disable_exit);
76     
77     return ret;
78 }