dl-inlines.h 787 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (C) 2013, Imagination Technologies Ltd.
  3. *
  4. * Licensed under LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
  5. */
  6. static __always_inline int
  7. __dl_is_special_segment (Elf32_Ehdr *epnt,
  8. Elf32_Phdr *ppnt)
  9. {
  10. if (ppnt->p_type != PT_LOAD &&
  11. ppnt->p_type != PT_DYNAMIC)
  12. return 0;
  13. if (ppnt->p_vaddr >= 0x80000000 &&
  14. ppnt->p_vaddr < 0x82060000)
  15. return 1;
  16. if (ppnt->p_vaddr >= 0xe0200000 &&
  17. ppnt->p_vaddr < 0xe0260000)
  18. return 1;
  19. return 0;
  20. }
  21. static __always_inline char *
  22. __dl_map_segment (Elf32_Ehdr *epnt,
  23. Elf32_Phdr *ppnt,
  24. int infile,
  25. int flags)
  26. {
  27. char *addr = (char *)ppnt->p_vaddr;
  28. if (_DL_PREAD (infile, addr, ppnt->p_filesz, ppnt->p_offset) != ppnt->p_filesz) {
  29. return 0;
  30. }
  31. return addr;
  32. }