[CRIU] [PATCH 6/8] pie: x86-32 -- Prepare parasite head
Cyrill Gorcunov
gorcunov at openvz.org
Mon May 11 09:06:22 PDT 2015
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
arch/x86/include/asm/parasite.h | 4 ++++
arch/x86/parasite-head.S | 23 +++++++++++++++++++++++
pie/parasite.c | 6 +++++-
3 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/parasite.h b/arch/x86/include/asm/parasite.h
index 48e48ac988b7..669ae63e26cc 100644
--- a/arch/x86/include/asm/parasite.h
+++ b/arch/x86/include/asm/parasite.h
@@ -1,6 +1,10 @@
#ifndef __ASM_PARASITE_H__
#define __ASM_PARASITE_H__
+#ifdef CONFIG_X86_32
+# define __parasite_entry __attribute__((regparm(3)))
+#endif
+
static inline void arch_get_tls(tls_t *ptls) { (void)ptls; }
#endif
diff --git a/arch/x86/parasite-head.S b/arch/x86/parasite-head.S
index 8caf9b3b9172..b61b712f7a86 100644
--- a/arch/x86/parasite-head.S
+++ b/arch/x86/parasite-head.S
@@ -2,6 +2,9 @@
#include "parasite.h"
.section .head.text, "ax"
+
+#ifdef CONFIG_X86_64
+
ENTRY(__export_parasite_head_start)
subq $16, %rsp
andq $~15, %rsp
@@ -15,3 +18,23 @@ ENTRY(__export_parasite_head_start)
__export_parasite_cmd:
.long 0
END(__export_parasite_head_start)
+
+#else /* CONFIG_X86_64 */
+
+ENTRY(__export_parasite_head_start)
+ subl $8, %esp
+ andl $~7, %esp
+ pushl $0
+ movl %esp, %ebp
+ call 1f
+1: popl %ecx
+2: leal (__export_parasite_cmd-2b)(%ecx), %eax
+ leal (__export_parasite_args-2b)(%ecx), %edx
+ call parasite_service
+ int $0x03
+ .align 8
+GLOBAL(__export_parasite_cmd)
+ .long 0
+END(__export_parasite_head_start)
+
+#endif /* CONFIG_X86_64 */
diff --git a/pie/parasite.c b/pie/parasite.c
index 9961b2fba84e..c79a3803ec86 100644
--- a/pie/parasite.c
+++ b/pie/parasite.c
@@ -686,7 +686,11 @@ err:
return -1;
}
-int __used parasite_service(unsigned int cmd, void *args)
+#ifndef __parasite_entry
+# define __parasite_entry
+#endif
+
+int __used __parasite_entry parasite_service(unsigned int cmd, void *args)
{
pr_info("Parasite cmd %d/%x process\n", cmd, cmd);
--
2.1.0
More information about the CRIU
mailing list