-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EFI Prekernel (1/N): Kernel: Move boot info variables into a shared struct #24943
Conversation
83a839f
to
305f4bd
Compare
*adjust_by_mapping_base(&kernel_mapping_base) = KERNEL_MAPPING_BASE; | ||
*adjust_by_mapping_base(&kernel_load_base) = KERNEL_MAPPING_BASE; | ||
*adjust_by_mapping_base(&g_boot_info.boot_method) = BootMethod::Multiboot1; | ||
adjust_by_mapping_base(&g_boot_info.boot_method_specific)->pre_init.~PreInitBootInfo(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(copied from #23664 (comment))
I am unsure if calling the destructor of the default union member is needed here (and in all other places where boot_method_specific is set to a non-default union member).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we static_assert that g_boot_info.boot_method is_trivial? Then this dtor call does nothing and isn't needed, and the placement new isn't needed either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static_assert<IsTrivial<BootMethodSpecificBootInfo>>
fails if that is what you meant. I think it's not trivial due to the initializers in Multiboot1BootInfo
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But static_assert<IsTrivial<PreInitBootInfo>>
succeeds. Does that mean the ~PreInitBootInfo
isn't needed?
Why do you think the placement new is unnecessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It basically just memcpy()s, right? Not super important I suppose.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions! |
305f4bd
to
4368704
Compare
2db2abd
to
d350c64
Compare
This commit reorganizes the BootInfo struct definition so it can be shared for all architectures. The existing free extern "C" boot info variables have been removed and replaced with a global BootInfo struct, 'g_boot_info'. On x86-64, the BootInfo is directly copied from the Prekernel-provided struct. On AArch64 and RISC-V, BootInfo is populated during pre_init.
d350c64
to
5978025
Compare
Instead of having multiple boot info variables, move them all into a common global BootInfo struct 'g_boot_info'.
Also make BootInfo more boot method-agnostic by moving multiboot-specific data into Multiboot1BootInfo, which is a member of the BootInfo::boot_method_specific union.
This depends on #24920, therefore draft.