From 0eddbf7648a44a00f9b2285b5aa909480128d2b8 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Mon, 4 Aug 2014 16:43:04 -0500 Subject: [PATCH] vboot: fix vboot_load_ramstage() During a refactor the stage->load address was being returned as an entry point. That is only true when the first instruction is the entry point of the stage. Fix the handling of the load and entry points. BUG=chrome-os-partner:30784 BRANCH=None TEST=Building still works. vboot still runs on rush. Change-Id: I65a93c1c785569190406cd23006ea840c0011936 Signed-off-by: Aaron Durbin Reviewed-on: https://chromium-review.googlesource.com/211010 Reviewed-by: Tom Warren Reviewed-by: Furquan Shaikh Tested-by: Furquan Shaikh --- src/vendorcode/google/chromeos/vboot_loader.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/vendorcode/google/chromeos/vboot_loader.c b/src/vendorcode/google/chromeos/vboot_loader.c index 91c391d0bf..97edd7c990 100644 --- a/src/vendorcode/google/chromeos/vboot_loader.c +++ b/src/vendorcode/google/chromeos/vboot_loader.c @@ -363,6 +363,7 @@ static void *vboot_load_ramstage(struct vboot_handoff *vboot_handoff, struct cbfs_stage *stage; const struct firmware_component *fwc; void *entry; + void *load; if (CONFIG_VBOOT_RAMSTAGE_INDEX >= MAX_PARSED_FW_COMPONENTS) { printk(BIOS_ERR, "Invalid ramstage index: %d\n", @@ -388,16 +389,18 @@ static void *vboot_load_ramstage(struct vboot_handoff *vboot_handoff, return NULL; } + load = (void *)(uintptr_t)stage->load; + entry = (void *)(uintptr_t)stage->entry; + timestamp_add_now(TS_START_COPYRAM); /* Stages rely the below clearing so that the bss is initialized. */ - entry = (void *)(uintptr_t)stage->load; - memset(entry, 0, stage->memlen); + memset(load, 0, stage->memlen); if (cbfs_decompress(stage->compression, ((unsigned char *) stage) + sizeof(struct cbfs_stage), - entry, stage->len)) + load, stage->len)) return NULL; timestamp_add_now(TS_END_COPYRAM);