diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2016-03-03 05:26:53 +0100 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-03-07 04:53:52 +0100 |
commit | a5cab83cd3d2d75d3893276cb5f27e163484ef04 (patch) | |
tree | 1281c0987bde07bf74e452025e99a9f75ff38b95 /arch/powerpc/include/asm/sections.h | |
parent | Linux 4.5-rc3 (diff) | |
download | linux-a5cab83cd3d2d75d3893276cb5f27e163484ef04.tar.xz linux-a5cab83cd3d2d75d3893276cb5f27e163484ef04.zip |
powerpc: Create a helper for getting the kernel toc value
Move the logic to work out the kernel toc pointer into a header. This is
a good cleanup, and also means we can use it elsewhere in future.
Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Reviewed-by: Torsten Duwe <duwe@suse.de>
Reviewed-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Tested-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Diffstat (limited to 'arch/powerpc/include/asm/sections.h')
-rw-r--r-- | arch/powerpc/include/asm/sections.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/sections.h b/arch/powerpc/include/asm/sections.h index a5e930aca804..abf5866e08c6 100644 --- a/arch/powerpc/include/asm/sections.h +++ b/arch/powerpc/include/asm/sections.h @@ -22,6 +22,18 @@ static inline int in_kernel_text(unsigned long addr) return 0; } +static inline unsigned long kernel_toc_addr(void) +{ + /* Defined by the linker, see vmlinux.lds.S */ + extern unsigned long __toc_start; + + /* + * The TOC register (r2) points 32kB into the TOC, so that 64kB of + * the TOC can be addressed using a single machine instruction. + */ + return (unsigned long)(&__toc_start) + 0x8000UL; +} + static inline int overlaps_interrupt_vector_text(unsigned long start, unsigned long end) { |