mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-31 06:15:24 +00:00
restorer: Compact rst stack evaluation code
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
@@ -2538,11 +2538,7 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
|
||||
task_args->vdso_rt_parked_at = (unsigned long)mem + vdso_rt_delta;
|
||||
task_args->vdso_sym_rt = vdso_sym_rt;
|
||||
|
||||
/*
|
||||
* Adjust stack.
|
||||
*/
|
||||
new_sp = RESTORE_ALIGN_STACK((long)task_args->t->mem_zone.stack,
|
||||
sizeof(task_args->t->mem_zone.stack));
|
||||
new_sp = restorer_stack(task_args->t);
|
||||
|
||||
/* No longer need it */
|
||||
core_entry__free_unpacked(core, NULL);
|
||||
|
@@ -43,9 +43,6 @@ typedef long (*thread_restore_fcall_t) (struct thread_restore_args *args);
|
||||
#define RESTORE_STACK_SIGFRAME ALIGN(sizeof(struct rt_sigframe) + SIGFRAME_OFFSET, 64)
|
||||
#define RESTORE_STACK_SIZE (KILO(32))
|
||||
|
||||
#define RESTORE_ALIGN_STACK(start, size) \
|
||||
(ALIGN((start) + (size) - sizeof(long), sizeof(long)))
|
||||
|
||||
struct restore_mem_zone {
|
||||
u8 redzone[RESTORE_STACK_REDZONE];
|
||||
u8 stack[RESTORE_STACK_SIZE];
|
||||
@@ -154,6 +151,14 @@ struct task_restore_core_args {
|
||||
|
||||
#define SHMEMS_SIZE 4096
|
||||
|
||||
#define RESTORE_ALIGN_STACK(start, size) \
|
||||
(ALIGN((start) + (size) - sizeof(long), sizeof(long)))
|
||||
|
||||
static inline unsigned long restorer_stack(struct thread_restore_args *a)
|
||||
{
|
||||
return RESTORE_ALIGN_STACK((long)a->mem_zone.stack, RESTORE_STACK_SIZE);
|
||||
}
|
||||
|
||||
/*
|
||||
* pid is a pid of a creater
|
||||
* start, end are used for open mapping
|
||||
|
@@ -824,10 +824,7 @@ long __export_restore_task(struct task_restore_core_args *args)
|
||||
if (thread_args[i].pid == args->t->pid)
|
||||
continue;
|
||||
|
||||
new_sp =
|
||||
RESTORE_ALIGN_STACK((long)thread_args[i].mem_zone.stack,
|
||||
sizeof(thread_args[i].mem_zone.stack));
|
||||
|
||||
new_sp = restorer_stack(thread_args + i);
|
||||
last_pid_len = vprint_num(last_pid_buf, sizeof(last_pid_buf), thread_args[i].pid - 1, &s);
|
||||
ret = sys_write(fd, s, last_pid_len);
|
||||
if (ret < 0) {
|
||||
|
Reference in New Issue
Block a user