Revision 7983f435 linux-user/elfload.c
b/linux-user/elfload.c | ||
---|---|---|
512 | 512 |
|
513 | 513 |
static inline void init_thread(struct target_pt_regs *_regs, struct image_info *infop) |
514 | 514 |
{ |
515 |
abi_ulong pos = infop->start_stack; |
|
516 |
abi_ulong tmp; |
|
517 |
#if defined(TARGET_PPC64) && !defined(TARGET_ABI32) |
|
518 |
abi_ulong entry, toc; |
|
519 |
#endif |
|
520 |
|
|
521 | 515 |
_regs->gpr[1] = infop->start_stack; |
522 | 516 |
#if defined(TARGET_PPC64) && !defined(TARGET_ABI32) |
523 |
entry = ldq_raw(infop->entry) + infop->load_addr; |
|
524 |
toc = ldq_raw(infop->entry + 8) + infop->load_addr; |
|
525 |
_regs->gpr[2] = toc; |
|
526 |
infop->entry = entry; |
|
517 |
_regs->gpr[2] = ldq_raw(infop->entry + 8) + infop->load_addr; |
|
518 |
infop->entry = ldq_raw(infop->entry) + infop->load_addr; |
|
527 | 519 |
#endif |
528 | 520 |
_regs->nip = infop->entry; |
529 |
/* Note that isn't exactly what regular kernel does |
|
530 |
* but this is what the ABI wants and is needed to allow |
|
531 |
* execution of PPC BSD programs. |
|
532 |
*/ |
|
533 |
/* FIXME - what to for failure of get_user()? */ |
|
534 |
get_user_ual(_regs->gpr[3], pos); |
|
535 |
pos += sizeof(abi_ulong); |
|
536 |
_regs->gpr[4] = pos; |
|
537 |
for (tmp = 1; tmp != 0; pos += sizeof(abi_ulong)) |
|
538 |
tmp = ldl(pos); |
|
539 |
_regs->gpr[5] = pos; |
|
540 | 521 |
} |
541 | 522 |
|
542 | 523 |
/* See linux kernel: arch/powerpc/include/asm/elf.h. */ |
Also available in: Unified diff