From owner-soc-status@FreeBSD.ORG Mon Jun 25 23:52:16 2012 Return-Path: Delivered-To: soc-status@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD864106564A for ; Mon, 25 Jun 2012 23:52:16 +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 8E0388FC08 for ; Mon, 25 Jun 2012 23:52:16 +0000 (UTC) Received: by obbun3 with SMTP id un3so9189434obb.13 for ; Mon, 25 Jun 2012 16:52:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dokukino.com; s=google; h=mime-version:from:date:message-id:subject:to:content-type; bh=OM+svFCSSQytr5qPJL/XOiD0YzB9pfQAGUgyYVX/HGo=; b=BTKlhJS2JMeuZttuaqlhzl0OKtz7+keBeZvkyS09Cz2D1CfGABJiY4iyCycLMxQLGO Si6Y87syUArMHyzXVNbh728zswiB2r/v0S7e6UX/92FD/2zAp8l5S98YmRFK/NWmvTYm uQvA2yMehOrVyiKU0vI7S8LCW/2jbb3gdk03o= 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=OM+svFCSSQytr5qPJL/XOiD0YzB9pfQAGUgyYVX/HGo=; b=WSOg6IBEqJBmXcEeEi+82e72a+/43sZhkBS9bEe2d48WQI2aS0J85XmCa9omzFu5kf 26bWbDvtEw6UCajnW2vRfan4E8+DbQ75gqEPpZiRwTc9V9xb6/gNejerZJZ9vbAQwqnA BVKoUnT0hNPZE8lWamjqidgJwetxwTAUOxDaS/ZBnjfxTxkWObF+7exmxnozZb1VXVjt uOyQyDhdmzlBtM31PZfZ3MMVbYzidmSDdm7r3Auu89r9r9fMtAxW8kLhghac3OArdctz gMt5rjL44i93w2IhpvWcI9BWvFFqVoSf7IQ/PmJgAg6rZcA1KTeYkmrSJT59Ud18rGMt 9yjA== Received: by 10.60.14.68 with SMTP id n4mr14006121oec.24.1340667961623; Mon, 25 Jun 2012 16:46:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.241.9 with HTTP; Mon, 25 Jun 2012 16:45:21 -0700 (PDT) From: Takuya ASADA Date: Tue, 26 Jun 2012 08:45:21 +0900 Message-ID: To: soc-status@freebsd.org, Peter Grehan Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQlO2QIcTeXPXBjKrTbsP3nf3kAXYbO0OHjy7SetNf0QFD2nX3uwVzQN6NldzWwPKCgXsrjj Cc: Subject: [status report #4 & #5] 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: Mon, 25 Jun 2012 23:52:16 -0000 Sorry for delay to send report #4, I'll send #4 & #5 together now. * 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. * re-implement register initialization code on libvmmapi In report #3, I implemented sample pseudo BIOS loader and "unrestricted mode" enabler on bhyve command, but it caused triple fault in guest mode. I tried to initialize CPU registers correctly, by following Intel CPU manuals - section 9.1.1 "Processor State After Reset", vol 3. svn diff -r238303:238304 https://socsvn.freebsd.org/socsvn/soc2012/syuu/bhyve-bios * unset VM_ENTRY_LOAD_EFER and VM_ENTRY_GUEST_LMA flags on entry_ctls when a client is unrestricted guest Intel manual says, we can't enable these bits when we are in unrestricted guest mode(real mode). So I added a code to clear bits when client requested VM_CAP_UNRESTRICTED_GUEST. svn diff -r238294:238295 https://socsvn.freebsd.org/socsvn/soc2012/syuu/bhyve-bios * remove unnecessary codes on bhyvebiosload svn diff -r238302:238303 https://socsvn.freebsd.org/socsvn/soc2012/syuu/bhyve-bios| * test result Succeeded to handle VMCALL in unrestricted guest mode. So I can start develop pseudo BIOS from here. $ sudo bhyvebiosload -m 128 -M 256 -h /usr/bhyve-guest/ vm0 $ sudo bhyve -m 128 -M 256 -b vm0 VMCALL handled $ sudo vmmctl --vm=vm0 --get-all lowmem 0x0000000100000000/134217728 highmem 0x0000000108000000/268435456 efer[0] 0x0000000000000901 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] 0x0000000000000f00 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 vm exits due to external interrupt 0 vcpu migration across host cpus 1 vcpu total runtime 15562 ds desc[0] 0x0000000000000000/0x0000ffff/0x00000093 es desc[0] 0x0000000000000000/0x0000ffff/0x00000093 fs desc[0] 0x0000000000000000/0x0000ffff/0x00000093 gs desc[0] 0x0000000000000000/0x0000ffff/0x00000093 ss desc[0] 0x0000000000000000/0x0000ffff/0x00000093 cs desc[0] 0x0000000000000000/0x0000ffff/0x00000093 tr desc[0] 0x0000000000000000/0x0000ffff/0x00000083 ldtr desc[0] 0x0000000000000000/0x0000ffff/0x00000082 gdtr[0] 0x0000000000000000/0x0000ffff idtr[0] 0x0000000000000000/0x0000ffff 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] 0x000000003cf9201e 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] 0x000000000b3d1000 msr 0xc0000080[0] RW msr 0xc0000100[0] RW msr 0xc0000101[0] RW msr 0xc0000102[0] RW msr 0x00000277[0] RW vpid[0] 0x0011 ple_window[0] 0x00000000 ple_gap[0] 0x00000000 instruction_error[0] 0x00000000 exit_ctls[0] 0x003f6ffb entry_ctls[0] 0x000051fb host_pat[0] 0x0001050600070406 guest_pat[0] 0x0007040600070406 host_cr0[0] 0x0000000080050033 host_cr3[0] 0x000000004bb80000 host_cr4[0] 0x00000000000026f0 host_rip[0] 0xffffffff81a12090 host_rip[0] 0xffffff8002aa5000 guest_sysenter_cs[0] 0x00000000 guest_sysenter_sp[0] 0x0000000000000000 guest_sysenter_ip[0] 0x0000000000000000 vmcs_pointer[0] 0xffffffffffffffff vmcs_exit_reason[0] 0x0000000000000012 vmcs_exit_qualification[0] 0x0000000000000000 vmcs_exit_interruption_info[0] 0x00000000 vmcs_exit_interruption_error[0] 0x00000000 vmcs_guest_interruptibility[0] 0x00000000 errno = 22