~ubuntu-branches/ubuntu/precise/linux-lowlatency/precise

« back to all changes in this revision

Viewing changes to arch/powerpc/boot/elf.h

  • Committer: Package Import Robot
  • Author(s): Alessio Igor Bogani
  • Date: 2011-10-26 11:13:05 UTC
  • Revision ID: package-import@ubuntu.com-20111026111305-tz023xykf0i6eosh
Tags: upstream-3.2.0
ImportĀ upstreamĀ versionĀ 3.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _PPC_BOOT_ELF_H_
 
2
#define _PPC_BOOT_ELF_H_
 
3
 
 
4
/* 32-bit ELF base types. */
 
5
typedef unsigned int Elf32_Addr;
 
6
typedef unsigned short Elf32_Half;
 
7
typedef unsigned int Elf32_Off;
 
8
typedef signed int Elf32_Sword;
 
9
typedef unsigned int Elf32_Word;
 
10
 
 
11
/* 64-bit ELF base types. */
 
12
typedef unsigned long long Elf64_Addr;
 
13
typedef unsigned short Elf64_Half;
 
14
typedef signed short Elf64_SHalf;
 
15
typedef unsigned long long Elf64_Off;
 
16
typedef signed int Elf64_Sword;
 
17
typedef unsigned int Elf64_Word;
 
18
typedef unsigned long long Elf64_Xword;
 
19
typedef signed long long Elf64_Sxword;
 
20
 
 
21
/* These constants are for the segment types stored in the image headers */
 
22
#define PT_NULL    0
 
23
#define PT_LOAD    1
 
24
#define PT_DYNAMIC 2
 
25
#define PT_INTERP  3
 
26
#define PT_NOTE    4
 
27
#define PT_SHLIB   5
 
28
#define PT_PHDR    6
 
29
#define PT_TLS     7            /* Thread local storage segment */
 
30
#define PT_LOOS    0x60000000   /* OS-specific */
 
31
#define PT_HIOS    0x6fffffff   /* OS-specific */
 
32
#define PT_LOPROC  0x70000000
 
33
#define PT_HIPROC  0x7fffffff
 
34
#define PT_GNU_EH_FRAME         0x6474e550
 
35
 
 
36
#define PT_GNU_STACK    (PT_LOOS + 0x474e551)
 
37
 
 
38
/* These constants define the different elf file types */
 
39
#define ET_NONE   0
 
40
#define ET_REL    1
 
41
#define ET_EXEC   2
 
42
#define ET_DYN    3
 
43
#define ET_CORE   4
 
44
#define ET_LOPROC 0xff00
 
45
#define ET_HIPROC 0xffff
 
46
 
 
47
/* These constants define the various ELF target machines */
 
48
#define EM_NONE  0
 
49
#define EM_PPC         20       /* PowerPC */
 
50
#define EM_PPC64       21       /* PowerPC64 */
 
51
 
 
52
#define EI_NIDENT       16
 
53
 
 
54
typedef struct elf32_hdr {
 
55
        unsigned char e_ident[EI_NIDENT];
 
56
        Elf32_Half e_type;
 
57
        Elf32_Half e_machine;
 
58
        Elf32_Word e_version;
 
59
        Elf32_Addr e_entry;     /* Entry point */
 
60
        Elf32_Off e_phoff;
 
61
        Elf32_Off e_shoff;
 
62
        Elf32_Word e_flags;
 
63
        Elf32_Half e_ehsize;
 
64
        Elf32_Half e_phentsize;
 
65
        Elf32_Half e_phnum;
 
66
        Elf32_Half e_shentsize;
 
67
        Elf32_Half e_shnum;
 
68
        Elf32_Half e_shstrndx;
 
69
} Elf32_Ehdr;
 
70
 
 
71
typedef struct elf64_hdr {
 
72
        unsigned char e_ident[16];      /* ELF "magic number" */
 
73
        Elf64_Half e_type;
 
74
        Elf64_Half e_machine;
 
75
        Elf64_Word e_version;
 
76
        Elf64_Addr e_entry;     /* Entry point virtual address */
 
77
        Elf64_Off e_phoff;      /* Program header table file offset */
 
78
        Elf64_Off e_shoff;      /* Section header table file offset */
 
79
        Elf64_Word e_flags;
 
80
        Elf64_Half e_ehsize;
 
81
        Elf64_Half e_phentsize;
 
82
        Elf64_Half e_phnum;
 
83
        Elf64_Half e_shentsize;
 
84
        Elf64_Half e_shnum;
 
85
        Elf64_Half e_shstrndx;
 
86
} Elf64_Ehdr;
 
87
 
 
88
/* These constants define the permissions on sections in the program
 
89
   header, p_flags. */
 
90
#define PF_R            0x4
 
91
#define PF_W            0x2
 
92
#define PF_X            0x1
 
93
 
 
94
typedef struct elf32_phdr {
 
95
        Elf32_Word p_type;
 
96
        Elf32_Off p_offset;
 
97
        Elf32_Addr p_vaddr;
 
98
        Elf32_Addr p_paddr;
 
99
        Elf32_Word p_filesz;
 
100
        Elf32_Word p_memsz;
 
101
        Elf32_Word p_flags;
 
102
        Elf32_Word p_align;
 
103
} Elf32_Phdr;
 
104
 
 
105
typedef struct elf64_phdr {
 
106
        Elf64_Word p_type;
 
107
        Elf64_Word p_flags;
 
108
        Elf64_Off p_offset;     /* Segment file offset */
 
109
        Elf64_Addr p_vaddr;     /* Segment virtual address */
 
110
        Elf64_Addr p_paddr;     /* Segment physical address */
 
111
        Elf64_Xword p_filesz;   /* Segment size in file */
 
112
        Elf64_Xword p_memsz;    /* Segment size in memory */
 
113
        Elf64_Xword p_align;    /* Segment alignment, file & memory */
 
114
} Elf64_Phdr;
 
115
 
 
116
#define EI_MAG0         0       /* e_ident[] indexes */
 
117
#define EI_MAG1         1
 
118
#define EI_MAG2         2
 
119
#define EI_MAG3         3
 
120
#define EI_CLASS        4
 
121
#define EI_DATA         5
 
122
#define EI_VERSION      6
 
123
#define EI_OSABI        7
 
124
#define EI_PAD          8
 
125
 
 
126
#define ELFMAG0         0x7f    /* EI_MAG */
 
127
#define ELFMAG1         'E'
 
128
#define ELFMAG2         'L'
 
129
#define ELFMAG3         'F'
 
130
#define ELFMAG          "\177ELF"
 
131
#define SELFMAG         4
 
132
 
 
133
#define ELFCLASSNONE    0       /* EI_CLASS */
 
134
#define ELFCLASS32      1
 
135
#define ELFCLASS64      2
 
136
#define ELFCLASSNUM     3
 
137
 
 
138
#define ELFDATANONE     0       /* e_ident[EI_DATA] */
 
139
#define ELFDATA2LSB     1
 
140
#define ELFDATA2MSB     2
 
141
 
 
142
#define EV_NONE         0       /* e_version, EI_VERSION */
 
143
#define EV_CURRENT      1
 
144
#define EV_NUM          2
 
145
 
 
146
#define ELFOSABI_NONE   0
 
147
#define ELFOSABI_LINUX  3
 
148
 
 
149
struct elf_info {
 
150
        unsigned long loadsize;
 
151
        unsigned long memsize;
 
152
        unsigned long elfoffset;
 
153
};
 
154
int parse_elf64(void *hdr, struct elf_info *info);
 
155
int parse_elf32(void *hdr, struct elf_info *info);
 
156
 
 
157
#endif                          /* _PPC_BOOT_ELF_H_ */