blob: 6fbce725c710f97453079205e190c02c7365cd0b [file] [log] [blame]
Jon Loeligerfbcd54b2005-09-17 10:39:46 -05001#ifndef _ASM_POWERPC_SECTIONS_H
2#define _ASM_POWERPC_SECTIONS_H
Arnd Bergmann88ced032005-12-16 22:43:46 +01003#ifdef __KERNEL__
Jon Loeligerfbcd54b2005-09-17 10:39:46 -05004
James Bottomley2d291e92008-09-09 14:04:18 +00005#include <linux/elf.h>
6#include <linux/uaccess.h>
Jon Loeligerfbcd54b2005-09-17 10:39:46 -05007#include <asm-generic/sections.h>
8
9#ifdef __powerpc64__
10
11extern char _end[];
12
13static inline int in_kernel_text(unsigned long addr)
14{
15 if (addr >= (unsigned long)_stext && addr < (unsigned long)__init_end)
16 return 1;
17
18 return 0;
19}
20
Paul Mackerras549e8152008-08-30 11:43:47 +100021static inline int overlaps_kernel_text(unsigned long start, unsigned long end)
22{
23 return start < (unsigned long)__init_end &&
24 (unsigned long)_stext < end;
25}
26
James Bottomleydeac93d2008-09-03 20:43:36 -050027#undef dereference_function_descriptor
James Bottomley2d291e92008-09-09 14:04:18 +000028static inline void *dereference_function_descriptor(void *ptr)
29{
30 struct ppc64_opd_entry *desc = ptr;
31 void *p;
32
33 if (!probe_kernel_address(&desc->funcaddr, p))
34 ptr = p;
35 return ptr;
36}
James Bottomleydeac93d2008-09-03 20:43:36 -050037
Jon Loeligerfbcd54b2005-09-17 10:39:46 -050038#endif
39
Arnd Bergmann88ced032005-12-16 22:43:46 +010040#endif /* __KERNEL__ */
Jon Loeligerfbcd54b2005-09-17 10:39:46 -050041#endif /* _ASM_POWERPC_SECTIONS_H */