summaryrefslogtreecommitdiff
path: root/payloads/libpayload/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload/arch/x86')
-rw-r--r--payloads/libpayload/arch/x86/coreboot.c8
-rw-r--r--payloads/libpayload/arch/x86/head.S19
2 files changed, 10 insertions, 17 deletions
diff --git a/payloads/libpayload/arch/x86/coreboot.c b/payloads/libpayload/arch/x86/coreboot.c
index cad13963ec..ea4b8e51a5 100644
--- a/payloads/libpayload/arch/x86/coreboot.c
+++ b/payloads/libpayload/arch/x86/coreboot.c
@@ -59,6 +59,9 @@ int cb_parse_arch_specific(struct cb_record *rec, struct sysinfo_t *info)
return 1;
}
+/* This pointer gets set in head.S and is passed in from coreboot. */
+void *cb_header_ptr;
+
int get_coreboot_info(struct sysinfo_t *info)
{
int ret;
@@ -67,7 +70,10 @@ int get_coreboot_info(struct sysinfo_t *info)
* an invalid value. */
info->x86_rom_var_mtrr_index = -1;
- ret = cb_parse_header(phys_to_virt(0x00000000), 0x1000, info);
+ ret = cb_parse_header(cb_header_ptr, 1, info);
+
+ if (ret)
+ ret = cb_parse_header(phys_to_virt(0x00000000), 0x1000, info);
if (ret)
ret = cb_parse_header(phys_to_virt(0x000f0000), 0x1000, info);
diff --git a/payloads/libpayload/arch/x86/head.S b/payloads/libpayload/arch/x86/head.S
index 1052b8c94d..87d0037a08 100644
--- a/payloads/libpayload/arch/x86/head.S
+++ b/payloads/libpayload/arch/x86/head.S
@@ -55,11 +55,6 @@ mb_header:
.long _end
.long _init
-#define CB_MAGIC_VALUE 0x12345678
-#define CB_MAGIC 0x04
-#define CB_ARGV 0x08
-#define CB_ARGC 0x10
-
/*
* This function saves off the previous stack and switches us to our
* own execution environment.
@@ -72,18 +67,10 @@ _init:
movl %eax, loader_eax
movl %ebx, loader_ebx
- /* Copy argv[] and argc as demanded by the Payload API,
- * see https://www.coreboot.org/Payload_API and exec.S.
- */
- cmpl $CB_MAGIC_VALUE, CB_MAGIC(%esp)
- jne 1f
-
- movl CB_ARGV(%esp), %eax
- movl %eax, main_argv
+ /* save pointer to coreboot tables */
+ movl 4(%esp), %eax
+ movl %eax, cb_header_ptr
- movl CB_ARGC(%esp), %eax
- movl %eax, main_argc
-1:
/* Store current stack pointer and set up new stack. */
movl %esp, %eax
movl $_stack, %esp