From owner-soc-status@FreeBSD.ORG Wed May 30 00:48:06 2012 Return-Path: Delivered-To: soc-status@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3F9051065672 for ; Wed, 30 May 2012 00:48:06 +0000 (UTC) (envelope-from syuu@dokukino.com) Received: from mail-ob0-f182.google.com (mail-ob0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id B4EAD8FC0C for ; Wed, 30 May 2012 00:48:05 +0000 (UTC) Received: by obcni5 with SMTP id ni5so10090839obc.13 for ; Tue, 29 May 2012 17:48:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type :x-gm-message-state; bh=53Ela5wvKrvyLhUhWEStvMmcIG/yZsHsdLYDWYcUJPk=; b=ihq6Cj0lTwoYHcdwwg94EbVWukQBljT0pygAHSrRBUE1jiOu/b0QdYsK5frvDnD0zN LwRPbg24Jq9DYEbQGn5HaZaWgNTOK/TRSJK9TOzcl65Nb7kIgMRHjkqbxF6KXq/O2yhm WRN8Wa+vjzHzfHcVIhG6qpepXnV+jJRfQPsQnosVwDG0b3jFPyHgD6Wht9q5klnZ5z2+ L5taFREyxZIem3qFn7N6yrubYfSh4SSSdMZ3nFBdqCoO+Z7NIAH85nOPHwzw9P51Yxqr u8/7VVD9eK3Q90Fg53SM7s19PlURU/1iTPINdaAXWUruR4yIbJT9tzoiZOZ97BjcCCE5 fWWQ== Received: by 10.60.3.39 with SMTP id 7mr13395433oez.4.1338338885086; Tue, 29 May 2012 17:48:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.72.229 with HTTP; Tue, 29 May 2012 17:47:24 -0700 (PDT) From: Takuya ASADA Date: Wed, 30 May 2012 09:47:24 +0900 Message-ID: To: soc-status@freebsd.org, Peter Grehan Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQlus6BCbyx84kN6lYlMRYO+6SD96JfijzT1thJj3Z6cos/lldXX2z4z2LZJisokJkR1eoBL Cc: Subject: [status report #1] BHyVe BIOS emulation to boot legacy systems X-BeenThere: soc-status@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Summer of Code Status Reports and Discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 May 2012 00:48:06 -0000 * project summary The project goal is to support BIOS emulation on BHyVe, enabling boot from disk image. I going to focus booting FreeBSD/amd64 from disk image on this GSoC, but final goal is to make BHyVe able to support more guest OSes. * preparation to develop BHyVe Before try to join BHyVe development, I read the source code and think what BHyVe doing on FreeBSD host system, and made presentations about it, discussed in some small conferences. Here're slides(Unfortunately, it's in Japanese): - http://www.slideshare.net/AsadaTakuya/bhyve - http://www.slideshare.net/syuu1228/bhyve-12636280 - http://www.slideshare.net/syuu1228/bhyve-internals-13082679 Result of this activity, I could get some members who have interest to play with BHyVe, we probably going to held small Hackathon in next month. * trap VMCALL instruction test code worked fine. ## patch for guest kernel ## --- /usr/src-bhyve/sys/amd64/amd64/locore.S 2012-01-03 12:27:06.000000000 +0900 +++ /home/syuu/9.0-bhyve/sys/amd64/amd64/locore.S 2012-05-30 09:05:33.000000000 +0900 @@ -77,7 +77,9 @@ xorl %ebp, %ebp call hammer_time /* set up cpu for unix operation */ - movq %rax,%rsp /* set up kstack for mi_startup() */ + + .byte 0xf,0x1,0xc1 + call mi_startup /* autoconfiguration, mountroot etc */ 0: hlt jmp 0b ## patch for host ## Index: usr.sbin/bhyve/fbsdrun.c =================================================================== --- usr.sbin/bhyve/fbsdrun.c (revision 236685) +++ usr.sbin/bhyve/fbsdrun.c (working copy) @@ -429,6 +429,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 +478,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 Index: sys/amd64/include/vmm.h =================================================================== --- sys/amd64/include/vmm.h (revision 236685) +++ sys/amd64/include/vmm.h (working copy) @@ -228,6 +228,7 @@ VM_EXITCODE_MTRAP, VM_EXITCODE_PAUSE, VM_EXITCODE_PAGING, + VM_EXITCODE_VMCALL, VM_EXITCODE_MAX }; Index: sys/amd64/vmm/intel/vmx.c =================================================================== --- sys/amd64/vmm/intel/vmx.c (revision 236685) +++ sys/amd64/vmm/intel/vmx.c (working copy) @@ -1189,6 +1189,9 @@ vmexit->exitcode = VM_EXITCODE_PAGING; vmexit->u.paging.cr3 = vmcs_guest_cr3(); break; + case EXIT_REASON_VMCALL: + vmexit->exitcode = VM_EXITCODE_VMCALL; + break; default: break; }