diff options
author | Michael Ellerman <mpe@ellerman.id.au> | 2016-03-03 15:26:53 +1100 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-03-07 14:53:52 +1100 |
commit | a5cab83cd3d2d75d3893276cb5f27e163484ef04 (patch) | |
tree | 1281c0987bde07bf74e452025e99a9f75ff38b95 /arch/powerpc/include/asm/sections.h | |
parent | 388f7b1d6e8ca06762e2454d28d6c3c55ad0fe95 (diff) | |
download | op-kernel-dev-a5cab83cd3d2d75d3893276cb5f27e163484ef04.zip op-kernel-dev-a5cab83cd3d2d75d3893276cb5f27e163484ef04.tar.gz |
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 a5e930a..abf5866 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) { |