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.


87a8a7e5a27769e11c3a51b68e11ba2af2c7338f
[palacios.git] / palacios / include / palacios / vmm_msr.h
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 #ifndef __VMM_MSR_H__
21 #define __VMM_MSR_H__
22
23
24 #ifdef __V3VEE__
25
26 #include <palacios/vmm_types.h>
27 #include <palacios/vmm_list.h>
28
29 #define SYSENTER_CS_MSR 0x00000174
30 #define SYSENTER_ESP_MSR 0x00000175
31 #define SYSENTER_EIP_MSR 0x00000176
32 #define EFER_MSR 0xc0000080
33 #define IA32_STAR_MSR 0xc0000081
34 #define IA32_LSTAR_MSR 0xc0000082
35 #define IA32_CSTAR_MSR 0xc0000083 
36 #define IA32_FMASK_MSR 0xc0000084
37 #define FS_BASE_MSR 0xc0000100
38 #define GS_BASE_MSR 0xc0000101
39 #define IA32_KERN_GS_BASE_MSR 0xc0000102
40
41
42 struct guest_info;
43 struct v3_vm_info;
44
45 struct v3_msr {
46
47     union {
48         uint64_t value;
49
50         struct {
51             uint32_t lo;
52             uint32_t hi;
53         } __attribute__((packed));
54     } __attribute__((packed));
55 } __attribute__((packed));
56
57
58 typedef struct v3_msr v3_msr_t;
59
60 struct v3_msr_hook {
61     uint32_t msr;
62   
63     int (*read)(struct guest_info * core, uint32_t msr, struct v3_msr * dst, void * priv_data);
64     int (*write)(struct guest_info * core, uint32_t msr, struct v3_msr src, void * priv_data);
65
66     void * priv_data;
67
68     struct list_head link;
69 };
70
71
72
73 struct v3_msr_hook;
74
75 struct v3_msr_map {
76     uint_t num_hooks;
77     struct list_head hook_list;
78
79     int (*update_map)(struct v3_vm_info * vm, uint32_t msr, int hook_read, int hook_write);
80     void * arch_data;
81
82 };
83
84
85 void v3_init_msr_map(struct v3_vm_info * vm);
86 int v3_deinit_msr_map(struct v3_vm_info * vm);
87
88 int v3_unhook_msr(struct v3_vm_info * vm, uint32_t msr);
89
90 int v3_hook_msr(struct v3_vm_info * vm, uint32_t msr,
91                 int (*read)(struct guest_info * core, uint32_t msr, struct v3_msr * dst, void * priv_data),
92                 int (*write)(struct guest_info * core, uint32_t msr, struct v3_msr src, void * priv_data), 
93                 void * priv_data);
94
95
96 struct v3_msr_hook * v3_get_msr_hook(struct v3_vm_info * vm, uint32_t msr);
97
98 void v3_refresh_msr_map(struct v3_vm_info * vm);
99
100 void v3_print_msr_map(struct v3_vm_info * vm);
101
102 int v3_handle_msr_write(struct guest_info * info);
103
104 int v3_handle_msr_read(struct guest_info * info);
105
106
107
108 #endif // ! __V3VEE__
109
110 #endif