summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorClement Leger <cleger@kalray.eu>2020-06-12 09:10:29 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-06-15 16:14:33 +0200
commit588255910d570aa37328489cbb314cc39e6dc1b7 (patch)
treeb2fca9573db4072304026dafca16dfff2bc00dc5 /include
parent6c1e7688df94a9d4dfebeb62266f7fc91c209d8a (diff)
downloadbarebox-588255910d570aa37328489cbb314cc39e6dc1b7.tar.gz
barebox-588255910d570aa37328489cbb314cc39e6dc1b7.tar.xz
common: elf: add computation of elf boundaries
In order to correctly load an initrd or a device tree after an elf file, we need to know its boundaries. This commit adds support for that and allow the bootm implementations to use it for memory loading. Signed-off-by: Clement Leger <cleger@kalray.eu> Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/elf.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/elf.h b/include/elf.h
index 113728f08a..403412f3f0 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -403,9 +403,16 @@ struct elf_image {
struct list_head list;
u8 class;
u64 entry;
+ void *low_addr;
+ void *high_addr;
void *buf;
};
+static inline size_t elf_get_mem_size(struct elf_image *elf)
+{
+ return elf->high_addr - elf->low_addr;
+}
+
struct elf_image *elf_load_image(void *buf);
void elf_release_image(struct elf_image *elf);