summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Reinauer <reinauer@chromium.org>2012-01-11 12:40:14 -0800
committerPatrick Georgi <patrick@georgi-clan.de>2012-03-07 14:20:09 +0100
commit51f6a206801aa6c05c2f8a6db12262a6c695e202 (patch)
treefb1944139fbd50b41a34236d72e18827557fb157
parentc44de4999fbd15b6ea87dc723af49e8035a82476 (diff)
correctly mark code segments as code in SELF
In bios_log, find that the first segment of the payload is shown as code rather than data. Sample: Got a payload Loading segment from rom address 0xfff29378 code (compression=1) ... Change-Id: I82eaad23f08c02f4ed75744affa8835255cf5c17 Signed-off-by: Stefan Reinauer <reinauer@google.com> Reviewed-on: http://review.coreboot.org/767 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
-rw-r--r--util/cbfstool/cbfs-mkpayload.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/util/cbfstool/cbfs-mkpayload.c b/util/cbfstool/cbfs-mkpayload.c
index ff6479dc66..e4ef5c8351 100644
--- a/util/cbfstool/cbfs-mkpayload.c
+++ b/util/cbfstool/cbfs-mkpayload.c
@@ -161,7 +161,10 @@ int parse_elf_to_payload(unsigned char *input, unsigned char **output,
continue;
}
- segs[segments].type = PAYLOAD_SEGMENT_DATA;
+ if (phdr[i].p_flags & PF_X)
+ segs[segments].type = PAYLOAD_SEGMENT_CODE;
+ else
+ segs[segments].type = PAYLOAD_SEGMENT_DATA;
segs[segments].load_addr = (uint64_t)htonll(phdr[i].p_paddr);
segs[segments].mem_len = (uint32_t)htonl(phdr[i].p_memsz);
segs[segments].compression = htonl(algo);