xref: /linux/arch/powerpc/include/asm/sections.h (revision c4ee0af3fa0dc65f690fc908f02b8355f9576ea0)
1 #ifndef _ASM_POWERPC_SECTIONS_H
2 #define _ASM_POWERPC_SECTIONS_H
3 #ifdef __KERNEL__
4 
5 #include <linux/elf.h>
6 #include <linux/uaccess.h>
7 #include <asm-generic/sections.h>
8 
9 #ifdef __powerpc64__
10 
11 extern char __end_interrupts[];
12 
13 extern char __prom_init_toc_start[];
14 extern char __prom_init_toc_end[];
15 
16 static inline int in_kernel_text(unsigned long addr)
17 {
18 	if (addr >= (unsigned long)_stext && addr < (unsigned long)__init_end)
19 		return 1;
20 
21 	return 0;
22 }
23 
24 static inline int overlaps_kernel_text(unsigned long start, unsigned long end)
25 {
26 	return start < (unsigned long)__init_end &&
27 		(unsigned long)_stext < end;
28 }
29 
30 #undef dereference_function_descriptor
31 static inline void *dereference_function_descriptor(void *ptr)
32 {
33 	struct ppc64_opd_entry *desc = ptr;
34 	void *p;
35 
36 	if (!probe_kernel_address(&desc->funcaddr, p))
37 		ptr = p;
38 	return ptr;
39 }
40 
41 #endif
42 
43 #endif /* __KERNEL__ */
44 #endif	/* _ASM_POWERPC_SECTIONS_H */
45