pie: x86-32 -- Prepare parasite head

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov 2015-06-05 00:04:07 +03:00 committed by Pavel Emelyanov
parent b07bbf8152
commit e04f683d85
3 changed files with 32 additions and 1 deletions

View file

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

View file

@ -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 */

View file

@ -690,7 +690,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);