Commit 1e5635da authored by Alexander Kartashov's avatar Alexander Kartashov Committed by Pavel Emelyanov

restorer: wrapped the assembly calling sys_rt_sigreturn into the macro ARCH_RT_SIGRETURN.

Signed-off-by: 's avatarAlexander Kartashov <alekskartashov@parallels.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent abc622b3
...@@ -71,6 +71,18 @@ struct rt_sigframe { ...@@ -71,6 +71,18 @@ struct rt_sigframe {
/* fp state follows here */ /* fp state follows here */
}; };
#define ARCH_RT_SIGRETURN(new_sp) \
asm volatile( \
"movq %0, %%rax \n" \
"movq %%rax, %%rsp \n" \
"movl $"__stringify(__NR_rt_sigreturn)", %%eax \n" \
"syscall \n" \
: \
: "r"(new_sp) \
: "rax","rsp","memory")
int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r); int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r);
int restore_fpu(struct rt_sigframe *sigframe, struct thread_restore_args *args); int restore_fpu(struct rt_sigframe *sigframe, struct thread_restore_args *args);
......
...@@ -198,14 +198,8 @@ long __export_restore_thread(struct thread_restore_args *args) ...@@ -198,14 +198,8 @@ long __export_restore_thread(struct thread_restore_args *args)
futex_dec_and_wake(&thread_inprogress); futex_dec_and_wake(&thread_inprogress);
new_sp = (long)rt_sigframe + 8; new_sp = (long)rt_sigframe + 8;
asm volatile( ARCH_RT_SIGRETURN(new_sp);
"movq %0, %%rax \n"
"movq %%rax, %%rsp \n"
"movl $"__stringify(__NR_rt_sigreturn)", %%eax \n"
"syscall \n"
:
: "r"(new_sp)
: "rax","rsp","memory");
core_restore_end: core_restore_end:
pr_err("Restorer abnormal termination for %ld\n", sys_getpid()); pr_err("Restorer abnormal termination for %ld\n", sys_getpid());
sys_exit_group(1); sys_exit_group(1);
...@@ -746,14 +740,7 @@ long __export_restore_task(struct task_restore_core_args *args) ...@@ -746,14 +740,7 @@ long __export_restore_task(struct task_restore_core_args *args)
* pure assembly since we don't need any additional * pure assembly since we don't need any additional
* code insns from gcc. * code insns from gcc.
*/ */
asm volatile( ARCH_RT_SIGRETURN(new_sp);
"movq %0, %%rax \n"
"movq %%rax, %%rsp \n"
"movl $"__stringify(__NR_rt_sigreturn)", %%eax \n"
"syscall \n"
:
: "r"(new_sp)
: "rax","rsp","memory");
core_restore_end: core_restore_end:
pr_err("Restorer fail %ld\n", sys_getpid()); pr_err("Restorer fail %ld\n", sys_getpid());
......
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