Page MenuHomeFreeBSD

Unobfuscate "KERNLOAD" parameter on amd64
ClosedPublic

Authored by sobomax on Nov 24 2020, 7:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 18, 10:27 PM
Unknown Object (File)
Wed, Dec 11, 8:29 AM
Unknown Object (File)
Fri, Dec 6, 2:06 PM
Unknown Object (File)
Tue, Nov 26, 4:08 AM
Unknown Object (File)
Oct 20 2024, 4:54 PM
Unknown Object (File)
Oct 3 2024, 10:07 PM
Unknown Object (File)
Oct 2 2024, 4:31 PM
Unknown Object (File)
Oct 1 2024, 5:40 AM
Subscribers

Details

Summary

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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

stand/efi/loader/copy.c
36 ↗(On Diff #79945)

Why is the seatbelt needed?

stand/efi/loader/copy.c
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.

stand/efi/loader/copy.c
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.
sys/amd64/include/vmparam.h
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.