mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
compel: Fix ppc64le parasite stack layout
The ppc64le ABI allows functions to store data in caller frames. When initializing the stack pointer prior to executing parasite code we need to pre-allocating the minimum sized stack frame before jumping to the parasite code. Signed-off-by: Younes Manton <ymanton@ca.ibm.com>
This commit is contained in:
parent
17ec539132
commit
a39d416568
2 changed files with 7 additions and 2 deletions
|
|
@ -23,6 +23,11 @@
|
|||
|
||||
/* Copied from the Linux kernel header arch/powerpc/include/asm/ptrace.h */
|
||||
#define USER_REDZONE_SIZE 512
|
||||
#if _CALL_ELF != 2
|
||||
#error Only supporting ABIv2.
|
||||
#else
|
||||
#define STACK_FRAME_MIN_SIZE 32
|
||||
#endif
|
||||
|
||||
/* Copied from the Linux kernel source file arch/powerpc/kernel/signal_64.c */
|
||||
#define TRAMP_SIZE 6
|
||||
|
|
|
|||
|
|
@ -441,13 +441,13 @@ void *remote_mmap(struct parasite_ctl *ctl, void *addr, size_t length, int prot,
|
|||
void parasite_setup_regs(unsigned long new_ip, void *stack, user_regs_struct_t *regs)
|
||||
{
|
||||
/*
|
||||
* OpenPOWER ABI requires that r12 is set to the calling function addressi
|
||||
* OpenPOWER ABI requires that r12 is set to the calling function address
|
||||
* to compute the TOC pointer.
|
||||
*/
|
||||
regs->gpr[12] = new_ip;
|
||||
regs->nip = new_ip;
|
||||
if (stack)
|
||||
regs->gpr[1] = (unsigned long)stack;
|
||||
regs->gpr[1] = (unsigned long)stack - STACK_FRAME_MIN_SIZE;
|
||||
regs->trap = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue