From 06b25c26a18a5d9044ba91c65e0cda3fc19daf56 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Sun, 12 May 2024 10:24:14 +0000 Subject: x86: Switch to protected_mode_call_1arg for correct argument passing The payload execution process has been updated to utilize protected_mode_call_1arg in order to guarantee proper handling of function parameters. The previous use of protected_mode_jump with a "jmp" instruction did not allow for proper stack setup for argument passing, as the calling convention was not aligned with the System V ABI calling convention. This patch ensures that calling into the libpayload entry point using protected mode is now aligned with the System V ABI calling convention. This resolves an issue where retrieving the "pointer to coreboot tables" from within the libpayload entry point was failing due to incorrect argument passing. BUG=b:332759882 TEST=Built and booted 64-bit coreboot with 32-bit payload successfully. Change-Id: Ibd522544ad1e9deed6a11015b0c0e95265bda8eb Signed-off-by: Subrata Banik Reviewed-on: https://review.coreboot.org/c/coreboot/+/82294 Reviewed-by: Patrick Rudolph Tested-by: build bot (Jenkins) Reviewed-by: Nick Vaccaro --- src/arch/x86/boot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/arch/x86') diff --git a/src/arch/x86/boot.c b/src/arch/x86/boot.c index 90af84f608..4e547b0e77 100644 --- a/src/arch/x86/boot.c +++ b/src/arch/x86/boot.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -26,7 +27,7 @@ void arch_prog_run(struct prog *prog) const uint32_t entry = pointer_to_uint32_safe(prog_entry(prog)); /* On x86 coreboot payloads expect to be called in protected mode */ - protected_mode_jump(entry, arg); + protected_mode_call_1arg((void *)(uintptr_t)entry, arg); #else #if ENV_X86_64 void (*doit)(void *arg); -- cgit v1.2.3