diff options
author | Justin Hibbits <jhibbits@FreeBSD.org> | 2019-09-06 02:28:03 +0000 |
---|---|---|
committer | Justin Hibbits <jhibbits@FreeBSD.org> | 2019-09-06 02:28:03 +0000 |
commit | 2f6823d4c1106082052a35fa28a5e49fb5ad155f (patch) | |
tree | b19d743310f4136002a08a64ded3674c4e2360f7 /stand/common | |
parent | 7f0b97094876a0f07369e7d7af65287aa9f8b9fd (diff) | |
download | src-2f6823d4c1106082052a35fa28a5e49fb5ad155f.tar.gz src-2f6823d4c1106082052a35fa28a5e49fb5ad155f.zip |
Loader: Add load offset to powerpc kernel entry point
Summary:
There is logic in ELF loadimage() to relocate kernels, but currently
only type ET_EXEC. PowerPC kernels are ET_DYN, and can be relocated anywhere.
Add the load offset to kernel entry points on this platform.
Reviewed by: imp, ian
Differential Revision: https://reviews.freebsd.org/D21286
Notes
Notes:
svn path=/head/; revision=351920
Diffstat (limited to 'stand/common')
-rw-r--r-- | stand/common/load_elf.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c index 6b3ed719f7b2..9a1c81b62ed9 100644 --- a/stand/common/load_elf.c +++ b/stand/common/load_elf.c @@ -455,7 +455,11 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, uint64_t off) ret = 0; firstaddr = lastaddr = 0; ehdr = ef->ehdr; +#ifdef __powerpc__ + if (ef->kernel) { +#else if (ehdr->e_type == ET_EXEC) { +#endif #if defined(__i386__) || defined(__amd64__) #if __ELF_WORD_SIZE == 64 /* x86_64 relocates after locore */ @@ -481,12 +485,11 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_t ef, uint64_t off) * it's loaded at a 16MB boundary for now... */ off += 0x01000000; - ehdr->e_entry += off; + } + ehdr->e_entry += off; #ifdef ELF_VERBOSE - printf("Converted entry 0x%jx\n", (uintmax_t)ehdr->e_entry); + printf("Converted entry 0x%jx\n", (uintmax_t)ehdr->e_entry); #endif - } else - off = 0; #elif defined(__arm__) && !defined(EFI) /* * The elf headers in arm kernels specify virtual addresses in |