1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-03 17:52:07 +02:00

remoteproc: elf_loader: Introduce rproc_elf_get_boot_addr() api

Introduce rproc_elf_get_boot_addr() that returns the entry point of
the elf file. This api auto detects the 64/32 bit elf file and returns
the boot addr accordingly.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
This commit is contained in:
Lokesh Vutla
2019-09-04 16:01:31 +05:30
committed by Tom Rini
parent 856c0ad413
commit 81e39fbd92
3 changed files with 38 additions and 0 deletions

View File

@@ -251,3 +251,27 @@ int rproc_elf_load_image(struct udevice *dev, ulong addr, ulong size)
else
return rproc_elf32_load_image(dev, addr, size);
}
static ulong rproc_elf32_get_boot_addr(ulong addr)
{
Elf32_Ehdr *ehdr = (Elf32_Ehdr *)addr;
return ehdr->e_entry;
}
static ulong rproc_elf64_get_boot_addr(ulong addr)
{
Elf64_Ehdr *ehdr = (Elf64_Ehdr *)addr;
return ehdr->e_entry;
}
ulong rproc_elf_get_boot_addr(struct udevice *dev, ulong addr)
{
Elf32_Ehdr *ehdr = (Elf32_Ehdr *)addr;
if (ehdr->e_ident[EI_CLASS] == ELFCLASS64)
return rproc_elf64_get_boot_addr(addr);
else
return rproc_elf32_get_boot_addr(addr);
}