Make kernel ELF image parsing not crash for kernels running at locations
other than their link address.
This commit is contained in:
parent
32241f2de4
commit
03bb9e5889
@ -381,6 +381,8 @@ link_elf_link_common_finish(linker_file_t lf)
|
||||
return (0);
|
||||
}
|
||||
|
||||
extern vm_offset_t __startkernel;
|
||||
|
||||
static void
|
||||
link_elf_init(void* arg)
|
||||
{
|
||||
@ -409,7 +411,11 @@ link_elf_init(void* arg)
|
||||
|
||||
ef = (elf_file_t) linker_kernel_file;
|
||||
ef->preloaded = 1;
|
||||
#ifdef __powerpc64__
|
||||
ef->address = (caddr_t) (__startkernel - KERNBASE);
|
||||
#else
|
||||
ef->address = 0;
|
||||
#endif
|
||||
#ifdef SPARSE_MAPPING
|
||||
ef->object = 0;
|
||||
#endif
|
||||
@ -417,7 +423,7 @@ link_elf_init(void* arg)
|
||||
|
||||
if (dp != NULL)
|
||||
parse_dynamic(ef);
|
||||
linker_kernel_file->address = (caddr_t) KERNBASE;
|
||||
linker_kernel_file->address += KERNBASE;
|
||||
linker_kernel_file->size = -(intptr_t)linker_kernel_file->address;
|
||||
|
||||
if (modptr != NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user