您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef ELF_H
  2. #define ELF_H
  3. /**
  4. * @file
  5. *
  6. * ELF headers
  7. *
  8. */
  9. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  10. #include <stdint.h>
  11. typedef uint32_t Elf32_Addr;
  12. typedef uint16_t Elf32_Half;
  13. typedef uint32_t Elf32_Off;
  14. typedef int32_t Elf32_Sword;
  15. typedef uint32_t Elf32_Word;
  16. /** Length of ELF identifier */
  17. #define EI_NIDENT 16
  18. /** ELF header */
  19. typedef struct {
  20. unsigned char e_ident[EI_NIDENT];
  21. Elf32_Half e_type;
  22. Elf32_Half e_machine;
  23. Elf32_Word e_version;
  24. Elf32_Addr e_entry;
  25. Elf32_Off e_phoff;
  26. Elf32_Off e_shoff;
  27. Elf32_Word e_flags;
  28. Elf32_Half e_ehsize;
  29. Elf32_Half e_phentsize;
  30. Elf32_Half e_phnum;
  31. Elf32_Half e_shentsize;
  32. Elf32_Half e_shnum;
  33. Elf32_Half e_shstrndx;
  34. } Elf32_Ehdr;
  35. /* ELF identifier indexes */
  36. #define EI_MAG0 0
  37. #define EI_MAG1 1
  38. #define EI_MAG2 2
  39. #define EI_MAG3 3
  40. #define EI_CLASS 4
  41. #define EI_DATA 5
  42. #define EI_VERSION 6
  43. /* ELF magic signature bytes */
  44. #define ELFMAG0 0x7f
  45. #define ELFMAG1 'E'
  46. #define ELFMAG2 'L'
  47. #define ELFMAG3 'F'
  48. /* ELF classes */
  49. #define ELFCLASS32 1
  50. /* ELF data encodings */
  51. #define ELFDATA2LSB 1
  52. /* ELF versions */
  53. #define EV_CURRENT 1
  54. /** ELF program header */
  55. typedef struct {
  56. Elf32_Word p_type;
  57. Elf32_Off p_offset;
  58. Elf32_Addr p_vaddr;
  59. Elf32_Addr p_paddr;
  60. Elf32_Word p_filesz;
  61. Elf32_Word p_memsz;
  62. Elf32_Word p_flags;
  63. Elf32_Word p_align;
  64. } Elf32_Phdr;
  65. /* ELF segment types */
  66. #define PT_LOAD 1
  67. #endif /* ELF_H */