svn commit: r230097 - head/sys/kern

Oleksandr Tymoshenko gonzo at FreeBSD.org
Sat Jan 14 00:36:07 UTC 2012


Author: gonzo
Date: Sat Jan 14 00:36:07 2012
New Revision: 230097
URL: http://svn.freebsd.org/changeset/base/230097

Log:
  Fix kernel modules loading for MIPS64 kernel:
  
      On amd64, link_elf_obj.c must specify KERNBASE rather than
      VM_MIN_KERNEL_ADDRESS to vm_map_find() because kernel loadable
      modules must be mapped for execution in the same upper region
      of the kernel map as the kernel code and data segments.
  
      For MIPS32 KERNBASE lies below KVA area (it's less than
      VM_MIN_KERNEL_ADDRESS) so basically vm_map_find got whole
      KVA to look through. On MIPS64 it's not the case because
      KERNBASE is set to the very end of XKSEG, well out of KVA
      bounds, so vm_map_find always fails. We should use
      VM_MIN_KERNEL_ADDRESS as a base for vm_map_find.
  
  Details obtained from: alc@

Modified:
  head/sys/kern/link_elf_obj.c

Modified: head/sys/kern/link_elf_obj.c
==============================================================================
--- head/sys/kern/link_elf_obj.c	Sat Jan 14 00:28:02 2012	(r230096)
+++ head/sys/kern/link_elf_obj.c	Sat Jan 14 00:36:07 2012	(r230097)
@@ -684,7 +684,11 @@ link_elf_load_file(linker_class_t cls, c
 	 * location of code and data in the kernel's address space, request a
 	 * mapping that is above the kernel.  
 	 */
+#ifdef __amd64__
 	mapbase = KERNBASE;
+#else
+	mapbase = VM_MIN_KERNEL_ADDRESS;
+#endif
 	error = vm_map_find(kernel_map, ef->object, 0, &mapbase,
 	    round_page(mapsize), TRUE, VM_PROT_ALL, VM_PROT_ALL, FALSE);
 	if (error) {


More information about the svn-src-all mailing list