Page MenuHomeFreeBSD

Unobfuscate "KERNLOAD" parameter on amd64

Authored by sobomax on Nov 24 2020, 7:24 PM.



Kernel loading address seems like important parameter that somehow got scrambled up while developing amd64.

This change lines-up amd64 with the i386 and the rest of supported architectures by defining KERNLOAD in the vmparam.h and getting rid of magic constant in the linker script.

Use KERNLOAD to eliminate another (matching) magic constant 200 lines down inside unassuming TU "copy.c" 3 levels deep in the loader tree.

Diff Detail

rS FreeBSD src repository - subversion
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

36 ↗(On Diff #79945)

Why is the seatbelt needed?

36 ↗(On Diff #79945)

Good question. I was not sure if I am going to break other arches or people building on older systems perhaps? But if that's OK, I'd be glad to get rid of this if you guys think it's not needed.

36 ↗(On Diff #79945)

I see now that KERNEL_PHYSICAL_BASE is only used if __i386__ or __amd64__ is defined, so the definition should move into that block and the warning can be dropped, IMO.

Eliminate KERNEL_PHYSICAL_BASE althogether, move #include <machine/vmparam.h> into i386/amd64-specific section.

Suggested by: markj

Updated, thanks @markj !

markj added inline comments.
155 ↗(On Diff #80004)

I would s/size/alignment/ in the comment. I believe the kernel expects to be loaded on a superpage boundary, it doesn't have to be 0x200000 specifically.

This revision is now accepted and ready to land.Nov 25 2020, 10:16 PM

Merge in comments for the KERNLOAD into one blob.

This revision now requires review to proceed.Nov 25 2020, 11:08 PM
This revision was not accepted when it landed; it landed in state Needs Review.Nov 25 2020, 11:19 PM
This revision was automatically updated to reflect the committed changes.
sobomax marked an inline comment as done.