MIPS64 modules

Jayachandran C. c.jayachandran at gmail.com
Thu Jan 12 08:13:19 UTC 2012


On Thu, Jan 12, 2012 at 4:51 AM, Oleksandr Tymoshenko <gonzo at freebsd.org> wrote:
>    Modules on MIPS use the same interface as AMD64 modules:
> sys/kern/link_elf_obj.c. It works for MIPS32 but there is a problem
> with MIPS64. sys/kern/link_elf_obj.c calls vm_map_find that uses
> KERNBASE as a map base. As I told - it works for mips32 because
> KERNBASE for mips32 is located before actual virtual memory area
> (KERNBASE points to directly-mapped KSEG0 segment). But for MIPS64
> it's not the case - KERNBASE points to the very end of address space
> and vm_map_find fails.
>
> Using VM_MIN_KERNEL_ADDRESS fixes this problem. So the question is -
> what should I do? Add #ifdef to link_elf_obj.c as in kmem_init in
> vm/vm_kern.c or change KERNBASE to VM_MIN_KERNEL_ADDRESS?

This is probably the right fix for both 32 and 64-bit mips. Using a
KSEG0 address as argument for vm_map_find is not correct as the kernel
map does not include that region for mips.

This reminds me of another issue I had seen in kern/link_elf.c, the
value of linker_kernel_file->address is also set to KERNBASE, but this
really should be KERNLOADADDR (used in our conf files) for mips.


JC.


More information about the freebsd-mips mailing list