From owner-freebsd-hackers@FreeBSD.ORG Tue May 15 17:03:29 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5DE651065673 for ; Tue, 15 May 2012 17:03:29 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 336998FC15 for ; Tue, 15 May 2012 17:03:29 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 91711B95B; Tue, 15 May 2012 13:03:28 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Tue, 15 May 2012 11:44:37 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p13; KDE/4.5.5; amd64; ; ) References: <4FA95960.7090908@shadowsun.net> <4FB17B85.9080701@shadowsun.net> In-Reply-To: <4FB17B85.9080701@shadowsun.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201205151144.38123.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 15 May 2012 13:03:28 -0400 (EDT) Cc: Eric McCorkle Subject: Re: GSoC Project: EFI on amd64/i386 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 May 2012 17:03:29 -0000 On Monday, May 14, 2012 5:39:17 pm Eric McCorkle wrote: > On 05/10/12 07:45, Marcel Moolenaar wrote: > > > > On May 8, 2012, at 1:35 PM, Eric McCorkle wrote: > > > >> Here are some specific points to be decided: > >> > >> * An EFI boot service could potentially function similarly to > >> [zfs]loader. Alternatively, it could function like > >> gpt[zfs]boot, though this might require modifying loader(8) since > >> EFI boot services run in protected/long mode, and have different > >> system information table formats. > > It seems having the EFI boot service load the kernel directly is the > way to go, based on Andrey's reply, the existing code, and my own > intuition. I just wanted to ask, in case there was some compelling > reason to have the EFI boot service load loader(8) instead. So this means /boot/loader will be an EFI service, yes? > On the other hand, I think it's a good idea to use libstand/libi386 > whenever possible, even if it ends up calling through to EFI > functions, as it keeps things standardized. Eh, not sure if we really want to do that. For example, we are probably better off using EFI's GPT parsing code than depending on all the gunk to do that in biosdisk.c. Presumably the EFI boot loader wouldn't even use biosdisk.c or bioscd.c for example, but only libstand drivers that talk to EFI. Not sure if Rui's EFI loader already does this. > Good to know. Here are some other questions/issues on my mind: > > If I understand things correctly, boot2 handles the switch to > protected mode (as well as enabling A20), both loader(8) and the > kernel begin their execution in a protected mode environment. Can I > get an absolute confirmation on this? Obviously if this is not the > case, then there will need to be another (protected mode) entry point > into the kernel. The i386 kernel assumes it starts out with a flat 32-bit mode with the kernel loaded into a contiguous memory region at a fixed physical address. If we need a relocatable kernel (as Marcel hinted at I think), then that adds a fair bit of complication. The amd64 kernel assumes it starts in long mode (the bootinfo64.c bits in the loader setup initial page tables, etc.). I think the amd64 kernel also has to be loaded into contiguous memory at a fixed physical address currently. > I know some drivers rely on BIOS calls (vga, for instance, and I think > some drivers for RAID cards do as well). These might (or might not) > need to be modified. Nah, nothing in amd64 calls the BIOS (we don't support VM86). The only thing I am aware of is the VESA bits but those use an emulator, they don't let the CPU natively run BIOS routines. i386 could be adopted to do the same, but it also doesn't make BIOS calls on modern systems outside of the VESA driver (it used to use VM86 to probe memory, but now it uses the SMAP passed in by the loader if it exists and only falls back to VM86 calls if it doesn't). -- John Baldwin