1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_SECTIONS_H
3 #define _ASM_POWERPC_SECTIONS_H
7 #include <linux/uaccess.h>
9 #ifdef CONFIG_HAVE_FUNCTION_DESCRIPTORS
10 typedef struct func_desc func_desc_t;
13 #include <asm-generic/sections.h>
15 extern char __head_end[];
16 extern char __srwx_boundary[];
19 extern s32 patch__call_flush_branch_caches1;
20 extern s32 patch__call_flush_branch_caches2;
21 extern s32 patch__call_flush_branch_caches3;
22 extern s32 patch__flush_count_cache_return;
23 extern s32 patch__flush_link_stack_return;
24 extern s32 patch__call_kvm_flush_link_stack;
25 extern s32 patch__call_kvm_flush_link_stack_p9;
26 extern s32 patch__memset_nocache, patch__memcpy_nocache;
28 extern long flush_branch_caches;
29 extern long kvm_flush_link_stack;
33 extern char __start_interrupts[];
34 extern char __end_interrupts[];
36 #ifdef CONFIG_PPC_POWERNV
37 extern char start_real_trampolines[];
38 extern char end_real_trampolines[];
39 extern char start_virt_trampolines[];
40 extern char end_virt_trampolines[];
44 * This assumes the kernel is never compiled -mcmodel=small or
45 * the total .toc is always less than 64k.
47 static inline unsigned long kernel_toc_addr(void)
49 #ifdef CONFIG_PPC_KERNEL_PCREL
53 unsigned long toc_ptr;
55 asm volatile("mr %0, 2" : "=r" (toc_ptr));
60 static inline int overlaps_interrupt_vector_text(unsigned long start,
63 unsigned long real_start, real_end;
64 real_start = __start_interrupts - _stext;
65 real_end = __end_interrupts - _stext;
67 return start < (unsigned long)__va(real_end) &&
68 (unsigned long)__va(real_start) < end;
71 static inline int overlaps_kernel_text(unsigned long start, unsigned long end)
73 return start < (unsigned long)__init_end &&
74 (unsigned long)_stext < end;
78 static inline unsigned long kernel_toc_addr(void) { BUILD_BUG(); return -1UL; }
81 #endif /* __KERNEL__ */
82 #endif /* _ASM_POWERPC_SECTIONS_H */