From owner-freebsd-stable@FreeBSD.ORG Wed Nov 1 13:45:00 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 C716A16A412; Wed, 1 Nov 2006 13:45:00 +0000 (UTC) (envelope-from bde@zeta.org.au) Received: from mailout2.pacific.net.au (mailout2-3.pacific.net.au [61.8.2.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 172DF43D46; Wed, 1 Nov 2006 13:45:00 +0000 (GMT) (envelope-from bde@zeta.org.au) Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.2.163]) by mailout2.pacific.net.au (Postfix) with ESMTP id 7CB211191D1; Thu, 2 Nov 2006 00:44:58 +1100 (EST) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailproxy2.pacific.net.au (Postfix) with ESMTP id 9726227407; Thu, 2 Nov 2006 00:44:57 +1100 (EST) Date: Thu, 2 Nov 2006 00:44:56 +1100 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: John Baldwin In-Reply-To: <200610301518.20175.jhb@freebsd.org> Message-ID: <20061102001337.D31271@delplex.bde.org> References: <3A8131D4-881E-4873-A682-543A1A88C063@lassitu.de> <200610261542.35322.jhb@freebsd.org> <20061026195419.GA2972@rambler-co.ru> <200610301518.20175.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-stable@FreeBSD.org, Ruslan Ermilov , Stefan Bethke , 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: Wed, 01 Nov 2006 13:45:00 -0000 On Mon, 30 Oct 2006, John Baldwin wrote: > On Thursday 26 October 2006 15:54, Ruslan Ermilov wrote: >> On Thu, Oct 26, 2006 at 03:42:34PM -0400, John Baldwin wrote: >>> On Thursday 26 October 2006 15:18, Ruslan Ermilov wrote: >>>> On Thu, Oct 26, 2006 at 11:38:24AM -0400, John Baldwin wrote: >>> Sorry, I meant that both boot2 and loader should follow your proposal of > masking 28 bits. >>> Just masking the top 4 bits is probably sufficient. >>> >> :-) >> >> OK, I'll craft a patch tomorrow. This will also require patching at least >> sys/boot/common/load_elf.c:__elfN(loadimage), maybe something else. >> I think we could actually mask 30 bits; that would allow to load 1G kernels, >> provided that sufficient memory exists. > > Actually, please mask 4 bits. Not all kernels run at 0xc0000000. You can > adjust that address via 'options KVA_PAGES'. I know of folks who run kernels > at 0xa0000000 for example because they need more KVA. This is part of why I They can probably use 0x80000000, but it's not obvious how to get exactly that from KVA_PAGES. > really don't like the masking part, though I'm not sure there's a way to > figure out KERNBASE well enough to do the more correct 'pa = addr - KERNBASE' > rather than 'pa = addr & 0x0fffffff'. The masking hack is probably only needed for aout. For elf, objdump -h /kernel says: % Sections: % Idx Name Size VMA LMA File off Algn % ... % CONTENTS, ALLOC, LOAD, READONLY, DATA % 4 .text 002853e0 c043b510 c043b510 0003b510 2**4 so KERNBASE = LMA - for at least this kernel. boot2 now loads the text section from file offset to address LMA(masked). I think it just needs to load at an address that is the same mod PAGE_SIZE as LMA or VMA (these must agree mod PAGE_SIZE), provided it adjusts the entry address to match. Bruce