PHYSADDR

Ian Lepore ian at FreeBSD.org
Sun Mar 3 01:18:58 UTC 2013


On Sat, 2013-03-02 at 10:10 -0800, Tim Kientzle wrote:
> On Mar 2, 2013, at 9:50 AM, Ian Lepore wrote:
> 
> >[...]
> 
> > I'm not sure its safe to assume that (entry-pc & 0xfffff000) is the
> > beginning of the kernel; it's true now but need not be so.  But that's
> > no big deal, we can tweak the linker script to give us the offset of the
> > _start symbol so it'll work no matter what.
> 
> Patches?  ;-)

This turned out to be a bit trickier than I first thought it would be,
but it worked out.

This gets rids of any reference to PHYSADDR and similar constants in the
main path through the code.  I didn't address the "running from flash"
case or anything under #ifdef SMP, yet.  The only constant left is
KERNBASE which is 0xC0000000 for all arm systems.

For now I've got #undef PHYSADDR at the top of the code; this is just
for testing without having to remove it yet from anywhere else.

There are two ldscript changes: define a new ENTRY_OFFSET symbol which
is the offset between the start of the load image and the _start symbol,
and also it puts the physical addresses in the headers, by calculating a
physical value for ENTRY(), and using an AT(expr) for the text segment,
which very conviently just flows to the following segments without
needing to re-specify it on every new segment.

This isn't ready to commit, but it's ready to play with, and to get
comments from folks who know some of the history of this code (Olivier
has been helping me on irc all day answering such questions).

-- Ian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: locore_physaddr.diff
Type: text/x-patch
Size: 6663 bytes
Desc: 
URL: <http://lists.freebsd.org/pipermail/freebsd-arm/attachments/20130302/4c573dc4/attachment.bin>


More information about the freebsd-arm mailing list