Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_POWERPC_SECTIONS_H
0003 #define _ASM_POWERPC_SECTIONS_H
0004 #ifdef __KERNEL__
0005 
0006 #include <linux/elf.h>
0007 #include <linux/uaccess.h>
0008 
0009 #ifdef CONFIG_HAVE_FUNCTION_DESCRIPTORS
0010 typedef struct func_desc func_desc_t;
0011 #endif
0012 
0013 #include <asm-generic/sections.h>
0014 
0015 extern char __head_end[];
0016 
0017 #ifdef __powerpc64__
0018 
0019 extern char __start_interrupts[];
0020 extern char __end_interrupts[];
0021 
0022 extern char __prom_init_toc_start[];
0023 extern char __prom_init_toc_end[];
0024 
0025 #ifdef CONFIG_PPC_POWERNV
0026 extern char start_real_trampolines[];
0027 extern char end_real_trampolines[];
0028 extern char start_virt_trampolines[];
0029 extern char end_virt_trampolines[];
0030 #endif
0031 
0032 /*
0033  * This assumes the kernel is never compiled -mcmodel=small or
0034  * the total .toc is always less than 64k.
0035  */
0036 static inline unsigned long kernel_toc_addr(void)
0037 {
0038     unsigned long toc_ptr;
0039 
0040     asm volatile("mr %0, 2" : "=r" (toc_ptr));
0041     return toc_ptr;
0042 }
0043 
0044 static inline int overlaps_interrupt_vector_text(unsigned long start,
0045                             unsigned long end)
0046 {
0047     unsigned long real_start, real_end;
0048     real_start = __start_interrupts - _stext;
0049     real_end = __end_interrupts - _stext;
0050 
0051     return start < (unsigned long)__va(real_end) &&
0052         (unsigned long)__va(real_start) < end;
0053 }
0054 
0055 static inline int overlaps_kernel_text(unsigned long start, unsigned long end)
0056 {
0057     return start < (unsigned long)__init_end &&
0058         (unsigned long)_stext < end;
0059 }
0060 
0061 #endif
0062 
0063 #endif /* __KERNEL__ */
0064 #endif  /* _ASM_POWERPC_SECTIONS_H */