1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright (c) 2013 Anish Gupta (akgupt3@gmail.com) 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice unmodified, this list of conditions, and the following 12 * disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 /* 30 * This file and its contents are supplied under the terms of the 31 * Common Development and Distribution License ("CDDL"), version 1.0. 32 * You may only use this file in accordance with the terms of version 33 * 1.0 of the CDDL. 34 * 35 * A full copy of the text of the CDDL should have accompanied this 36 * source. A copy of the CDDL is also available via the Internet at 37 * http://www.illumos.org/license/CDDL. 38 */ 39 /* This file is dual-licensed; see usr/src/contrib/bhyve/LICENSE */ 40 41 /* 42 * Copyright 2022 Oxide Computer Company 43 */ 44 45 #ifndef _VMCB_H_ 46 #define _VMCB_H_ 47 48 struct svm_softc; 49 50 #define BIT(n) (1ULL << n) 51 52 /* 53 * Secure Virtual Machine: AMD64 Programmer's Manual Vol2, Chapter 15 54 * Layout of VMCB: AMD64 Programmer's Manual Vol2, Appendix B 55 */ 56 57 /* vmcb_ctrl->intercept[] array indices */ 58 #define VMCB_CR_INTCPT 0 59 #define VMCB_DR_INTCPT 1 60 #define VMCB_EXC_INTCPT 2 61 #define VMCB_CTRL1_INTCPT 3 62 #define VMCB_CTRL2_INTCPT 4 63 64 /* intercept[VMCB_CTRL1_INTCPT] fields */ 65 #define VMCB_INTCPT_INTR BIT(0) 66 #define VMCB_INTCPT_NMI BIT(1) 67 #define VMCB_INTCPT_SMI BIT(2) 68 #define VMCB_INTCPT_INIT BIT(3) 69 #define VMCB_INTCPT_VINTR BIT(4) 70 #define VMCB_INTCPT_CR0_WRITE BIT(5) 71 #define VMCB_INTCPT_IDTR_READ BIT(6) 72 #define VMCB_INTCPT_GDTR_READ BIT(7) 73 #define VMCB_INTCPT_LDTR_READ BIT(8) 74 #define VMCB_INTCPT_TR_READ BIT(9) 75 #define VMCB_INTCPT_IDTR_WRITE BIT(10) 76 #define VMCB_INTCPT_GDTR_WRITE BIT(11) 77 #define VMCB_INTCPT_LDTR_WRITE BIT(12) 78 #define VMCB_INTCPT_TR_WRITE BIT(13) 79 #define VMCB_INTCPT_RDTSC BIT(14) 80 #define VMCB_INTCPT_RDPMC BIT(15) 81 #define VMCB_INTCPT_PUSHF BIT(16) 82 #define VMCB_INTCPT_POPF BIT(17) 83 #define VMCB_INTCPT_CPUID BIT(18) 84 #define VMCB_INTCPT_RSM BIT(19) 85 #define VMCB_INTCPT_IRET BIT(20) 86 #define VMCB_INTCPT_INTn BIT(21) 87 #define VMCB_INTCPT_INVD BIT(22) 88 #define VMCB_INTCPT_PAUSE BIT(23) 89 #define VMCB_INTCPT_HLT BIT(24) 90 #define VMCB_INTCPT_INVLPG BIT(25) 91 #define VMCB_INTCPT_INVLPGA BIT(26) 92 #define VMCB_INTCPT_IO BIT(27) 93 #define VMCB_INTCPT_MSR BIT(28) 94 #define VMCB_INTCPT_TASK_SWITCH BIT(29) 95 #define VMCB_INTCPT_FERR_FREEZE BIT(30) 96 #define VMCB_INTCPT_SHUTDOWN BIT(31) 97 98 /* intercept[VMCB_CTRL2_INTCPT] fields */ 99 #define VMCB_INTCPT_VMRUN BIT(0) 100 #define VMCB_INTCPT_VMMCALL BIT(1) 101 #define VMCB_INTCPT_VMLOAD BIT(2) 102 #define VMCB_INTCPT_VMSAVE BIT(3) 103 #define VMCB_INTCPT_STGI BIT(4) 104 #define VMCB_INTCPT_CLGI BIT(5) 105 #define VMCB_INTCPT_SKINIT BIT(6) 106 #define VMCB_INTCPT_RDTSCP BIT(7) 107 #define VMCB_INTCPT_ICEBP BIT(8) 108 #define VMCB_INTCPT_WBINVD BIT(9) 109 #define VMCB_INTCPT_MONITOR BIT(10) 110 #define VMCB_INTCPT_MWAIT BIT(11) 111 #define VMCB_INTCPT_MWAIT_ARMED BIT(12) 112 #define VMCB_INTCPT_XSETBV BIT(13) 113 114 /* VMCB TLB control */ 115 #define VMCB_TLB_FLUSH_NOTHING 0 /* Flush nothing */ 116 #define VMCB_TLB_FLUSH_ALL 1 /* Flush entire TLB */ 117 #define VMCB_TLB_FLUSH_GUEST 3 /* Flush all guest entries */ 118 #define VMCB_TLB_FLUSH_GUEST_NONGLOBAL 7 /* Flush guest non-PG entries */ 119 120 /* VMCB state caching */ 121 #define VMCB_CACHE_NONE 0 /* No caching */ 122 #define VMCB_CACHE_I BIT(0) /* Intercept, TSC off, Pause filter */ 123 #define VMCB_CACHE_IOPM BIT(1) /* I/O and MSR permission */ 124 #define VMCB_CACHE_ASID BIT(2) /* ASID */ 125 #define VMCB_CACHE_TPR BIT(3) /* V_TPR to V_INTR_VECTOR */ 126 #define VMCB_CACHE_NP BIT(4) /* Nested Paging */ 127 #define VMCB_CACHE_CR BIT(5) /* CR0, CR3, CR4 & EFER */ 128 #define VMCB_CACHE_DR BIT(6) /* Debug registers */ 129 #define VMCB_CACHE_DT BIT(7) /* GDT/IDT */ 130 #define VMCB_CACHE_SEG BIT(8) /* User segments, CPL */ 131 #define VMCB_CACHE_CR2 BIT(9) /* page fault address */ 132 #define VMCB_CACHE_LBR BIT(10) /* Last branch */ 133 134 /* VMCB control event injection */ 135 #define VMCB_EVENTINJ_EC_VALID BIT(11) /* Error Code valid */ 136 #define VMCB_EVENTINJ_VALID BIT(31) /* Event valid */ 137 138 /* Event types that can be injected */ 139 #define VMCB_EVENTINJ_TYPE_INTR 0 140 #define VMCB_EVENTINJ_TYPE_NMI (2 << 8) 141 #define VMCB_EVENTINJ_TYPE_EXCEPTION (3 << 8) 142 #define VMCB_EVENTINJ_TYPE_INTn (4 << 8) 143 144 /* VMCB exit code, APM vol2 Appendix C */ 145 #define VMCB_EXIT_CR0_READ 0x00 146 #define VMCB_EXIT_CR15_READ 0x0f 147 #define VMCB_EXIT_CR0_WRITE 0x10 148 #define VMCB_EXIT_CR15_WRITE 0x1f 149 #define VMCB_EXIT_EXCP0 0x40 150 #define VMCB_EXIT_EXCP31 0x5f 151 #define VMCB_EXIT_INTR 0x60 152 #define VMCB_EXIT_NMI 0x61 153 #define VMCB_EXIT_SMI 0x62 154 #define VMCB_EXIT_INIT 0x63 155 #define VMCB_EXIT_VINTR 0x64 156 #define VMCB_EXIT_CR0_SEL_WRITE 0x65 157 #define VMCB_EXIT_RDPMC 0x6f 158 #define VMCB_EXIT_PUSHF 0x70 159 #define VMCB_EXIT_POPF 0x71 160 #define VMCB_EXIT_CPUID 0x72 161 #define VMCB_EXIT_IRET 0x74 162 #define VMCB_EXIT_INVD 0x76 163 #define VMCB_EXIT_PAUSE 0x77 164 #define VMCB_EXIT_HLT 0x78 165 #define VMCB_EXIT_INVLPG 0x79 166 #define VMCB_EXIT_INVLPGA 0x7A 167 #define VMCB_EXIT_IO 0x7B 168 #define VMCB_EXIT_MSR 0x7C 169 #define VMCB_EXIT_SHUTDOWN 0x7F 170 #define VMCB_EXIT_VMRUN 0x80 171 #define VMCB_EXIT_VMMCALL 0x81 172 #define VMCB_EXIT_VMLOAD 0x82 173 #define VMCB_EXIT_VMSAVE 0x83 174 #define VMCB_EXIT_STGI 0x84 175 #define VMCB_EXIT_CLGI 0x85 176 #define VMCB_EXIT_SKINIT 0x86 177 #define VMCB_EXIT_WBINVD 0x89 178 #define VMCB_EXIT_MONITOR 0x8A 179 #define VMCB_EXIT_MWAIT 0x8B 180 #define VMCB_EXIT_NPF 0x400 181 #define VMCB_EXIT_INVALID -1 182 183 /* 184 * Move to/from CRx 185 * Bit definitions to decode EXITINFO1 186 */ 187 #define VMCB_CRx_INFO1_GPR(x) ((x) & 0xf) 188 #define VMCB_CRx_INFO1_VALID(x) ((x) & (1UL << 63)) 189 190 /* 191 * Nested page fault. 192 * Bit definitions to decode EXITINFO1. 193 */ 194 #define VMCB_NPF_INFO1_P BIT(0) /* Nested page present. */ 195 #define VMCB_NPF_INFO1_W BIT(1) /* Access was write. */ 196 #define VMCB_NPF_INFO1_U BIT(2) /* Access was user access. */ 197 #define VMCB_NPF_INFO1_RSV BIT(3) /* Reserved bits present. */ 198 #define VMCB_NPF_INFO1_ID BIT(4) /* Code read. */ 199 200 #define VMCB_NPF_INFO1_GPA BIT(32) /* Guest physical address. */ 201 #define VMCB_NPF_INFO1_GPT BIT(33) /* Guest page table. */ 202 203 /* 204 * EXITINTINFO, Interrupt exit info for all intrecepts. 205 * Section 15.7.2, Intercepts during IDT Interrupt Delivery. 206 */ 207 #define VMCB_EXITINTINFO_VECTOR(x) ((x) & 0xFF) 208 #define VMCB_EXITINTINFO_TYPE(x) ((x) & (0x7 << 8)) 209 #define VMCB_EXITINTINFO_EC_VALID(x) (((x) & BIT(11)) != 0) 210 #define VMCB_EXITINTINFO_VALID(x) (((x) & BIT(31)) != 0) 211 #define VMCB_EXITINTINFO_EC(x) (((x) >> 32) & 0xFFFFFFFF) 212 213 /* Offset of various VMCB fields. */ 214 #define VMCB_OFF_CTRL(x) (x) 215 #define VMCB_OFF_STATE(x) ((x) + 0x400) 216 217 #define VMCB_OFF_CR_INTERCEPT VMCB_OFF_CTRL(0x0) 218 #define VMCB_OFF_DR_INTERCEPT VMCB_OFF_CTRL(0x4) 219 #define VMCB_OFF_EXC_INTERCEPT VMCB_OFF_CTRL(0x8) 220 #define VMCB_OFF_INST1_INTERCEPT VMCB_OFF_CTRL(0xC) 221 #define VMCB_OFF_INST2_INTERCEPT VMCB_OFF_CTRL(0x10) 222 #define VMCB_OFF_IO_PERM VMCB_OFF_CTRL(0x40) 223 #define VMCB_OFF_MSR_PERM VMCB_OFF_CTRL(0x48) 224 #define VMCB_OFF_TSC_OFFSET VMCB_OFF_CTRL(0x50) 225 #define VMCB_OFF_ASID VMCB_OFF_CTRL(0x58) 226 #define VMCB_OFF_TLB_CTRL VMCB_OFF_CTRL(0x5C) 227 #define VMCB_OFF_VIRQ VMCB_OFF_CTRL(0x60) 228 #define VMCB_OFF_EXIT_REASON VMCB_OFF_CTRL(0x70) 229 #define VMCB_OFF_EXITINFO1 VMCB_OFF_CTRL(0x78) 230 #define VMCB_OFF_EXITINFO2 VMCB_OFF_CTRL(0x80) 231 #define VMCB_OFF_EXITINTINFO VMCB_OFF_CTRL(0x88) 232 #define VMCB_OFF_AVIC_BAR VMCB_OFF_CTRL(0x98) 233 #define VMCB_OFF_NPT_BASE VMCB_OFF_CTRL(0xB0) 234 #define VMCB_OFF_AVIC_PAGE VMCB_OFF_CTRL(0xE0) 235 #define VMCB_OFF_AVIC_LT VMCB_OFF_CTRL(0xF0) 236 #define VMCB_OFF_AVIC_PT VMCB_OFF_CTRL(0xF8) 237 #define VMCB_OFF_SYSENTER_CS VMCB_OFF_STATE(0x228) 238 #define VMCB_OFF_SYSENTER_ESP VMCB_OFF_STATE(0x230) 239 #define VMCB_OFF_SYSENTER_EIP VMCB_OFF_STATE(0x238) 240 #define VMCB_OFF_GUEST_PAT VMCB_OFF_STATE(0x268) 241 242 #ifdef _KERNEL 243 /* VMCB save state area segment format */ 244 struct vmcb_segment { 245 uint16_t selector; 246 uint16_t attrib; 247 uint32_t limit; 248 uint64_t base; 249 }; 250 CTASSERT(sizeof (struct vmcb_segment) == 16); 251 252 /* Convert to/from vmcb segment access to generic (VMX) access */ 253 #define VMCB_ATTR2ACCESS(attr) ((((attr) & 0xf00) << 4) | ((attr) & 0xff)) 254 #define VMCB_ACCESS2ATTR(acc) ((((acc) & 0xf000) >> 4) | ((acc) & 0xff)) 255 256 /* Code segment descriptor attribute in 12 bit format as saved by VMCB. */ 257 #define VMCB_CS_ATTRIB_L BIT(9) /* Long mode. */ 258 #define VMCB_CS_ATTRIB_D BIT(10) /* OPerand size bit. */ 259 260 /* Fields for Virtual Interrupt Control (v_irq) */ 261 #define V_IRQ BIT(0) /* Offset 0x60 bit 8 (0x61 bit 0) */ 262 #define V_VGIF_VALUE BIT(1) /* Offset 0x60 bit 9 (0x61 bit 1) */ 263 264 /* Fields for Virtual Interrupt Control (v_intr_prio) */ 265 #define V_INTR_PRIO 0xf /* Offset 0x60 bits 16-19 (0x62 bits 0-3) */ 266 #define V_IGN_TPR BIT(4) /* Offset 0x60 bit 20 (0x62 bit 4) */ 267 268 /* Fields for Virtual Interrupt Control (v_intr_ctrl) */ 269 #define V_INTR_MASKING BIT(0) /* Offset 0x60 bit 24 (0x63 bit 0) */ 270 #define V_VGIF_ENABLE BIT(1) /* Offset 0x60 bit 25 (0x63 bit 1) */ 271 #define V_AVIC_ENABLE BIT(7) /* Offset 0x60 bit 31 (0x63 bit 7) */ 272 273 /* Fields in Interrupt Shadow, offset 0x68 */ 274 #define VIRTUAL_INTR_SHADOW BIT(0) 275 #define GUEST_INTERRUPT_MASK BIT(1) 276 277 /* Fields in Nested Paging, offset 0x90 */ 278 #define NP_ENABLE BIT(0) /* Enable nested paging */ 279 #define SEV_ENABLE BIT(1) /* Enable SEV */ 280 #define SEV_ES_ENABLE BIT(2) /* Enable SEV-ES */ 281 #define GUEST_MODE_EXEC_TRAP BIT(3) /* Guest mode execute trap */ 282 #define VIRT_TRANSPAR_ENCRYPT BIT(5) /* Virtual transparent encryption */ 283 284 /* Fields in Misc virt controls, offset 0xB8 */ 285 #define LBR_VIRT_ENABLE BIT(0) /* Enable LBR virtualization accel */ 286 #define VIRT_VMSAVE_VMLOAD BIT(1) /* Virtualized VMSAVE/VMLOAD */ 287 288 /* 289 * The VMCB is divided into two areas - the first one contains various 290 * control bits including the intercept vector and the second one contains 291 * the guest state. 292 */ 293 294 /* VMCB control area - padded up to 1024 bytes */ 295 struct vmcb_ctrl { 296 uint32_t intercept[5]; /* 0x00-0x13: all intercepts */ 297 uint32_t _pad1[10]; /* 0x14-0x3B: Reserved. */ 298 uint32_t pause_ctrl; /* 0x3C, PAUSE filter thresh/count */ 299 uint64_t iopm_base_pa; /* 0x40: IOPM_BASE_PA */ 300 uint64_t msrpm_base_pa; /* 0x48: MSRPM_BASE_PA */ 301 uint64_t tsc_offset; /* 0x50: TSC_OFFSET */ 302 uint32_t asid; /* 0x58: Guest ASID */ 303 uint8_t tlb_ctrl; /* 0x5C: TLB_CONTROL */ 304 uint8_t _pad2[3]; /* 0x5D-0x5F: Reserved. */ 305 uint8_t v_tpr; /* 0x60: Virtual TPR */ 306 uint8_t v_irq; /* 0x61: V_IRQ, V_GIF_VALUE + Reserved */ 307 uint8_t v_intr_prio; /* 0x62: V_INTR_PRIO, V_IGN_TPR */ 308 uint8_t v_intr_ctrl; /* 0x63: V_INTR_MASKING, vGIF and AVIC enable */ 309 uint8_t v_intr_vector; /* 0x64: Virtual interrupt vector */ 310 uint8_t _pad3[3]; /* 0x65-0x67: Reserved */ 311 uint64_t intr_shadow; /* 0x68: Interrupt shadow (and more) */ 312 uint64_t exitcode; /* 0x70, Exitcode */ 313 uint64_t exitinfo1; /* 0x78, EXITINFO1 */ 314 uint64_t exitinfo2; /* 0x80, EXITINFO2 */ 315 uint64_t exitintinfo; /* 0x88, Interrupt exit value. */ 316 uint64_t np_ctrl; /* 0x90, Nested paging control. */ 317 uint64_t _pad4[2]; /* 0x98-0xA7 reserved. */ 318 uint64_t eventinj; /* 0xA8, Event injection. */ 319 uint64_t n_cr3; /* 0xB0, Nested page table. */ 320 uint64_t misc_ctrl; /* 0xB8, Misc virt controls */ 321 uint32_t vmcb_clean; /* 0xC0: VMCB clean bits for caching */ 322 uint32_t _pad5; /* 0xC4: Reserved */ 323 uint64_t nrip; /* 0xC8: Guest next nRIP. */ 324 uint8_t inst_len; /* 0xD0: #NPF decode assist */ 325 uint8_t inst_bytes[15]; /* 0xD1-0xDF: guest instr bytes */ 326 uint64_t avic_page_pa; /* 0xEO: AVIC backing page */ 327 uint64_t _pad6; /* 0xE8-0xEF: Reserved */ 328 uint64_t avic_log_tbl; /* 0xFO: AVIC logical table */ 329 uint64_t avic_phys_tbl; /* 0xF8: AVIC physical page */ 330 uint64_t _pad7; /* 0x100-0x107: Reserved */ 331 uint64_t vmsa_pa; /* 0x108: VMSA pointer */ 332 uint64_t _pad8[94]; /* 0x110-0x3FF: Reserved */ 333 }; 334 CTASSERT(sizeof (struct vmcb_ctrl) == 1024); 335 CTASSERT(offsetof(struct vmcb_ctrl, vmsa_pa) == 0x108); 336 337 struct vmcb_state { 338 struct vmcb_segment es; /* 0x00: 32bit base */ 339 struct vmcb_segment cs; /* 0x10: 32bit base */ 340 struct vmcb_segment ss; /* 0x20: 32bit base */ 341 struct vmcb_segment ds; /* 0x30: 32bit base */ 342 struct vmcb_segment fs; /* 0x40 */ 343 struct vmcb_segment gs; /* 0x50 */ 344 struct vmcb_segment gdt; /* 0x60: base + 16bit limit */ 345 struct vmcb_segment ldt; /* 0x70 */ 346 struct vmcb_segment idt; /* 0x80: base + 16bit limit */ 347 struct vmcb_segment tr; /* 0x90 */ 348 uint8_t _pad1[43]; /* 0xA0-0xCA: Reserved */ 349 uint8_t cpl; /* 0xCB: CPL (real mode: 0, virt: 3) */ 350 uint32_t _pad2; /* 0xCC-0xCF: Reserved */ 351 uint64_t efer; /* 0xD0 */ 352 uint64_t _pad3[14]; /* 0xD8-0x147: Reserved */ 353 uint64_t cr4; /* 0x148 */ 354 uint64_t cr3; /* 0x150 */ 355 uint64_t cr0; /* 0x158 */ 356 uint64_t dr7; /* 0x160 */ 357 uint64_t dr6; /* 0x168 */ 358 uint64_t rflags; /* 0x170 */ 359 uint64_t rip; /* 0x178 */ 360 uint64_t _pad4[11]; /* 0x180-0x1D7: Reserved */ 361 uint64_t rsp; /* 0x1D8 */ 362 uint64_t _pad5[3]; /* 0x1E0-0x1F7: Reserved */ 363 uint64_t rax; /* 0x1F8 */ 364 uint64_t star; /* 0x200 */ 365 uint64_t lstar; /* 0x208 */ 366 uint64_t cstar; /* 0x210 */ 367 uint64_t sfmask; /* 0x218 */ 368 uint64_t kernelgsbase; /* 0x220 */ 369 uint64_t sysenter_cs; /* 0x228 */ 370 uint64_t sysenter_esp; /* 0x230 */ 371 uint64_t sysenter_eip; /* 0x238 */ 372 uint64_t cr2; /* 0x240 */ 373 uint64_t _pad6[4]; /* 0x248-0x267: Reserved */ 374 uint64_t g_pat; /* 0x268 */ 375 uint64_t dbgctl; /* 0x270 */ 376 uint64_t br_from; /* 0x278 */ 377 uint64_t br_to; /* 0x280 */ 378 uint64_t int_from; /* 0x288 */ 379 uint64_t int_to; /* 0x290 */ 380 uint64_t _pad7[301]; /* Reserved up to end of VMCB */ 381 }; 382 CTASSERT(sizeof (struct vmcb_state) == 0xC00); 383 CTASSERT(offsetof(struct vmcb_state, int_to) == 0x290); 384 385 /* 386 * The VMCB aka Virtual Machine Control Block is a 4KB aligned page 387 * in memory that describes the virtual machine. 388 * 389 * The VMCB contains: 390 * - instructions or events in the guest to intercept 391 * - control bits that modify execution environment of the guest 392 * - guest processor state (e.g. general purpose registers) 393 */ 394 struct vmcb { 395 struct vmcb_ctrl ctrl; 396 struct vmcb_state state; 397 }; 398 CTASSERT(sizeof (struct vmcb) == PAGE_SIZE); 399 CTASSERT(offsetof(struct vmcb, state) == 0x400); 400 401 struct vmcb_segment *vmcb_segptr(struct vmcb *vmcb, int type); 402 uint64_t *vmcb_regptr(struct vmcb *vmcb, int ident, uint32_t *dirtyp); 403 uint64_t *vmcb_msr_ptr(struct vmcb *vmcb, uint32_t ident, uint32_t *dirtyp); 404 405 #endif /* _KERNEL */ 406 #endif /* _VMCB_H_ */ 407