mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-20 16:51:37 +00:00
cr-restore.c: wrapped the restorer blob trampoline assembly into the macro JUMP_TO_RESTORER_BLOB.
Signed-off-by: Alexander Kartashov <alekskartashov@parallels.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
ba602791fd
commit
cbffef75b7
2 changed files with 22 additions and 11 deletions
18
arch/x86/include/asm/restore.h
Normal file
18
arch/x86/include/asm/restore.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef __CR_ASM_RESTORE_H__
|
||||
#define __CR_ASM_RESTORE_H__
|
||||
|
||||
#define JUMP_TO_RESTORER_BLOB(new_sp, restore_task_exec_start, \
|
||||
task_args) \
|
||||
asm volatile( \
|
||||
"movq %0, %%rbx \n" \
|
||||
"movq %1, %%rax \n" \
|
||||
"movq %2, %%rdi \n" \
|
||||
"movq %%rbx, %%rsp \n" \
|
||||
"callq *%%rax \n" \
|
||||
: \
|
||||
: "g"(new_sp), \
|
||||
"g"(restore_task_exec_start), \
|
||||
"g"(task_args) \
|
||||
: "rsp", "rdi", "rsi", "rbx", "rax", "memory")
|
||||
|
||||
#endif
|
||||
15
cr-restore.c
15
cr-restore.c
|
|
@ -61,6 +61,8 @@
|
|||
#include "protobuf/itimer.pb-c.h"
|
||||
#include "protobuf/vma.pb-c.h"
|
||||
|
||||
#include "asm/restore.h"
|
||||
|
||||
static struct pstree_item *current;
|
||||
|
||||
static int restore_task_with_children(void *);
|
||||
|
|
@ -1971,17 +1973,8 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
|
|||
* An indirect call to task_restore, note it never resturns
|
||||
* and restoreing core is extremely destructive.
|
||||
*/
|
||||
asm volatile(
|
||||
"movq %0, %%rbx \n"
|
||||
"movq %1, %%rax \n"
|
||||
"movq %2, %%rdi \n"
|
||||
"movq %%rbx, %%rsp \n"
|
||||
"callq *%%rax \n"
|
||||
:
|
||||
: "g"(new_sp),
|
||||
"g"(restore_task_exec_start),
|
||||
"g"(task_args)
|
||||
: "rsp", "rdi", "rsi", "rbx", "rax", "memory");
|
||||
|
||||
JUMP_TO_RESTORER_BLOB(new_sp, restore_task_exec_start, task_args);
|
||||
|
||||
err:
|
||||
free_mappings(&self_vma_list);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue