Date: Tue, 6 Sep 2005 18:47:01 -0700 From: Peter Wemm <peter@wemm.org> To: freebsd-amd64@freebsd.org Cc: Norberto Meijome <numard@meijome.net> Subject: Re: Curious : why does the booloader say i386 on amd64? Message-ID: <200509061847.01996.peter@wemm.org> In-Reply-To: <4317CFF8.6030202@meijome.net> References: <4317CFF8.6030202@meijome.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 01 September 2005 09:07 pm, Norberto Meijome wrote: > FreeBSD/i386 boot > > # sysctl -a | grep machine > hw.machine: amd64 > hw.machine_arch: amd64 > > # uname -rms > FreeBSD 6.0-BETA3 amd64 > > > Is it common code between i386 + amd64? is it just a label ? do I > have an old bootloader from a previous non-amd64 incantation > (possible, though I'm pretty sure I dd'ed the first few megs of all > drives before installing amd64...) The amd64 boot loader *is* the i386 boot loader. We have a common loader for both platforms. Yes, the FreeBSD/i386 loader can load and run an amd64 kernel right off the i386 cdrom etc. There was no benefit to be had by making a 64 bit loader. It really wasn't necessary and would just have been a whole lot of work for no good reason. For what its worth, the loader switches modes depending on which type of kernel is loaded. If you load a 64 bit kernel, then moments before starting it up, it creates a page table tree to replicate the kernel environment over the entire address space, the loader itself switches to 64 bit mode, and then jumps directly to the kernel at its native 64 bit address entry point. On i386, it jumps to the kernel in "flat" protected mode but at before-relocated address. The i386 kernel has to build a page table tree itself and deal with running at its non-relocated address by doing lots of work in assembler. Compare i386/locode.s with amd64/locore.S to see the benefit. Also see create_pagetables() in amd64/machdep.c - that code is in assembler on i386, but simple C on amd64. -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com "All of this is for nothing if we don't go to the stars" - JMS/B5
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200509061847.01996.peter>