From owner-svn-soc-all@FreeBSD.ORG Thu Jun 14 07:45:12 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 4696B1065670 for ; Thu, 14 Jun 2012 07:45:11 +0000 (UTC) (envelope-from syuu@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Thu, 14 Jun 2012 07:45:11 +0000 Date: Thu, 14 Jun 2012 07:45:11 +0000 From: syuu@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120614074511.4696B1065670@hub.freebsd.org> Cc: Subject: socsvn commit: r237669 - soc2012/syuu/bhyve-bios/usr.sbin/bhyve X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Jun 2012 07:45:12 -0000 Author: syuu Date: Thu Jun 14 07:45:10 2012 New Revision: 237669 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=237669 Log: adding bios compatible mode Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Modified: soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c ============================================================================== --- soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Thu Jun 14 06:55:40 2012 (r237668) +++ soc2012/syuu/bhyve-bios/usr.sbin/bhyve/fbsdrun.c Thu Jun 14 07:45:10 2012 (r237669) @@ -99,6 +99,8 @@ static void *oem_tbl_start; static int oem_tbl_size; +static int bios_mode; + static void vm_loop(struct vmctx *ctx, int vcpu, uint64_t rip); struct vm_exit vmexit[VM_MAXCPU]; @@ -126,7 +128,7 @@ { fprintf(stderr, - "Usage: %s [-ehBHP][-g ][-z ][-s ][-p pincpu]" + "Usage: %s [-ehBHPb][-g ][-z ][-s ][-p pincpu]" "[-n ][-m lowmem][-M highmem] \n" " -g: gdb port (default is %d and 0 means don't open)\n" " -c: # cpus (default 1)\n" @@ -143,7 +145,8 @@ " -m: lowmem in MB\n" " -M: highmem in MB\n" " -x: mux vcpus to 1 hcpu\n" - " -t: mux vcpu timeslice hz (default %d)\n", + " -t: mux vcpu timeslice hz (default %d)\n" + " -b: BIOS compatible mode\n", progname, DEFAULT_GDB_PORT, DEFAULT_GUEST_HZ, DEFAULT_GUEST_TSLICE); exit(code); @@ -429,6 +432,15 @@ return (VMEXIT_CONTINUE); } +static int +vmexit_vmcall(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu) +{ + printf("VMCALL handled\n"); + exit(1); + + return (VMEXIT_RESTART); +} + static void sigalrm(int sig) { @@ -469,7 +481,8 @@ [VM_EXITCODE_RDMSR] = vmexit_rdmsr, [VM_EXITCODE_WRMSR] = vmexit_wrmsr, [VM_EXITCODE_MTRAP] = vmexit_mtrap, - [VM_EXITCODE_PAGING] = vmexit_paging + [VM_EXITCODE_PAGING] = vmexit_paging, + [VM_EXITCODE_VMCALL] = vmexit_vmcall, }; static void @@ -531,7 +544,7 @@ gdb_port = DEFAULT_GDB_PORT; guest_ncpus = 1; - while ((c = getopt(argc, argv, "ehBHPxp:g:c:z:s:S:n:m:M:")) != -1) { + while ((c = getopt(argc, argv, "ehBHPxbp:g:c:z:s:S:n:m:M:")) != -1) { switch (c) { case 'B': inject_bkpt = 1; @@ -578,6 +591,9 @@ case 'e': strictio = 1; break; + case 'b': + bios_mode = 1; + break; case 'h': usage(0); default: @@ -644,6 +660,10 @@ } } + if (bios_mode != 0) { + vm_set_capability(ctx, BSP, VM_CAP_UNRESTRICTED_GUEST, 1); + } + init_inout(); init_pci(ctx);