Still possible to directly boot without loader?
Bruce Evans
bde at zeta.org.au
Wed Nov 1 13:45:00 UTC 2006
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
More information about the freebsd-stable
mailing list