Revision 84409ddb linux-user/elfload.c
b/linux-user/elfload.c | ||
---|---|---|
44 | 44 |
return global_env->cpuid_features; |
45 | 45 |
} |
46 | 46 |
|
47 |
#ifdef TARGET_X86_64 |
|
48 |
#define ELF_START_MMAP 0x2aaaaab000ULL |
|
49 |
#define elf_check_arch(x) ( ((x) == ELF_ARCH) ) |
|
50 |
|
|
51 |
#define ELF_CLASS ELFCLASS64 |
|
52 |
#define ELF_DATA ELFDATA2LSB |
|
53 |
#define ELF_ARCH EM_X86_64 |
|
54 |
|
|
55 |
static inline void init_thread(struct target_pt_regs *regs, struct image_info *infop) |
|
56 |
{ |
|
57 |
regs->rax = 0; |
|
58 |
regs->rsp = infop->start_stack; |
|
59 |
regs->rip = infop->entry; |
|
60 |
} |
|
61 |
|
|
62 |
#else |
|
63 |
|
|
47 | 64 |
#define ELF_START_MMAP 0x80000000 |
48 | 65 |
|
49 | 66 |
/* |
... | ... | |
72 | 89 |
A value of 0 tells we have no such handler. */ |
73 | 90 |
regs->edx = 0; |
74 | 91 |
} |
92 |
#endif |
|
75 | 93 |
|
76 | 94 |
#define USE_ELF_CORE_DUMP |
77 | 95 |
#define ELF_EXEC_PAGESIZE 4096 |
... | ... | |
177 | 195 |
|
178 | 196 |
#define ELF_START_MMAP 0x80000000 |
179 | 197 |
|
198 |
#ifdef TARGET_PPC64 |
|
199 |
|
|
200 |
#define elf_check_arch(x) ( (x) == EM_PPC64 ) |
|
201 |
|
|
202 |
#define ELF_CLASS ELFCLASS64 |
|
203 |
|
|
204 |
#else |
|
205 |
|
|
180 | 206 |
#define elf_check_arch(x) ( (x) == EM_PPC ) |
181 | 207 |
|
182 | 208 |
#define ELF_CLASS ELFCLASS32 |
209 |
|
|
210 |
#endif |
|
211 |
|
|
183 | 212 |
#ifdef TARGET_WORDS_BIGENDIAN |
184 | 213 |
#define ELF_DATA ELFDATA2MSB |
185 | 214 |
#else |
... | ... | |
222 | 251 |
{ |
223 | 252 |
target_ulong pos = infop->start_stack; |
224 | 253 |
target_ulong tmp; |
254 |
#ifdef TARGET_PPC64 |
|
255 |
target_ulong entry, toc; |
|
256 |
#endif |
|
225 | 257 |
|
226 | 258 |
_regs->msr = 1 << MSR_PR; /* Set user mode */ |
227 | 259 |
_regs->gpr[1] = infop->start_stack; |
260 |
#ifdef TARGET_PPC64 |
|
261 |
entry = ldq_raw(infop->entry) + infop->load_addr; |
|
262 |
toc = ldq_raw(infop->entry + 8) + infop->load_addr; |
|
263 |
_regs->gpr[2] = toc; |
|
264 |
infop->entry = entry; |
|
265 |
#endif |
|
228 | 266 |
_regs->nip = infop->entry; |
229 | 267 |
/* Note that isn't exactly what regular kernel does |
230 | 268 |
* but this is what the ABI wants and is needed to allow |
... | ... | |
917 | 955 |
unsigned long elf_entry, interp_load_addr = 0; |
918 | 956 |
int status; |
919 | 957 |
unsigned long start_code, end_code, end_data; |
958 |
unsigned long reloc_func_desc = 0; |
|
920 | 959 |
unsigned long elf_stack; |
921 | 960 |
char passed_fileno[6]; |
922 | 961 |
|
... | ... | |
1181 | 1220 |
load_bias += error - |
1182 | 1221 |
TARGET_ELF_PAGESTART(load_bias + elf_ppnt->p_vaddr); |
1183 | 1222 |
load_addr += load_bias; |
1223 |
reloc_func_desc = load_bias; |
|
1184 | 1224 |
} |
1185 | 1225 |
} |
1186 | 1226 |
k = elf_ppnt->p_vaddr; |
... | ... | |
1213 | 1253 |
elf_entry = load_elf_interp(&interp_elf_ex, interpreter_fd, |
1214 | 1254 |
&interp_load_addr); |
1215 | 1255 |
} |
1256 |
reloc_func_desc = interp_load_addr; |
|
1216 | 1257 |
|
1217 | 1258 |
close(interpreter_fd); |
1218 | 1259 |
free(elf_interpreter); |
Also available in: Unified diff