Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 12 May 2012 16:36:04 -0700
From:      Tim Kientzle <kientzle@freebsd.org>
To:        Marcel Moolenaar <marcel@xcllnt.net>
Cc:        arm@freebsd.org, freebsd-hackers@freebsd.org
Subject:   Re: How does loader(8) decide where to load the kernel?
Message-ID:  <AB807672-C394-49F1-BAC1-C9BCF109410C@freebsd.org>
In-Reply-To: <B09F2C7F-7EAD-4194-BAA2-79319554100A@xcllnt.net>
References:  <3B2A320B-3ADE-4F48-B94E-4F0886178251@freebsd.org> <201205070957.03842.jhb@freebsd.org> <8B01DF29-747A-449C-A762-E852F57C6380@freebsd.org> <B09F2C7F-7EAD-4194-BAA2-79319554100A@xcllnt.net>

next in thread | previous in thread | raw e-mail | index | archive | help

On May 10, 2012, at 5:32 AM, Marcel Moolenaar wrote:

>=20
> On May 8, 2012, at 1:32 AM, Tim Kientzle wrote:
>>>> On i386, amd64, powerpc, and arm,  loadimage subtracts
>>>> the dest value from the address declared in the actual ELF
>>>> headers so that the kernel always gets loaded into low memory.
>>>> (there's some intermediate bit-twiddling I'm glossing over, but
>>>> this is the general idea).
>>>=20
>>> The bit twiddling is supposed to be the equivalent of subtracting
>>> KERNBASE from the load address.  On both i386 and amd64, there is
>>> a direct mapping of the kernel text such that KERNBASE maps address
>>> 0, etc.  By default on i386 KERNBASE is 0xc0000000.
>>=20
>> Exactly my problem.  This all assumes that you're loading
>> the kernel into low memory.
>>=20
>> On the AM3358, the DRAM starts at 0x8000 0000
>> on boot, so I'm trying to find a clean way to convince
>> the loader's ELF code to put the kernel there.
>=20
> Look at what I did for ia64. All that frobbing should be done
> in the machine specific implementation of arch_copyin, arch_copyout
> and arch_readin. It's a kluge to do it in elf_loadimage.

That sounds like a reasonable approach.  I've started
working down that path=85  but it looks like I'll have to fix
a lot of the FDT code along the way.

Tim




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AB807672-C394-49F1-BAC1-C9BCF109410C>