From owner-freebsd-current@freebsd.org Mon Sep 17 20:09:55 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91BA010A60A3 for ; Mon, 17 Sep 2018 20:09:55 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D94738AFF4 for ; Mon, 17 Sep 2018 20:09:54 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w8HK9ZLT080653 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 17 Sep 2018 23:09:38 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w8HK9ZLT080653 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w8HK9Z6R080652; Mon, 17 Sep 2018 23:09:35 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 17 Sep 2018 23:09:35 +0300 From: Konstantin Belousov To: Warner Losh Cc: rebecca@bluestop.org, FreeBSD Current Subject: Re: FreeBSD EFI projects Message-ID: <20180917200935.GD3161@kib.kiev.ua> References: <1dbeee10-857e-7fb2-dac2-1047353739ba@bluestop.org> <3ce6e6cb-a608-2969-09d4-201df07df586@bluestop.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Sep 2018 20:09:55 -0000 On Mon, Sep 17, 2018 at 12:17:25PM -0600, Warner Losh wrote: > On Sun, Sep 16, 2018 at 11:29 PM Rebecca Cran wrote: > I've had some interest on #bsdmips about booting a 64-bit FreeBSD on old > > Apple systems that use 32-bit EFI: it sounds like it should be possible, > > and is something I'd like to try and get working. > > > > That should be possible, but there's a number of issue dealing with the > 32-bit EFI not having a direct map that we can use to generate the mapping > tables we need for the loader early in our boot. It's why we can't call the > EFI runtime on armv7, for example. Having EFI RT working when 64bit kernel is booted from 32bit EFI environment is very non-trivial. DMAP is not an issue at all, loaders do not use or need it (in fact loaders run with the 1:1 mapping or disabled paging). RT requires calling into 32 bit mode from 64 bit. This is hard to do since kernel interrupt and fault handlers assume that kernel mode means flat 64bit. Interrupts would switch to 64 bit, but existing kernel code cannot handle such switch. Just do not provide RT for 32bit EFI. That said, making only the loader->kernel transition from EFI 32bit to 64bit kernel should be not too hard, and even significantly simpler than to make 32bit EFI load 32bit kernel. amd64 kernels already aware that there might be no BIOS and they do not try to make vm86 calls into real code, and only read memory map from the loader metadata etc. Besides old Macs, this should also benefit newer Intel embedded-like boards.