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 #ifndef __SVM_HANDLER_H
21 #define __SVM_HANDLER_H
25 #include <palacios/svm.h>
26 #include <palacios/vmcb.h>
27 #include <palacios/vmm.h>
31 /******************************************/
32 /* SVM Intercept Exit Codes */
33 /* AMD Arch Vol 3, Appendix C, pg 477-478 */
34 /******************************************/
35 #define VMEXIT_CR_READ_MASK 0xfffffff0
36 #define VMEXIT_CR0_READ 0x00000000
37 #define VMEXIT_CR1_READ 0x00000001
38 #define VMEXIT_CR2_READ 0x00000002
39 #define VMEXIT_CR3_READ 0x00000003
40 #define VMEXIT_CR4_READ 0x00000004
41 #define VMEXIT_CR5_READ 0x00000005
42 #define VMEXIT_CR6_READ 0x00000006
43 #define VMEXIT_CR7_READ 0x00000007
44 #define VMEXIT_CR8_READ 0x00000008
45 #define VMEXIT_CR9_READ 0x00000009
46 #define VMEXIT_CR10_READ 0x0000000a
47 #define VMEXIT_CR11_READ 0x0000000b
48 #define VMEXIT_CR12_READ 0x0000000c
49 #define VMEXIT_CR13_READ 0x0000000d
50 #define VMEXIT_CR14_READ 0x0000000e
51 #define VMEXIT_CR15_READ 0x0000000f
53 #define VMEXIT_CR_WRITE_MASK 0xffffffe0
54 #define VMEXIT_CR0_WRITE 0x00000010
55 #define VMEXIT_CR1_WRITE 0x00000011
56 #define VMEXIT_CR2_WRITE 0x00000012
57 #define VMEXIT_CR3_WRITE 0x00000013
58 #define VMEXIT_CR4_WRITE 0x00000014
59 #define VMEXIT_CR5_WRITE 0x00000015
60 #define VMEXIT_CR6_WRITE 0x00000016
61 #define VMEXIT_CR7_WRITE 0x00000017
62 #define VMEXIT_CR8_WRITE 0x00000018
63 #define VMEXIT_CR9_WRITE 0x00000019
64 #define VMEXIT_CR10_WRITE 0x0000001a
65 #define VMEXIT_CR11_WRITE 0x0000001b
66 #define VMEXIT_CR12_WRITE 0x0000001c
67 #define VMEXIT_CR13_WRITE 0x0000001d
68 #define VMEXIT_CR14_WRITE 0x0000001e
69 #define VMEXIT_CR15_WRITE 0x0000001f
71 #define VMEXIT_DR_READ_MASK 0xffffffd0
72 #define VMEXIT_DR0_READ 0x00000020
73 #define VMEXIT_DR1_READ 0x00000021
74 #define VMEXIT_DR2_READ 0x00000022
75 #define VMEXIT_DR3_READ 0x00000023
76 #define VMEXIT_DR4_READ 0x00000024
77 #define VMEXIT_DR5_READ 0x00000025
78 #define VMEXIT_DR6_READ 0x00000026
79 #define VMEXIT_DR7_READ 0x00000027
80 #define VMEXIT_DR8_READ 0x00000028
81 #define VMEXIT_DR9_READ 0x00000029
82 #define VMEXIT_DR10_READ 0x0000002a
83 #define VMEXIT_DR11_READ 0x0000002b
84 #define VMEXIT_DR12_READ 0x0000002c
85 #define VMEXIT_DR13_READ 0x0000002d
86 #define VMEXIT_DR14_READ 0x0000002e
87 #define VMEXIT_DR15_READ 0x0000002f
89 #define VMEXIT_DR_WRITE_MASK 0xffffffc0
90 #define VMEXIT_DR0_WRITE 0x00000030 // ? this was previously 3f
91 #define VMEXIT_DR1_WRITE 0x00000031
92 #define VMEXIT_DR2_WRITE 0x00000032
93 #define VMEXIT_DR3_WRITE 0x00000033
94 #define VMEXIT_DR4_WRITE 0x00000034
95 #define VMEXIT_DR5_WRITE 0x00000035
96 #define VMEXIT_DR6_WRITE 0x00000036
97 #define VMEXIT_DR7_WRITE 0x00000037
98 #define VMEXIT_DR8_WRITE 0x00000038
99 #define VMEXIT_DR9_WRITE 0x00000039
100 #define VMEXIT_DR10_WRITE 0x0000003a
101 #define VMEXIT_DR11_WRITE 0x0000003b
102 #define VMEXIT_DR12_WRITE 0x0000003c
103 #define VMEXIT_DR13_WRITE 0x0000003d
104 #define VMEXIT_DR14_WRITE 0x0000003e
105 #define VMEXIT_DR15_WRITE 0x0000003f
107 #define VMEXIT_EXCP_MASK 0xffffffa0
108 #define VMEXIT_EXCP0 0x00000040
109 #define VMEXIT_EXCP1 0x00000041
110 #define VMEXIT_EXCP2 0x00000042
111 #define VMEXIT_EXCP3 0x00000043
112 #define VMEXIT_EXCP4 0x00000044
113 #define VMEXIT_EXCP5 0x00000045
114 #define VMEXIT_EXCP6 0x00000046
115 #define VMEXIT_EXCP7 0x00000047
116 #define VMEXIT_EXCP8 0x00000048
117 #define VMEXIT_EXCP9 0x00000049
118 #define VMEXIT_EXCP10 0x0000004a
119 #define VMEXIT_EXCP11 0x0000004b
120 #define VMEXIT_EXCP12 0x0000004c
121 #define VMEXIT_EXCP13 0x0000004d
122 #define VMEXIT_EXCP14 0x0000004e
123 #define VMEXIT_EXCP15 0x0000004f
124 #define VMEXIT_EXCP16 0x00000050
125 #define VMEXIT_EXCP17 0x00000051
126 #define VMEXIT_EXCP18 0x00000052
127 #define VMEXIT_EXCP19 0x00000053
128 #define VMEXIT_EXCP20 0x00000054
129 #define VMEXIT_EXCP21 0x00000055
130 #define VMEXIT_EXCP22 0x00000056
131 #define VMEXIT_EXCP23 0x00000057
132 #define VMEXIT_EXCP24 0x00000058
133 #define VMEXIT_EXCP25 0x00000059
134 #define VMEXIT_EXCP26 0x0000005a
135 #define VMEXIT_EXCP27 0x0000005b
136 #define VMEXIT_EXCP28 0x0000005c
137 #define VMEXIT_EXCP29 0x0000005d
138 #define VMEXIT_EXCP30 0x0000005e
139 #define VMEXIT_EXCP31 0x0000005f
142 #define VMEXIT_INTR 0x00000060
143 #define VMEXIT_NMI 0x00000061
144 #define VMEXIT_SMI 0x00000062
145 #define VMEXIT_INIT 0x00000063
146 #define VMEXIT_VINITR 0x00000064
147 #define VMEXIT_CR0_SEL_WRITE 0x00000065
148 #define VMEXIT_IDTR_READ 0x00000066
149 #define VMEXIT_GDTR_READ 0x00000067
150 #define VMEXIT_LDTR_READ 0x00000068
151 #define VMEXIT_TR_READ 0x00000069
152 #define VMEXIT_IDTR_WRITE 0x0000006a
153 #define VMEXIT_GDTR_WRITE 0x0000006b
154 #define VMEXIT_LDTR_WRITE 0x0000006c
155 #define VMEXIT_TR_WRITE 0x0000006d
156 #define VMEXIT_RDTSC 0x0000006e
157 #define VMEXIT_RDPMC 0x0000006f
158 #define VMEXIT_PUSHF 0x00000070
159 #define VMEXIT_POPF 0x00000071
160 #define VMEXIT_CPUID 0x00000072
161 #define VMEXIT_RSM 0x00000073
162 #define VMEXIT_IRET 0x00000074
163 #define VMEXIT_SWINT 0x00000075
164 #define VMEXIT_INVD 0x00000076
165 #define VMEXIT_PAUSE 0x00000077
166 #define VMEXIT_HLT 0x00000078
167 #define VMEXIT_INVLPG 0x00000079
168 #define VMEXIT_INVLPGA 0x0000007a
169 #define VMEXIT_IOIO 0x0000007b
170 #define VMEXIT_MSR 0x0000007c
171 #define VMEXIT_TASK_SWITCH 0x0000007d
172 #define VMEXIT_FERR_FREEZE 0x0000007e
173 #define VMEXIT_SHUTDOWN 0x0000007f
174 #define VMEXIT_VMRUN 0x00000080
175 #define VMEXIT_VMMCALL 0x00000081
176 #define VMEXIT_VMLOAD 0x00000082
177 #define VMEXIT_VMSAVE 0x00000083
178 #define VMEXIT_STGI 0x00000084
179 #define VMEXIT_CLGI 0x00000085
180 #define VMEXIT_SKINIT 0x00000086
181 #define VMEXIT_RDTSCP 0x00000087
182 #define VMEXIT_ICEBP 0x00000088
183 #define VMEXIT_WBINVD 0x00000089
184 #define VMEXIT_MONITOR 0x0000008a
185 #define VMEXIT_MWAIT 0x0000008b
186 #define VMEXIT_MWAIT_CONDITIONAL 0x0000008c
188 #define VMEXIT_NPF 0x00000400
190 #define VMEXIT_INVALID_VMCB -1
192 /******************************************/
195 int v3_handle_svm_exit(struct guest_info * info, addr_t exit_code,
196 addr_t exit_info1, addr_t exit_info2);
197 const char * vmexit_code_to_str(uint_t exit_code);
200 #endif // ! __V3VEE__