elf-fdpic.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* elf-fdpic.h: FDPIC ELF load map
  2. *
  3. * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #ifndef _LINUX_ELF_FDPIC_H
  12. #define _LINUX_ELF_FDPIC_H
  13. #include <linux/elf.h>
  14. #define PT_GNU_STACK (PT_LOOS + 0x474e551)
  15. /* segment mappings for ELF FDPIC libraries/executables/interpreters */
  16. struct elf32_fdpic_loadseg {
  17. Elf32_Addr addr; /* core address to which mapped */
  18. Elf32_Addr p_vaddr; /* VMA recorded in file */
  19. Elf32_Word p_memsz; /* allocation size recorded in file */
  20. };
  21. struct elf32_fdpic_loadmap {
  22. Elf32_Half version; /* version of these structures, just in case... */
  23. Elf32_Half nsegs; /* number of segments */
  24. struct elf32_fdpic_loadseg segs[];
  25. };
  26. #define ELF32_FDPIC_LOADMAP_VERSION 0x0000
  27. /*
  28. * binfmt binary parameters structure
  29. */
  30. struct elf_fdpic_params {
  31. struct elfhdr hdr; /* ref copy of ELF header */
  32. struct elf_phdr *phdrs; /* ref copy of PT_PHDR table */
  33. struct elf32_fdpic_loadmap *loadmap; /* loadmap to be passed to userspace */
  34. unsigned long elfhdr_addr; /* mapped ELF header user address */
  35. unsigned long ph_addr; /* mapped PT_PHDR user address */
  36. unsigned long map_addr; /* mapped loadmap user address */
  37. unsigned long entry_addr; /* mapped entry user address */
  38. unsigned long stack_size; /* stack size requested (PT_GNU_STACK) */
  39. unsigned long dynamic_addr; /* mapped PT_DYNAMIC user address */
  40. unsigned long load_addr; /* user address at which to map binary */
  41. unsigned long flags;
  42. #define ELF_FDPIC_FLAG_ARRANGEMENT 0x0000000f /* PT_LOAD arrangement flags */
  43. #define ELF_FDPIC_FLAG_INDEPENDENT 0x00000000 /* PT_LOADs can be put anywhere */
  44. #define ELF_FDPIC_FLAG_HONOURVADDR 0x00000001 /* PT_LOAD.vaddr must be honoured */
  45. #define ELF_FDPIC_FLAG_CONSTDISP 0x00000002 /* PT_LOADs require constant
  46. * displacement */
  47. #define ELF_FDPIC_FLAG_CONTIGUOUS 0x00000003 /* PT_LOADs should be contiguous */
  48. #define ELF_FDPIC_FLAG_EXEC_STACK 0x00000010 /* T if stack to be executable */
  49. #define ELF_FDPIC_FLAG_NOEXEC_STACK 0x00000020 /* T if stack not to be executable */
  50. #define ELF_FDPIC_FLAG_EXECUTABLE 0x00000040 /* T if this object is the executable */
  51. #define ELF_FDPIC_FLAG_PRESENT 0x80000000 /* T if this object is present */
  52. };
  53. #ifdef __KERNEL__
  54. #ifdef CONFIG_MMU
  55. extern void elf_fdpic_arch_lay_out_mm(struct elf_fdpic_params *exec_params,
  56. struct elf_fdpic_params *interp_params,
  57. unsigned long *start_stack,
  58. unsigned long *start_brk);
  59. #endif
  60. #endif /* __KERNEL__ */
  61. #endif /* _LINUX_ELF_FDPIC_H */