Author: jhibbits Date: Fri Sep 6 02:28:03 2019 New Revision: 351920 URL: https://svnweb.freebsd.org/changeset/base/351920
Log: 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 Modified: head/stand/common/load_elf.c Modified: head/stand/common/load_elf.c ============================================================================== --- head/stand/common/load_elf.c Fri Sep 6 01:22:16 2019 (r351919) +++ head/stand/common/load_elf.c Fri Sep 6 02:28:03 2019 (r351920) @@ -455,7 +455,11 @@ __elfN(loadimage)(struct preloaded_file *fp, elf_file_ 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_ * 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 _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"