summaryrefslogtreecommitdiffstats
path: root/src/arch/x86/boot.c
diff options
context:
space:
mode:
authorPatrick Rudolph <siro@das-labor.org>2018-12-09 10:48:59 +0100
committerPatrick Rudolph <siro@das-labor.org>2020-08-19 09:06:43 +0000
commite563815e059ef5881a42e6f8b37094783771d5a7 (patch)
tree7641211d03c315d37176717cbf37588ec4ebd38b /src/arch/x86/boot.c
parentad7b2e23ab5954f150a4b2f62378f1e7133e56c9 (diff)
downloadcoreboot-e563815e059ef5881a42e6f8b37094783771d5a7.tar.gz
coreboot-e563815e059ef5881a42e6f8b37094783771d5a7.tar.bz2
coreboot-e563815e059ef5881a42e6f8b37094783771d5a7.zip
arch/x86/boot: Jump to payload in protected mode
* On ARCH_RAMSTAGE_X86_64 jump to the payload in protected mode. * Add a helper function to jump to arbitrary code in protected mode, similar to the real mode call handler. * Doesn't affect existing x86_32 code. * Add a macro to cast pointer to uint32_t that dies if it would overflow on conversion Tested on QEMU Q35 using SeaBIOS as payload. Tested on Lenovo T410 with additional x86_64 patches. Change-Id: I6552ac30f1b6205e08e16d251328e01ce3fbfd14 Signed-off-by: Patrick Rudolph <siro@das-labor.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/30118 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src/arch/x86/boot.c')
-rw-r--r--src/arch/x86/boot.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/arch/x86/boot.c b/src/arch/x86/boot.c
index db9d69e74daf..777a0b7d904a 100644
--- a/src/arch/x86/boot.c
+++ b/src/arch/x86/boot.c
@@ -1,10 +1,12 @@
/* SPDX-License-Identifier: GPL-2.0-only */
+#include <arch/boot/boot.h>
#include <commonlib/helpers.h>
#include <console/console.h>
#include <program_loading.h>
#include <ip_checksum.h>
#include <symbols.h>
+#include <assert.h>
int payload_arch_usable_ram_quirk(uint64_t start, uint64_t size)
{
@@ -19,6 +21,13 @@ int payload_arch_usable_ram_quirk(uint64_t start, uint64_t size)
void arch_prog_run(struct prog *prog)
{
+#if ENV_RAMSTAGE && defined(__x86_64__)
+ const uint32_t arg = pointer_to_uint32_safe(prog_entry_arg(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);
+#else
#ifdef __x86_64__
void (*doit)(void *arg);
#else
@@ -27,4 +36,5 @@ void arch_prog_run(struct prog *prog)
#endif
doit = prog_entry(prog);
doit(prog_entry_arg(prog));
+#endif
}