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) 2012, Jack Lange <jarusl@cs.northwestern.edu>
11 * Copyright (c) 2012, 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".
21 #include <palacios/vmm.h>
22 #include <palacios/vmcb.h>
23 #include <palacios/vmm_exits.h>
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));
33 ctrl_area->instrs.RDTSC = 1;
36 ctrl_area->svm_instrs.RDTSCP = 1;
40 PrintError(core->vm_info, core, "Unhandled Exit Type (%d)\n", exit_type);
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));
54 ctrl_area->instrs.RDTSC = 0;
57 ctrl_area->svm_instrs.RDTSCP = 0;
61 PrintError(core->vm_info, core, "Unhandled Exit Type (%d)\n", exit_type);
70 int v3_init_svm_exits(struct v3_vm_info * vm) {
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);