Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Nov 2006 00:44:56 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        freebsd-stable@FreeBSD.org, Ruslan Ermilov <ru@FreeBSD.org>, Stefan Bethke <stb@lassitu.de>, Bruce Evans <bde@FreeBSD.org>
Subject:   Re: Still possible to directly boot without loader?
Message-ID:  <20061102001337.D31271@delplex.bde.org>
In-Reply-To: <200610301518.20175.jhb@freebsd.org>
References:  <3A8131D4-881E-4873-A682-543A1A88C063@lassitu.de> <200610261542.35322.jhb@freebsd.org> <20061026195419.GA2972@rambler-co.ru> <200610301518.20175.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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 - <File off> for at least this kernel.  boot2 now
loads the text section from file offset <File off> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061102001337.D31271>