[CRIU] [PATCH 04/12] x86: parasite -- Add call_daemon_thread and asm_trap helpers

Pavel Emelyanov xemul at parallels.com
Fri Mar 1 13:47:05 EST 2013


On 02/28/2013 07:35 PM, Cyrill Gorcunov wrote:
> 
> call_daemon_thread will be needed to run thread daemon
> with own stack, while asm_trap is just a wrap over trapping
> instruction for portability sake.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  arch/x86/include/asm/parasite.h | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 


> +/*
> + * Call thread daemon with new stack, the function must
> + * return the original stack pointer passed in argument
> + * argument 3
> + */
> +#define call_daemon_thread(new_sp, args, s, func)	\
> +do {							\
> +	asm volatile ("movq %0, %%rax		\n"	\
> +		      "movq %1, %%rdi		\n"	\
> +		      "movq %2, %%rsi		\n"	\
> +		      "movq %%rsp, %%rdx	\n"	\
> +		      "movq %%rax, %%rsp	\n"	\
> +		      "call " #func "		\n"	\
> +		      "movq %%rax, %%rsp	\n"	\
> +		      :					\
> +		      : "g"(new_sp), "g"(args), "g"(s)	\
> +		      : "rax", "rdi", "rsi", "rdx",	\
> +		        "rsp", "memory");		\
> +} while (0)

O_O What we have in parasite blob does has stack. Why can't we use
_it_ to run parasite as daemon?


More information about the CRIU mailing list