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.


Succesful transition to vmxassist, then to the bios, where it dies in keyboard init.
[palacios.git] / palacios / include / palacios / vmx_handler.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 __VMX_HANDLER_H__
21 #define __VMX_HANDLER_H__
22
23 #ifdef __V3VEE__
24
25 #include <palacios/vm_guest.h>
26
27 /******************************************/
28 /* VMX Intercept Exit Codes               */
29 /******************************************/
30 typedef enum {
31     VMEXIT_INFO_EXCEPTION_OR_NMI            = 0,
32     VMEXIT_EXTERNAL_INTR                    = 1,
33     VMEXIT_TRIPLE_FAULT                     = 2,
34     VMEXIT_INIT_SIGNAL                      = 3,
35     VMEXIT_STARTUP_IPI                      = 4,
36     VMEXIT_IO_SMI                           = 5,
37     VMEXIT_OTHER_SMI                        = 6,
38     VMEXIT_INTR_WINDOW                      = 7,
39     VMEXIT_NMI_WINDOW                       = 8,
40     VMEXIT_TASK_SWITCH                      = 9,
41     VMEXIT_CPUID                            = 10,
42     VMEXIT_HLT                              = 12,
43     VMEXIT_INVD                             = 13,
44     VMEXIT_INVLPG                           = 14,
45     VMEXIT_RDPMC                            = 15,
46     VMEXIT_RDTSC                            = 16,
47     VMEXIT_RSM                              = 17,
48     VMEXIT_VMCALL                           = 18,
49     VMEXIT_VMCLEAR                          = 19,
50     VMEXIT_VMLAUNCH                         = 20,
51     VMEXIT_VMPTRLD                          = 21,
52     VMEXIT_VMPTRST                          = 22,
53     VMEXIT_VMREAD                           = 23,
54     VMEXIT_VMRESUME                         = 24,
55     VMEXIT_VMWRITE                          = 25,
56     VMEXIT_VMXOFF                           = 26,
57     VMEXIT_VMXON                            = 27,
58     VMEXIT_CR_REG_ACCESSES                  = 28,
59     VMEXIT_MOV_DR                           = 29,
60     VMEXIT_IO_INSTR                         = 30,
61     VMEXIT_RDMSR                            = 31,
62     VMEXIT_WRMSR                            = 32,
63     VMEXIT_ENTRY_FAIL_INVALID_GUEST_STATE   = 33,
64     VMEXIT_ENTRY_FAIL_MSR_LOAD              = 34,
65     VMEXIT_MWAIT                            = 36,
66     VMEXIT_MONITOR                          = 39,
67     VMEXIT_PAUSE                            = 40,
68     VMEXIT_ENTRY_FAILURE_MACHINE_CHECK      = 41,
69     VMEXIT_TPR_BELOW_THRESHOLD              = 43,
70     VMEXIT_APIC                             = 44,
71     VMEXIT_GDTR_IDTR                        = 46,
72     VMEXIT_LDTR_TR                          = 47,
73     VMEXIT_EPT_VIOLATION                    = 48,
74     VMEXIT_EPT_CONFIG                       = 49,
75     VMEXIT_INVEPT                           = 50,
76     VMEXIT_RDTSCP                           = 51,
77     VMEXIT_EXPIRED_PREEMPT_TIMER            = 52,
78     VMEXIT_INVVPID                          = 53,
79     VMEXIT_WBINVD                           = 54,
80     VMEXIT_XSETBV                           = 55
81 } vmx_exit_t;
82
83 /* VMCS Exit QUALIFICATIONs */
84 struct vmexit_io_qual {
85     uint32_t access_size : 3; // (0: 1 Byte ;; 1: 2 Bytes ;; 3: 4 Bytes)
86     uint32_t dir        : 1; // (0: Out ;; 1: In)
87     uint32_t string     : 1; // (0: not string ;; 1: string)
88     uint32_t REP        : 1; // (0: not REP ;; 1: REP)
89     uint32_t op_enc      : 1; // (0: DX ;; 1: immediate)
90     uint32_t rsvd       : 9; // Set to 0
91     uint32_t port       : 16; // IO Port Number
92 } __attribute__((packed));
93
94
95
96 struct VMExitDBGQual {
97     uint32_t B0         : 1; // Breakpoint 0 condition met
98     uint32_t B1         : 1; // Breakpoint 1 condition met
99     uint32_t B2         : 1; // Breakpoint 2 condition met
100     uint32_t B3         : 1; // Breakpoint 3 condition met
101     uint32_t rsvd       : 9; // reserved to 0
102     uint32_t BD         : 1; // detected DBG reg access
103     uint32_t BS         : 1; // cause either single instr or taken branch
104 } __attribute__((packed));
105
106
107 struct VMExitTSQual {
108     uint32_t selector   : 16; // selector of destination TSS 
109     uint32_t rsvd       : 14; // reserved to 0
110     uint32_t src        : 2; // (0: CALL ; 1: IRET ; 2: JMP ; 3: Task gate in IDT)
111 } __attribute__((packed));
112
113 struct vmexit_cr_qual {
114     uint32_t cr_id       : 4; // cr number (0 for CLTS and LMSW) (bit 3 always 0, on 32bit)
115     uint32_t access_type : 2; // (0: MOV to CR ; 1: MOV from CR ; 2: CLTS ; 3: LMSW)
116     uint32_t lmsw_op_type : 1; // (0: register ; 1: memory)
117     uint32_t rsvd1      : 1; // reserved to 0
118     uint32_t gpr        : 4; // (0:RAX+[CLTS/LMSW], 1:RCX, 2:RDX, 3:RBX, 4:RSP, 5:RBP, 6:RSI, 6:RDI, 8-15:64bit regs)
119     uint32_t rsvd2      : 4; // reserved to 0
120     uint32_t lmsw_src    : 16; // src data for lmsw
121 } __attribute__((packed));
122
123 struct VMExitMovDRQual {
124     uint32_t regID      : 3; // debug register number
125     uint32_t rsvd1      : 1; // reserved to 0
126     uint32_t dir        : 1; // (0: MOV to DR , 1: MOV from DR)
127     uint32_t rsvd2      : 3; // reserved to 0
128     uint32_t gpr        : 4; // (0:RAX, 1:RCX, 2:RDX, 3:RBX, 4:RSP, 5:RBP, 6:RSI, 6:RDI, 8-15:64bit regs)
129 } __attribute__((packed));
130
131 /* End Exit Qualifications */
132
133
134 int v3_handle_vmx_exit(struct v3_gprs * gprs, struct guest_info * info);
135
136 #endif
137
138 #endif