Deleted Added
full compact
bhyverun.c (267447) bhyverun.c (267450)
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: stable/10/usr.sbin/bhyve/bhyverun.c 267447 2014-06-13 19:10:40Z jhb $
26 * $FreeBSD: stable/10/usr.sbin/bhyve/bhyverun.c 267450 2014-06-13 21:30:40Z jhb $
27 */
28
29#include <sys/cdefs.h>
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: stable/10/usr.sbin/bhyve/bhyverun.c 267447 2014-06-13 19:10:40Z jhb $");
30__FBSDID("$FreeBSD: stable/10/usr.sbin/bhyve/bhyverun.c 267450 2014-06-13 21:30:40Z jhb $");
31
32#include <sys/types.h>
33#include <sys/mman.h>
34#include <sys/time.h>
35
36#include <machine/atomic.h>
37#include <machine/segments.h>
38

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

56#include "inout.h"
57#include "dbgport.h"
58#include "ioapic.h"
59#include "mem.h"
60#include "mevent.h"
61#include "mptbl.h"
62#include "pci_emul.h"
63#include "pci_lpc.h"
31
32#include <sys/types.h>
33#include <sys/mman.h>
34#include <sys/time.h>
35
36#include <machine/atomic.h>
37#include <machine/segments.h>
38

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

56#include "inout.h"
57#include "dbgport.h"
58#include "ioapic.h"
59#include "mem.h"
60#include "mevent.h"
61#include "mptbl.h"
62#include "pci_emul.h"
63#include "pci_lpc.h"
64#include "smbiostbl.h"
64#include "xmsr.h"
65#include "spinup_ap.h"
66#include "rtc.h"
67
68#define GUEST_NIO_PORT 0x488 /* guest upcalls via i/o port */
69
70#define VMEXIT_SWITCH 0 /* force vcpu switch in mux mode */
71#define VMEXIT_CONTINUE 1 /* continue from next instruction */

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

77#define MB (1024UL * 1024)
78#define GB (1024UL * MB)
79
80typedef int (*vmexit_handler_t)(struct vmctx *, struct vm_exit *, int *vcpu);
81
82char *vmname;
83
84int guest_ncpus;
65#include "xmsr.h"
66#include "spinup_ap.h"
67#include "rtc.h"
68
69#define GUEST_NIO_PORT 0x488 /* guest upcalls via i/o port */
70
71#define VMEXIT_SWITCH 0 /* force vcpu switch in mux mode */
72#define VMEXIT_CONTINUE 1 /* continue from next instruction */

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

78#define MB (1024UL * 1024)
79#define GB (1024UL * MB)
80
81typedef int (*vmexit_handler_t)(struct vmctx *, struct vm_exit *, int *vcpu);
82
83char *vmname;
84
85int guest_ncpus;
86char *guest_uuid_str;
85
86static int pincpu = -1;
87static int guest_vmexit_on_hlt, guest_vmexit_on_pause;
88static int virtio_msix = 1;
89static int x2apic_mode = 0; /* default is xAPIC */
90
91static int strictio;
92static int strictmsr = 1;

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

136 " -P: vmexit from the guest on pause\n"
137 " -W: force virtio to use single-vector MSI\n"
138 " -e: exit on unhandled I/O access\n"
139 " -h: help\n"
140 " -s: <slot,driver,configinfo> PCI slot config\n"
141 " -l: LPC device configuration\n"
142 " -m: memory size in MB\n"
143 " -w: ignore unimplemented MSRs\n"
87
88static int pincpu = -1;
89static int guest_vmexit_on_hlt, guest_vmexit_on_pause;
90static int virtio_msix = 1;
91static int x2apic_mode = 0; /* default is xAPIC */
92
93static int strictio;
94static int strictmsr = 1;

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

138 " -P: vmexit from the guest on pause\n"
139 " -W: force virtio to use single-vector MSI\n"
140 " -e: exit on unhandled I/O access\n"
141 " -h: help\n"
142 " -s: <slot,driver,configinfo> PCI slot config\n"
143 " -l: LPC device configuration\n"
144 " -m: memory size in MB\n"
145 " -w: ignore unimplemented MSRs\n"
144 " -x: local apic is in x2APIC mode\n",
146 " -x: local apic is in x2APIC mode\n"
147 " -U: uuid\n",
145 progname, (int)strlen(progname), "");
146
147 exit(code);
148}
149
150void *
151paddr_guest2host(struct vmctx *ctx, uintptr_t gaddr, size_t len)
152{

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

594 size_t memsize;
595
596 bvmcons = 0;
597 progname = basename(argv[0]);
598 gdb_port = 0;
599 guest_ncpus = 1;
600 memsize = 256 * MB;
601
148 progname, (int)strlen(progname), "");
149
150 exit(code);
151}
152
153void *
154paddr_guest2host(struct vmctx *ctx, uintptr_t gaddr, size_t len)
155{

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

597 size_t memsize;
598
599 bvmcons = 0;
600 progname = basename(argv[0]);
601 gdb_port = 0;
602 guest_ncpus = 1;
603 memsize = 256 * MB;
604
602 while ((c = getopt(argc, argv, "abehwxAHIPWp:g:c:s:m:l:")) != -1) {
605 while ((c = getopt(argc, argv, "abehwxAHIPWp:g:c:s:m:l:U:")) != -1) {
603 switch (c) {
604 case 'a':
605 x2apic_mode = 0;
606 break;
607 case 'A':
608 acpi = 1;
609 break;
610 case 'b':

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

648 */
649 break;
650 case 'P':
651 guest_vmexit_on_pause = 1;
652 break;
653 case 'e':
654 strictio = 1;
655 break;
606 switch (c) {
607 case 'a':
608 x2apic_mode = 0;
609 break;
610 case 'A':
611 acpi = 1;
612 break;
613 case 'b':

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

651 */
652 break;
653 case 'P':
654 guest_vmexit_on_pause = 1;
655 break;
656 case 'e':
657 strictio = 1;
658 break;
659 case 'U':
660 guest_uuid_str = optarg;
661 break;
656 case 'w':
657 strictmsr = 0;
658 break;
659 case 'W':
660 virtio_msix = 0;
661 break;
662 case 'x':
663 x2apic_mode = 1;

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

718 error = vm_get_register(ctx, BSP, VM_REG_GUEST_RIP, &rip);
719 assert(error == 0);
720
721 /*
722 * build the guest tables, MP etc.
723 */
724 mptable_build(ctx, guest_ncpus);
725
662 case 'w':
663 strictmsr = 0;
664 break;
665 case 'W':
666 virtio_msix = 0;
667 break;
668 case 'x':
669 x2apic_mode = 1;

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

724 error = vm_get_register(ctx, BSP, VM_REG_GUEST_RIP, &rip);
725 assert(error == 0);
726
727 /*
728 * build the guest tables, MP etc.
729 */
730 mptable_build(ctx, guest_ncpus);
731
732 error = smbios_build(ctx);
733 assert(error == 0);
734
726 if (acpi) {
727 error = acpi_build(ctx, guest_ncpus);
728 assert(error == 0);
729 }
730
731 /*
732 * Change the proc title to include the VM name.
733 */

--- 14 unchanged lines hidden ---
735 if (acpi) {
736 error = acpi_build(ctx, guest_ncpus);
737 assert(error == 0);
738 }
739
740 /*
741 * Change the proc title to include the VM name.
742 */

--- 14 unchanged lines hidden ---