Commit cbffef75 authored by Alexander Kartashov's avatar Alexander Kartashov Committed by Pavel Emelyanov

cr-restore.c: wrapped the restorer blob trampoline assembly into the macro JUMP_TO_RESTORER_BLOB.

Signed-off-by: 's avatarAlexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ba602791
#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
...@@ -61,6 +61,8 @@ ...@@ -61,6 +61,8 @@
#include "protobuf/itimer.pb-c.h" #include "protobuf/itimer.pb-c.h"
#include "protobuf/vma.pb-c.h" #include "protobuf/vma.pb-c.h"
#include "asm/restore.h"
static struct pstree_item *current; static struct pstree_item *current;
static int restore_task_with_children(void *); static int restore_task_with_children(void *);
...@@ -1971,17 +1973,8 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core) ...@@ -1971,17 +1973,8 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
* An indirect call to task_restore, note it never resturns * An indirect call to task_restore, note it never resturns
* and restoreing core is extremely destructive. * and restoreing core is extremely destructive.
*/ */
asm volatile(
"movq %0, %%rbx \n" JUMP_TO_RESTORER_BLOB(new_sp, restore_task_exec_start, task_args);
"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");
err: err:
free_mappings(&self_vma_list); free_mappings(&self_vma_list);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment