stubdom/grub: avoid relying on start_info definition

The kexec() function of grub-pv is relying on the exact definition of
start_info from Mini-OS by having an "#undef start_info" and a few
lines later a copy of the Mini-OS definition again.

This is bad practice by making all attempts of Mini-OS to change that
definition impossible.

Avoid that dependency by moving the code fragment in question to the
very end of the source file, allowing to drop the copy of the
definition.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
This commit is contained in:
Juergen Gross authored and Jan Beulich committed 2025-07-14 16:12:37 +02:00
1 parent 990f43de56
commit 14906e3dc7
1 file changed
+11 -4
+11 -4
View File
@@ -209,6 +209,8 @@ static void tpm_hash2pcr(struct xc_dom_image *dom, char *cmdline)
shutdown_tpmfront(tpm);
}
static void call_start_info_hook(struct xc_dom_image *dom);
void kexec(void *kernel, long kernel_size, void *module, long module_size, char *cmdline, unsigned long flags)
{
struct xc_dom_image *dom;
@@ -330,10 +332,7 @@ void kexec(void *kernel, long kernel_size, void *module, long module_size, char
}
/* start info page */
#undef start_info
if ( dom->arch_hooks->start_info )
dom->arch_hooks->start_info(dom);
#define start_info (start_info_union.start_info)
call_start_info_hook(dom);
xc_dom_log_memory_footprint(dom);
@@ -432,3 +431,11 @@ out:
allocated = 0;
xc_interface_close(xc_handle );
}
/* No references to start_info of Mini-OS after this function. */
static void call_start_info_hook(struct xc_dom_image *dom)
{
#undef start_info
if ( dom->arch_hooks->start_info )
dom->arch_hooks->start_info(dom);
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.