From owner-soc-status@FreeBSD.ORG Thu Jun 14 08:27:35 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 9CDC4106564A for ; Thu, 14 Jun 2012 08:27:35 +0000 (UTC) (envelope-from syuu@dokukino.com) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 563B78FC0C for ; Thu, 14 Jun 2012 08:27:35 +0000 (UTC) Received: by vcbfy7 with SMTP id fy7so1058737vcb.13 for ; Thu, 14 Jun 2012 01:27:34 -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=YusHyzqVq8KTozzWXhXSjuKkREUZmjcEvwJ1Fb0+0PM=; b=ZbIWpdUdCsv/4ZOqaZSj6XvICYxWTHquJSyDLdIPaKV9/M1YO6DfoR6nvvXJKkf4oj jdC8MUlCstuiw4uUdoyA26/4E1vvX5Dt56I+WhHWX7/kqnfoc/SVikTIh2Scl7e+YoS+ BPRCnwbkHzNa5cwcAfFcHZu2HQtsuE35pKmhdTrGW5PjPy9Bz6VdB+PPmwkm4TYFSbVK jTb5GutiJcuzh6OGtzKAblcEez6F6Hst1N7EQ/uIStfmSrySAJ8x7m0pIs3KAuIKynG1 YTFJirPAgSl1LO8GfA9zVeAD3l2j63cRl84Zx5NbUbnOUCBLUUA+/myNO2nQLE+1dXow pNoA== Received: by 10.52.88.170 with SMTP id bh10mr417882vdb.11.1339662454442; Thu, 14 Jun 2012 01:27:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.172.166 with HTTP; Thu, 14 Jun 2012 01:26:54 -0700 (PDT) From: Takuya ASADA Date: Thu, 14 Jun 2012 17:26:54 +0900 Message-ID: To: soc-status@freebsd.org, Peter Grehan Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQl9BR+EuekM/F7NHhayu+foqp4Kn7mazy45WBg5UjtE+YumZcsiymUjTUym8cj8qLwPZVrQ Cc: Subject: [status report #3] 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: Thu, 14 Jun 2012 08:27:35 -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. * implement BIOS emulation mode on /usr/sbin/bhyve Just does vm_set_capability(ctx, BSP, VM_CAP_UNRESTRICTED_GUEST, 1) when passed -b argument, for now. svn diff -r r237668:r237669 https://socsvn.freebsd.org/socsvn/soc2012/syuu/bhyve-bios * vmmctl --get-all For more easy debugging guest environment, added a option for vmmctl. It simply shows up ALL information which can fetch from vmmctl. svn diff -r r237669:r237670 https://socsvn.freebsd.org/socsvn/soc2012/syuu/bhyve-bios * implement /usr/sbin/bhyvebiosload Loads ${vm_path}/pseudo_bios.bin to 0x0 of virtual machine memory space, initialize CPU0 as real mode state, set RIP to 0x0. (RIP = 0x0 is just for testing) svn diff -r r237670:r237672 https://socsvn.freebsd.org/socsvn/soc2012/syuu/bhyve-bios * test result Looks like a CPU looking correct memory address and could fetch VMCALL instruction, because bhyve says "inst_length 3". When I tried to change VMCALL intruction to NOP intruction, inst_length had changed to 1, so probably it's okay. Though, it's getting triple fault. Maybe some CPU initialization is wrong , so it faults just after VMLAUNCH. I'm trying to figure out why it's faulting... $ sudo ./bhyvebiosload -m 128 -M 256 -h /usr/bhyve-guest/ vm0 $ cd ../bhyve $ sudo vmmctl --get-all --vm=vm0 lowmem 0x0000000100000000/134217728 highmem 0x0000000108000000/268435456 efer[0] 0x0000000000000000 cr0[0] 0x0000000000000020 cr3[0] 0x0000000000000000 cr4[0] 0x0000000000002000 dr7[0] 0x0000000000000000 rsp[0] 0x0000000000000000 rip[0] 0x0000000000000000 rax[0] 0x0000000000000000 rbx[0] 0x0000000000000000 rcx[0] 0x0000000000000000 rdx[0] 0x0000000000000000 rsi[0] 0x0000000000000000 rdi[0] 0x0000000000000000 rbp[0] 0x0000000000000000 r8[0] 0x0000000000000000 r9[0] 0x0000000000000000 r10[0] 0x0000000000000000 r11[0] 0x0000000000000000 r12[0] 0x0000000000000000 r13[0] 0x0000000000000000 r14[0] 0x0000000000000000 r15[0] 0x0000000000000000 rflags[0] 0x0000000000000002 vcpu0 vcpu migration across host cpus 0 vcpu total runtime 0 vm exits due to external interrupt 0 ds desc[0] 0x0000000000000000/0x00000000/0x00000093 es desc[0] 0x0000000000000000/0x00000000/0x00000093 fs desc[0] 0x0000000000000000/0x00000000/0x00000093 gs desc[0] 0x0000000000000000/0x00000000/0x00000093 ss desc[0] 0x0000000000000000/0x00000000/0x00000093 cs desc[0] 0x0000000000000000/0x00000000/0x0000209b tr desc[0] 0x0000000000000000/0x00000000/0x0000008b ldtr desc[0] 0x0000000000000000/0x00000000/0x00010000 gdtr[0] 0x0000000000005000/0x00000017 idtr[0] 0x0000000000000000/0x00000000 cs[0] 0x0000 ds[0] 0x0000 es[0] 0x0000 fs[0] 0x0000 gs[0] 0x0000 ss[0] 0x0000 tr[0] 0x0000 ldtr[0] 0x0000 pincpu[0] unpinned pinbased_ctls[0] 0x0000003f procbased_ctls[0] 0x95006172 procbased_ctls2[0] 0x00000022 gla[0] 0x0000000000000000 gpa[0] 0x0000000000000000 entry_interruption_info[0] 0x00000000 eptp[0] 0x000000007b08801e exception_bitmap[0] 0x00040000 io_bitmap_a[0] 0x00000000 io_bitmap_b[0] 0x00000000 tsc_offset[0] 0x0000000000000000 cr0_mask[0] 0xffffffff60000020 cr0_shadow[0] 0x0000000000000020 cr4_mask[0] 0x0000000000000000 cr4_shadow[0] 0x0000000000000000 cr3_target_count[0] 0x00000000 cr3_target0[0] 0x0000000000000000 cr3_target1[0] 0x0000000000000000 cr3_target2[0] 0x0000000000000000 cr3_target3[0] 0x0000000000000000 apic_access_addr[0] 0x0000000000000000 virtual_apic_addr[0] 0x0000000000000000 tpr_threshold[0] 0x00000000 msr_bitmap[0] 0x000000006ef31000 msr 0xc0000080[0] RW msr 0xc0000100[0] RW msr 0xc0000101[0] RW msr 0xc0000102[0] RW msr 0x00000277[0] RW vpid[0] 0x00c9 ple_window[0] 0x00000000 ple_gap[0] 0x00000000 instruction_error[0] 0x00000000 exit_ctls[0] 0x003f6ffb entry_ctls[0] 0x0000d1fb host_pat[0] 0x0001050600070406 guest_pat[0] 0x0007040600070406 host_cr0[0] 0x0000000080050033 host_cr3[0] 0x0000000000000000 host_cr4[0] 0x00000000000026f0 host_rip[0] 0xffffffff81812090 host_rip[0] 0xffffff8002aaa000 guest_sysenter_cs[0] 0x00000000 guest_sysenter_sp[0] 0x0000000000000000 guest_sysenter_ip[0] 0x0000000000000000 vmcs_pointer[0] 0xffffffffffffffff vmcs_exit_reason[0] 0x0000000000000000 vmcs_exit_qualification[0] 0x0000000000000000 vmcs_exit_interruption_info[0] 0x00000000 vmcs_exit_interruption_error[0] 0x00000000 vmcs_guest_interruptibility[0] 0x00000000 errno = 22 $ sudo ./bhyve -m 128 -M 256 -b vm0 vm exit[0] reason VMX rip 0x0000000000000000 inst_length 3 error 0 exit_reason 2 qualification 0x0000000000000000 $ sudo vmmctl --get-all --vm=vm0 lowmem 0x0000000100000000/134217728 highmem 0x0000000108000000/268435456 efer[0] 0x0000000000000000 cr0[0] 0x0000000000000030 cr3[0] 0x0000000000000000 cr4[0] 0x0000000000002000 dr7[0] 0x0000000000000000 rsp[0] 0x0000000000000000 rip[0] 0x0000000000000000 rax[0] 0x0000000000000000 rbx[0] 0x0000000000000000 rcx[0] 0x0000000000000000 rdx[0] 0x0000000000000000 rsi[0] 0x0000000000000000 rdi[0] 0x0000000000000000 rbp[0] 0x0000000000000000 r8[0] 0x0000000000000000 r9[0] 0x0000000000000000 r10[0] 0x0000000000000000 r11[0] 0x0000000000000000 r12[0] 0x0000000000000000 r13[0] 0x0000000000000000 r14[0] 0x0000000000000000 r15[0] 0x0000000000000000 rflags[0] 0x0000000000010002 vcpu0 vcpu migration across host cpus 1 vcpu total runtime 23841 vm exits due to external interrupt 0 ds desc[0] 0x0000000000000000/0x00000000/0x00000093 es desc[0] 0x0000000000000000/0x00000000/0x00000093 fs desc[0] 0x0000000000000000/0x00000000/0x00000093 gs desc[0] 0x0000000000000000/0x00000000/0x00000093 ss desc[0] 0x0000000000000000/0x00000000/0x00000093 cs desc[0] 0x0000000000000000/0x00000000/0x0000209b tr desc[0] 0x0000000000000000/0x00000000/0x0000008b ldtr desc[0] 0x0000000000000000/0x00000000/0x00010000 gdtr[0] 0x0000000000005000/0x00000017 idtr[0] 0x0000000000000000/0x00000000 cs[0] 0x0000 ds[0] 0x0000 es[0] 0x0000 fs[0] 0x0000 gs[0] 0x0000 ss[0] 0x0000 tr[0] 0x0000 ldtr[0] 0x0000 pincpu[0] unpinned pinbased_ctls[0] 0x0000003f procbased_ctls[0] 0x95006172 procbased_ctls2[0] 0x000000a2 gla[0] 0x0000000000000000 gpa[0] 0x0000000000000000 entry_interruption_info[0] 0x00000000 eptp[0] 0x000000007b08801e exception_bitmap[0] 0x00040000 io_bitmap_a[0] 0x00000000 io_bitmap_b[0] 0x00000000 tsc_offset[0] 0x0000000000000000 cr0_mask[0] 0xffffffff60000020 cr0_shadow[0] 0x0000000000000020 cr4_mask[0] 0x0000000000000000 cr4_shadow[0] 0x0000000000000000 cr3_target_count[0] 0x00000000 cr3_target0[0] 0x0000000000000000 cr3_target1[0] 0x0000000000000000 cr3_target2[0] 0x0000000000000000 cr3_target3[0] 0x0000000000000000 apic_access_addr[0] 0x0000000000000000 virtual_apic_addr[0] 0x0000000000000000 tpr_threshold[0] 0x00000000 msr_bitmap[0] 0x000000006ef31000 msr 0xc0000080[0] RW msr 0xc0000100[0] RW msr 0xc0000101[0] RW msr 0xc0000102[0] RW msr 0x00000277[0] RW vpid[0] 0x00c9 ple_window[0] 0x00000000 ple_gap[0] 0x00000000 instruction_error[0] 0x00000000 exit_ctls[0] 0x003f6ffb entry_ctls[0] 0x0000d1fb host_pat[0] 0x0001050600070406 guest_pat[0] 0x0007040600070406 host_cr0[0] 0x0000000080050033 host_cr3[0] 0x000000002c71c000 host_cr4[0] 0x00000000000026f0 host_rip[0] 0xffffffff81812090 host_rip[0] 0xffffff8002aaa000 guest_sysenter_cs[0] 0x00000000 guest_sysenter_sp[0] 0x0000000000000000 guest_sysenter_ip[0] 0x0000000000000000 vmcs_pointer[0] 0xffffffffffffffff vmcs_exit_reason[0] 0x0000000000000002 vmcs_exit_qualification[0] 0x0000000000000000 vmcs_exit_interruption_info[0] 0x00000000 vmcs_exit_interruption_error[0] 0x00000000 vmcs_guest_interruptibility[0] 0x00000000 errno = 22