[CRIU] [PATCH 13/22] restorer: wrapped the assembly code executed on a rt_sigreturn failure into the macro ARCH_FAIL_CORE_RESTORE
Alexander Kartashov
alekskartashov at parallels.com
Thu Dec 27 01:51:04 EST 2012
Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
---
arch/x86/include/asm/restorer.h | 9 +++++++++
pie/restorer.c | 9 ++-------
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/arch/x86/include/asm/restorer.h b/arch/x86/include/asm/restorer.h
index 5172170..1ccc93c 100644
--- a/arch/x86/include/asm/restorer.h
+++ b/arch/x86/include/asm/restorer.h
@@ -120,6 +120,15 @@ struct rt_sigframe {
"g"(&thread_args[i]) \
: "rax", "rdi", "rsi", "rdx", "r10", "memory")
+#define ARCH_FAIL_CORE_RESTORE \
+ asm volatile( \
+ "movq %0, %%rsp \n" \
+ "movq 0, %%rax \n" \
+ "jmp *%%rax \n" \
+ : \
+ : "r"(ret) \
+ : "memory")
+
int restore_gpregs(struct rt_sigframe *f, UserX86RegsEntry *r);
diff --git a/pie/restorer.c b/pie/restorer.c
index 69e056c..04e7ab5 100644
--- a/pie/restorer.c
+++ b/pie/restorer.c
@@ -706,12 +706,7 @@ core_restore_end:
return -1;
core_restore_failed:
- asm volatile(
- "movq %0, %%rsp \n"
- "movq 0, %%rax \n"
- "jmp *%%rax \n"
- :
- : "r"(ret)
- : "memory");
+ ARCH_FAIL_CORE_RESTORE;
+
return ret;
}
--
1.7.10.4
More information about the CRIU
mailing list