summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2012-01-14 00:36:07 +0000
committergonzo <gonzo@FreeBSD.org>2012-01-14 00:36:07 +0000
commit0a57e7ea32cd0809baf900cdeb776807b701f72d (patch)
tree7cd893c36b543b7b301cda494c6eeda23006e5ea
parent69e6f0d41657559b7c7414462d57136cc7184f41 (diff)
downloadFreeBSD-src-0a57e7ea32cd0809baf900cdeb776807b701f72d.zip
FreeBSD-src-0a57e7ea32cd0809baf900cdeb776807b701f72d.tar.gz
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@
-rw-r--r--sys/kern/link_elf_obj.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c
index a5a815d..135614c 100644
--- a/sys/kern/link_elf_obj.c
+++ b/sys/kern/link_elf_obj.c
@@ -684,7 +684,11 @@ link_elf_load_file(linker_class_t cls, const char *filename,
* 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) {
OpenPOWER on IntegriCloud