From: Suzuki Poulose Date: Wed, 14 Dec 2011 22:59:24 +0000 (+0000) Subject: powerpc/44x: Enable CONFIG_RELOCATABLE for PPC44x X-Git-Tag: v3.3-rc1~181^2~20 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26ecb6c44bb33afc62905ba01b636dde70fc2dc6;p=pandora-kernel.git powerpc/44x: Enable CONFIG_RELOCATABLE for PPC44x The following patch adds relocatable kernel support - based on processing of dynamic relocations - for PPC44x kernel. We find the runtime address of _stext and relocate ourselves based on the following calculation. virtual_base = ALIGN(KERNELBASE,256M) + MODULO(_stext.run,256M) relocate() is called with the Effective Virtual Base Address (as shown below) | Phys. Addr| Virt. Addr | Page (256M) |------------------------| Boundary | | | | | | | | | Kernel Load |___________|_ __ _ _ _ _|<- Effective Addr(_stext)| | ^ |Virt. Base Addr | | | | | | | | | |reloc_offset| | | | | | | | | | |______v_____|<-(KERNELBASE)%256M | | | | | | | | | Page(256M) |-----------|------------| Boundary | | | The virt_phys_offset is updated accordingly, i.e, virt_phys_offset = effective. kernel virt base - kernstart_addr I have tested the patches on 440x platforms only. However this should work fine for PPC_47x also, as we only depend on the runtime address and the current TLB XLAT entry for the startup code, which is available in r25. I don't have access to a 47x board yet. So, it would be great if somebody could test this on 47x. Signed-off-by: Suzuki K. Poulose Cc: Benjamin Herrenschmidt Cc: Kumar Gala Cc: Tony Breeds Cc: Josh Boyer Cc: linuxppc-dev Signed-off-by: Josh Boyer --- Reading git-diff-tree failed