]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
MIPS: Set ISA bit in entry-y for microMIPS kernels
authorPaul Burton <paul.burton@imgtec.com>
Mon, 7 Aug 2017 23:16:47 +0000 (16:16 -0700)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 8 Aug 2017 12:00:50 +0000 (14:00 +0200)
commit5fc9484f5e41b239d1e7a123219e53f333e43ba5
tree3c27069586db1d0939bcd6aca5b255f101c54d5a
parent527f10285bc3f700407bf3aab0ea7b3b9f9338da
MIPS: Set ISA bit in entry-y for microMIPS kernels

When building a kernel for the microMIPS ISA, ensure that the ISA bit
(ie. bit 0) in the entry address is set. Otherwise we may include an
entry address in images which bootloaders will jump to as MIPS32 code.

I originally tried using "objdump -f" to obtain the entry address, which
works for microMIPS but it always outputs a 32 bit address for a 32 bit
ELF whilst nm will sign extend to 64 bit. That matters for systems where
we might want to run a MIPS32 kernel on a MIPS64 CPU & load it with a
MIPS64 bootloader, which would then jump to a non-canonical
(non-sign-extended) address.

This works in all cases as it only changes the behaviour for microMIPS
kernels, but isn't the prettiest solution. A possible alternative would
be to write a custom tool to just extract, sign extend & print the entry
point of an ELF executable. I'm open to feedback if that would be
preferred.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16950/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/Makefile