Deleted Added
full compact
vmcs.c (249879) vmcs.c (256072)
1/*-
2 * Copyright (c) 2011 NetApp, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2011 NetApp, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/amd64/vmm/intel/vmcs.c 249879 2013-04-25 04:56:43Z grehan $
26 * $FreeBSD: head/sys/amd64/vmm/intel/vmcs.c 256072 2013-10-05 21:22:35Z neel $
27 */
28
29#include "opt_ddb.h"
30
31#include <sys/cdefs.h>
27 */
28
29#include "opt_ddb.h"
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/amd64/vmm/intel/vmcs.c 249879 2013-04-25 04:56:43Z grehan $");
32__FBSDID("$FreeBSD: head/sys/amd64/vmm/intel/vmcs.c 256072 2013-10-05 21:22:35Z neel $");
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/pcpu.h>
37
38#include <vm/vm.h>
39#include <vm/pmap.h>
40

--- 272 unchanged lines hidden (view full) ---

313 error = 0;
314done:
315 VMCLEAR(vmcs);
316 return (error);
317}
318
319int
320vmcs_set_defaults(struct vmcs *vmcs,
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/pcpu.h>
37
38#include <vm/vm.h>
39#include <vm/pmap.h>
40

--- 272 unchanged lines hidden (view full) ---

313 error = 0;
314done:
315 VMCLEAR(vmcs);
316 return (error);
317}
318
319int
320vmcs_set_defaults(struct vmcs *vmcs,
321 u_long host_rip, u_long host_rsp, u_long ept_pml4,
321 u_long host_rip, u_long host_rsp, uint64_t eptp,
322 uint32_t pinbased_ctls, uint32_t procbased_ctls,
323 uint32_t procbased_ctls2, uint32_t exit_ctls,
324 uint32_t entry_ctls, u_long msr_bitmap, uint16_t vpid)
325{
326 int error, codesel, datasel, tsssel;
327 u_long cr0, cr4, efer;
322 uint32_t pinbased_ctls, uint32_t procbased_ctls,
323 uint32_t procbased_ctls2, uint32_t exit_ctls,
324 uint32_t entry_ctls, u_long msr_bitmap, uint16_t vpid)
325{
326 int error, codesel, datasel, tsssel;
327 u_long cr0, cr4, efer;
328 uint64_t eptp, pat, fsbase, idtrbase;
328 uint64_t pat, fsbase, idtrbase;
329 uint32_t exc_bitmap;
330
331 codesel = vmm_get_host_codesel();
332 datasel = vmm_get_host_datasel();
333 tsssel = vmm_get_host_tsssel();
334
335 /*
336 * Make sure we have a "current" VMCS to work with.

--- 90 unchanged lines hidden (view full) ---

427 if ((error = vmwrite(VMCS_HOST_RIP, host_rip)) != 0)
428 goto done;
429
430 /* stack pointer */
431 if ((error = vmwrite(VMCS_HOST_RSP, host_rsp)) != 0)
432 goto done;
433
434 /* eptp */
329 uint32_t exc_bitmap;
330
331 codesel = vmm_get_host_codesel();
332 datasel = vmm_get_host_datasel();
333 tsssel = vmm_get_host_tsssel();
334
335 /*
336 * Make sure we have a "current" VMCS to work with.

--- 90 unchanged lines hidden (view full) ---

427 if ((error = vmwrite(VMCS_HOST_RIP, host_rip)) != 0)
428 goto done;
429
430 /* stack pointer */
431 if ((error = vmwrite(VMCS_HOST_RSP, host_rsp)) != 0)
432 goto done;
433
434 /* eptp */
435 eptp = EPTP(ept_pml4);
436 if ((error = vmwrite(VMCS_EPTP, eptp)) != 0)
437 goto done;
438
439 /* vpid */
440 if ((error = vmwrite(VMCS_VPID, vpid)) != 0)
441 goto done;
442
443 /* msr bitmap */

--- 118 unchanged lines hidden ---
435 if ((error = vmwrite(VMCS_EPTP, eptp)) != 0)
436 goto done;
437
438 /* vpid */
439 if ((error = vmwrite(VMCS_VPID, vpid)) != 0)
440 goto done;
441
442 /* msr bitmap */

--- 118 unchanged lines hidden ---