From owner-freebsd-stable@FreeBSD.ORG Thu Oct 26 15:59:11 2006 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CA7C316A40F; Thu, 26 Oct 2006 15:59:11 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7FC1443D67; Thu, 26 Oct 2006 15:59:08 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from zion.baldwin.cx (zion.baldwin.cx [192.168.0.7]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id k9QFx06v028361; Thu, 26 Oct 2006 11:59:00 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Ruslan Ermilov Date: Thu, 26 Oct 2006 11:38:24 -0400 User-Agent: KMail/1.9.1 References: <3A8131D4-881E-4873-A682-543A1A88C063@lassitu.de> <200610261028.10680.jhb@freebsd.org> <20061026144240.GB1219@rambler-co.ru> In-Reply-To: <20061026144240.GB1219@rambler-co.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200610261138.24939.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [192.168.0.1]); Thu, 26 Oct 2006 11:59:05 -0400 (EDT) X-Virus-Scanned: ClamAV 0.88.3/2106/Thu Oct 26 09:18:05 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: freebsd-stable@freebsd.org, Stefan Bethke , Bruce Evans , Bruce Evans Subject: Re: Still possible to directly boot without loader? X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Oct 2006 15:59:12 -0000 On Thursday 26 October 2006 10:42, Ruslan Ermilov wrote: > On Thu, Oct 26, 2006 at 10:28:09AM -0400, John Baldwin wrote: > > On Thursday 26 October 2006 10:18, Ruslan Ermilov wrote: > > > On Thu, Oct 26, 2006 at 10:52:30PM +1000, Bruce Evans wrote: > > > > On Thu, 26 Oct 2006, Ruslan Ermilov wrote: > > > > >3) It's currently broken even on i386; backing out > > > > > rev. 1.71 of boot2.c by jhb@ fixes this for me. > > > > > > > > > >: revision 1.71 > > > > >: date: 2004/09/18 02:07:00; author: jhb; state: Exp; lines: +3 -3 > > > > >: A long, long time ago in a CVS branch far away (specifically, HEAD prior > > > > >: to 4.0 and RELENG_3), the BTX mini-kernel used paging rather than flat > > > > >: mode and clients were limited to a virtual address space of 16 megabytes. > > > > >: Because of this limitation, boot2 silently masked all physical addresses > > > > >: in any binaries it loaded so that they were always loaded into the first > > > > >: 16 Meg. Since BTX no longer has this limitation (and hasn't for a long > > > > >: time), remove the masking from boot2. This allows boot2 to load kernels > > > > >: larger than about 12 to 14 meg (12 for non-PAE, 14 for PAE). > > > > >: > > > > >: Submitted by: Sergey Lyubka devnull at uptsoft dot com > > > > >: MFC after: 1 month > > > > > > > > The kernel is linked at 0xc0000000 but loade din low memory, so the high > > > > bits must be masked off like they used to be for the kernel to boot at all. > > > > This has nothing to do with paging AFAIK. Rev.1.71 makes no sense, since > > > > BTX isn't large, and large kernels are more unbootable than before with > > > > 1.71. > > > > > > > The real purpose of this commit was to allow to directly "load kernels > > > larger than about 12 to 14 meg (12 for non-PAE, 14 for PAE)". (Old > > > version masked high 8 bits, leaving only 2^24=16MB for the kernel.) > > > > > > I have compiled GENERIC and PAE kernels; objdump(1) reports that GENERIC > > > kernel has virtual "start address 0xc0449cb0", and PAE has virtual "start > > > address 0xc02458f0". > > > > Yes, KERNLOAD for PAE is 2MB and for non-PAE is 4MB (to skip PSE page 0). > > > > > What happens here is that BTX now uses flat memory model, and by not > > > masking higher bits at all, BTX attempts to load kernels at above 3G, > > > which silently fails, and then jumps to the entry point located in > > > "no memory" unless the machine has enough memory. > > > > > > If the machine has enough physical memory, e.g. 4G, then it works (I > > > think that was the case on the machine John tested this change), but > > > on my test machine I only have 3G of memory, so it fails. > > > > Actually, it should never work, as the kernel assumes it is loaded at > > KERNLOAD. > > > > > My interim solution to the problem that would still allow booting > > > larger than 16MB kernels is to mask some of the higher bits. > > > Currently, I mask 28 bits that gives possible 256MB which is probably > > > practical. > > > > boot2 should do whatever loader does. > > > But this would be a regression, since loader(8) does the following, > in the ELF32 case: > > : 0 edoofus:ttyp2:/sys/boot/i386/libi386 >grep -w entry elf32_freebsd.c > : vm_offset_t entry, bootinfop, modulep, kernend; > : entry = ehdr->e_entry & 0xffffff; > : printf("Start @ 0x%lx ...\n", entry); > : __exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop, modulep, kernend); Ah, ok. Make them both just mask the top 8 bits then. :) -- John Baldwin