summaryrefslogtreecommitdiff
path: root/src/arch/x86
diff options
context:
space:
mode:
authorSubrata Banik <subratabanik@google.com>2024-05-12 10:24:14 +0000
committerFelix Held <felix-coreboot@felixheld.de>2024-05-14 13:07:28 +0000
commit06b25c26a18a5d9044ba91c65e0cda3fc19daf56 (patch)
treecc266cb1ea8d04c75a23b27768838f4bd2ba439d /src/arch/x86
parent94d50bbe2a6cb463facda155a1463e24a9de758d (diff)
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 <subratabanik@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/82294 Reviewed-by: Patrick Rudolph <patrick.rudolph@9elements.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nick Vaccaro <nvaccaro@google.com>
Diffstat (limited to 'src/arch/x86')
-rw-r--r--src/arch/x86/boot.c3
1 files changed, 2 insertions, 1 deletions
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 <arch/cpu.h>
#include <commonlib/helpers.h>
#include <console/console.h>
+#include <mode_switch.h>
#include <program_loading.h>
#include <symbols.h>
#include <assert.h>
@@ -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);