svn commit: r333134 - head/sys/kern

Nathan Whitehorn nwhitehorn at FreeBSD.org
Tue May 1 04:06:59 UTC 2018


Author: nwhitehorn
Date: Tue May  1 04:06:59 2018
New Revision: 333134
URL: https://svnweb.freebsd.org/changeset/base/333134

Log:
  Report the kernel base address properly in kldstat when using PowerPC kernels
  loaded at addresses other than their link address.

Modified:
  head/sys/kern/link_elf.c

Modified: head/sys/kern/link_elf.c
==============================================================================
--- head/sys/kern/link_elf.c	Tue May  1 00:53:46 2018	(r333133)
+++ head/sys/kern/link_elf.c	Tue May  1 04:06:59 2018	(r333134)
@@ -383,7 +383,7 @@ link_elf_link_common_finish(linker_file_t lf)
 	return (0);
 }
 
-extern vm_offset_t __startkernel;
+extern vm_offset_t __startkernel, __endkernel;
 
 static void
 link_elf_init(void* arg)
@@ -424,8 +424,13 @@ link_elf_init(void* arg)
 
 	if (dp != NULL)
 		parse_dynamic(ef);
+#ifdef __powerpc__
+	linker_kernel_file->address = (caddr_t)__startkernel;
+	linker_kernel_file->size = (intptr_t)(__endkernel - __startkernel);
+#else
 	linker_kernel_file->address += KERNBASE;
 	linker_kernel_file->size = -(intptr_t)linker_kernel_file->address;
+#endif
 
 	if (modptr != NULL) {
 		ef->modptr = modptr;


More information about the svn-src-head mailing list