Skip to content

Commit d064a1b

Browse files
dgarskedanielinux
authored andcommitted
Fix issue with Intel FSP ELF size
1 parent 3597384 commit d064a1b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/boot_x86_fsp_payload.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,13 @@ void do_boot(const uint32_t *app)
119119
/* TODO: to remove */
120120
mptable_setup();
121121
x86_paging_dump_info();
122-
r = elf_load_image_mmu((uint8_t *)app, WOLFBOOT_PARTITION_SIZE, &e, mmu_cb);
122+
/* Use available low memory as upper bound for ELF image size */
123+
if (stage2_params->tolum <= (uint32_t)(uintptr_t)app) {
124+
wolfBoot_printf("ELF: app address beyond TOLUM\r\n");
125+
panic();
126+
}
127+
r = elf_load_image_mmu((uint8_t *)app,
128+
stage2_params->tolum - (uint32_t)(uintptr_t)app, &e, mmu_cb);
123129
wolfBoot_printf("Elf loaded (ret %d), entry 0x%x_%x\r\n", r,
124130
(uint32_t)(e >> 32),
125131
(uint32_t)(e));

0 commit comments

Comments
 (0)