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)
Sun, Mar 3, 4:30 PM
Unknown Object (File)
Feb 10 2024, 6:13 AM
Unknown Object (File)
Jan 18 2024, 8:32 AM
Unknown Object (File)
Jan 13 2024, 12:05 PM
Unknown Object (File)
Dec 23 2023, 1:14 AM
Unknown Object (File)
Dec 10 2023, 5:18 AM
Unknown Object (File)
Sep 6 2023, 6:24 AM
Unknown Object (File)
Jul 31 2023, 7:06 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.