sections.h 821 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef _ASM_POWERPC_SECTIONS_H
  2. #define _ASM_POWERPC_SECTIONS_H
  3. #ifdef __KERNEL__
  4. #include <linux/elf.h>
  5. #include <linux/uaccess.h>
  6. #include <asm-generic/sections.h>
  7. #ifdef __powerpc64__
  8. extern char _end[];
  9. static inline int in_kernel_text(unsigned long addr)
  10. {
  11. if (addr >= (unsigned long)_stext && addr < (unsigned long)__init_end)
  12. return 1;
  13. return 0;
  14. }
  15. static inline int overlaps_kernel_text(unsigned long start, unsigned long end)
  16. {
  17. return start < (unsigned long)__init_end &&
  18. (unsigned long)_stext < end;
  19. }
  20. #undef dereference_function_descriptor
  21. static inline void *dereference_function_descriptor(void *ptr)
  22. {
  23. struct ppc64_opd_entry *desc = ptr;
  24. void *p;
  25. if (!probe_kernel_address(&desc->funcaddr, p))
  26. ptr = p;
  27. return ptr;
  28. }
  29. #endif
  30. #endif /* __KERNEL__ */
  31. #endif /* _ASM_POWERPC_SECTIONS_H */