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:
Alexander Kartashov 2013-01-09 17:39:23 +04:00 committed by Pavel Emelyanov
parent ba602791fd
commit cbffef75b7
2 changed files with 22 additions and 11 deletions

View 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

View file

@ -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);