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@
This commit is contained in:
Oleksandr Tymoshenko 2012-01-14 00:36:07 +00:00
parent e94e3511bd
commit 4104e83567

View File

@ -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) {