]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commit
powerpc: Make the 64-bit kernel as a position-independent executable
authorPaul Mackerras <paulus@samba.org>
Sat, 30 Aug 2008 01:43:47 +0000 (11:43 +1000)
committerPaul Mackerras <paulus@samba.org>
Mon, 15 Sep 2008 18:08:38 +0000 (11:08 -0700)
commit549e8152de8039506f69c677a4546e5427aa6ae7
treee03a4f46143a23045e456f96fc08beba12e73073
parente31aa453bbc4886a7bd33e5c2afa526d6f55bd7a
powerpc: Make the 64-bit kernel as a position-independent executable

This implements CONFIG_RELOCATABLE for 64-bit by making the kernel as
a position-independent executable (PIE) when it is set.  This involves
processing the dynamic relocations in the image in the early stages of
booting, even if the kernel is being run at the address it is linked at,
since the linker does not necessarily fill in words in the image for
which there are dynamic relocations.  (In fact the linker does fill in
such words for 64-bit executables, though not for 32-bit executables,
so in principle we could avoid calling relocate() entirely when we're
running a 64-bit kernel at the linked address.)

The dynamic relocations are processed by a new function relocate(addr),
where the addr parameter is the virtual address where the image will be
run.  In fact we call it twice; once before calling prom_init, and again
when starting the main kernel.  This means that reloc_offset() returns
0 in prom_init (since it has been relocated to the address it is running
at), which necessitated a few adjustments.

This also changes __va and __pa to use an equivalent definition that is
simpler.  With the relocatable kernel, PAGE_OFFSET and MEMORY_START are
constants (for 64-bit) whereas PHYSICAL_START is a variable (and
KERNELBASE ideally should be too, but isn't yet).

With this, relocatable kernels still copy themselves down to physical
address 0 and run there.

Signed-off-by: Paul Mackerras <paulus@samba.org>
16 files changed:
arch/powerpc/Kconfig
arch/powerpc/Makefile
arch/powerpc/boot/Makefile
arch/powerpc/boot/elf_util.c
arch/powerpc/include/asm/mmu-hash64.h
arch/powerpc/include/asm/page.h
arch/powerpc/include/asm/sections.h
arch/powerpc/kernel/Makefile
arch/powerpc/kernel/head_64.S
arch/powerpc/kernel/paca.c
arch/powerpc/kernel/prom.c
arch/powerpc/kernel/prom_init.c
arch/powerpc/kernel/reloc_64.S [new file with mode: 0644]
arch/powerpc/kernel/vmlinux.lds.S
arch/powerpc/mm/hash_utils_64.c
arch/powerpc/platforms/powermac/smp.c