Jon Loeliger | fbcd54b | 2005-09-17 10:39:46 -0500 | [diff] [blame] | 1 | #ifndef _ASM_POWERPC_SECTIONS_H |
| 2 | #define _ASM_POWERPC_SECTIONS_H |
Arnd Bergmann | 88ced03 | 2005-12-16 22:43:46 +0100 | [diff] [blame] | 3 | #ifdef __KERNEL__ |
Jon Loeliger | fbcd54b | 2005-09-17 10:39:46 -0500 | [diff] [blame] | 4 | |
James Bottomley | 2d291e9 | 2008-09-09 14:04:18 +0000 | [diff] [blame^] | 5 | #include <linux/elf.h> |
| 6 | #include <linux/uaccess.h> |
Jon Loeliger | fbcd54b | 2005-09-17 10:39:46 -0500 | [diff] [blame] | 7 | #include <asm-generic/sections.h> |
| 8 | |
| 9 | #ifdef __powerpc64__ |
| 10 | |
| 11 | extern char _end[]; |
| 12 | |
| 13 | static 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 | |
James Bottomley | deac93d | 2008-09-03 20:43:36 -0500 | [diff] [blame] | 21 | #undef dereference_function_descriptor |
James Bottomley | 2d291e9 | 2008-09-09 14:04:18 +0000 | [diff] [blame^] | 22 | static inline void *dereference_function_descriptor(void *ptr) |
| 23 | { |
| 24 | struct ppc64_opd_entry *desc = ptr; |
| 25 | void *p; |
| 26 | |
| 27 | if (!probe_kernel_address(&desc->funcaddr, p)) |
| 28 | ptr = p; |
| 29 | return ptr; |
| 30 | } |
James Bottomley | deac93d | 2008-09-03 20:43:36 -0500 | [diff] [blame] | 31 | |
Jon Loeliger | fbcd54b | 2005-09-17 10:39:46 -0500 | [diff] [blame] | 32 | #endif |
| 33 | |
Arnd Bergmann | 88ced03 | 2005-12-16 22:43:46 +0100 | [diff] [blame] | 34 | #endif /* __KERNEL__ */ |
Jon Loeliger | fbcd54b | 2005-09-17 10:39:46 -0500 | [diff] [blame] | 35 | #endif /* _ASM_POWERPC_SECTIONS_H */ |