This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH -tip v5 06/10] kprobes/x86: Cleanup save/restore registers


On Mon, Nov 23, 2009 at 06:22:04PM -0500, Masami Hiramatsu wrote:
> +#ifdef CONFIG_X86_64
> +#define SAVE_REGS_STRING		\
> +	/* Skip cs, ip, orig_ax. */	\
> +	"	subq $24, %rsp\n"	\
> +	"	pushq %rdi\n"		\
> +	"	pushq %rsi\n"		\
> +	"	pushq %rdx\n"		\
> +	"	pushq %rcx\n"		\
> +	"	pushq %rax\n"		\
> +	"	pushq %r8\n"		\
> +	"	pushq %r9\n"		\
> +	"	pushq %r10\n"		\
> +	"	pushq %r11\n"		\
> +	"	pushq %rbx\n"		\
> +	"	pushq %rbp\n"		\
> +	"	pushq %r12\n"		\
> +	"	pushq %r13\n"		\
> +	"	pushq %r14\n"		\
> +	"	pushq %r15\n"
> +#define RESTORE_REGS_STRING		\
> +	"	popq %r15\n"		\
> +	"	popq %r14\n"		\
> +	"	popq %r13\n"		\
> +	"	popq %r12\n"		\
> +	"	popq %rbp\n"		\
> +	"	popq %rbx\n"		\
> +	"	popq %r11\n"		\
> +	"	popq %r10\n"		\
> +	"	popq %r9\n"		\
> +	"	popq %r8\n"		\
> +	"	popq %rax\n"		\
> +	"	popq %rcx\n"		\
> +	"	popq %rdx\n"		\
> +	"	popq %rsi\n"		\
> +	"	popq %rdi\n"		\


BTW, do you really need to push/pop every registers
before/after calling a probe handler?

Is it possible to only save/restore the scratch ones?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]