1 #ifndef _ASM_POWERPC_SECTIONS_H
2 #define _ASM_POWERPC_SECTIONS_H
6 #include <linux/uaccess.h>
7 #include <asm-generic/sections.h>
11 extern char __start_interrupts
[];
12 extern char __end_interrupts
[];
14 extern char __prom_init_toc_start
[];
15 extern char __prom_init_toc_end
[];
17 static inline int in_kernel_text(unsigned long addr
)
19 if (addr
>= (unsigned long)_stext
&& addr
< (unsigned long)__init_end
)
25 static inline unsigned long kernel_toc_addr(void)
27 /* Defined by the linker, see vmlinux.lds.S */
28 extern unsigned long __toc_start
;
31 * The TOC register (r2) points 32kB into the TOC, so that 64kB of
32 * the TOC can be addressed using a single machine instruction.
34 return (unsigned long)(&__toc_start
) + 0x8000UL
;
37 static inline int overlaps_interrupt_vector_text(unsigned long start
,
40 unsigned long real_start
, real_end
;
41 real_start
= __start_interrupts
- _stext
;
42 real_end
= __end_interrupts
- _stext
;
44 return start
< (unsigned long)__va(real_end
) &&
45 (unsigned long)__va(real_start
) < end
;
48 static inline int overlaps_kernel_text(unsigned long start
, unsigned long end
)
50 return start
< (unsigned long)__init_end
&&
51 (unsigned long)_stext
< end
;
54 static inline int overlaps_kvm_tmp(unsigned long start
, unsigned long end
)
56 #ifdef CONFIG_KVM_GUEST
57 extern char kvm_tmp
[];
58 return start
< (unsigned long)kvm_tmp
&&
59 (unsigned long)&kvm_tmp
[1024 * 1024] < end
;
65 #ifdef PPC64_ELF_ABI_v1
66 #undef dereference_function_descriptor
67 static inline void *dereference_function_descriptor(void *ptr
)
69 struct ppc64_opd_entry
*desc
= ptr
;
72 if (!probe_kernel_address(&desc
->funcaddr
, p
))
76 #endif /* PPC64_ELF_ABI_v1 */
80 #endif /* __KERNEL__ */
81 #endif /* _ASM_POWERPC_SECTIONS_H */