From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11267 invoked by alias); 24 Nov 2009 20:19:38 -0000 Received: (qmail 11188 invoked by uid 22791); 24 Nov 2009 20:19:37 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-ew0-f228.google.com (HELO mail-ew0-f228.google.com) (209.85.219.228) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 Nov 2009 20:19:29 +0000 Received: by ewy28 with SMTP id 28so3834302ewy.17 for ; Tue, 24 Nov 2009 12:19:26 -0800 (PST) Received: by 10.213.23.156 with SMTP id r28mr6716574ebb.86.1259093966007; Tue, 24 Nov 2009 12:19:26 -0800 (PST) Received: from nowhere (ADijon-552-1-123-3.w92-148.abo.wanadoo.fr [92.148.186.3]) by mx.google.com with ESMTPS id 16sm37138ewy.6.2009.11.24.12.19.21 (version=SSLv3 cipher=RC4-MD5); Tue, 24 Nov 2009 12:19:23 -0800 (PST) Received: by nowhere (nbSMTP-1.00) for uid 1000 (using TLSv1/SSLv3 with cipher RC4-MD5 (128/128 bits)) fweisbec@gmail.com; Tue, 24 Nov 2009 21:19:24 +0100 (CET) Date: Tue, 24 Nov 2009 20:19:00 -0000 From: Frederic Weisbecker To: Masami Hiramatsu Cc: Ingo Molnar , Ananth N Mavinakayanahalli , lkml , systemtap , DLE , Jim Keniston , Srikar Dronamraju , Christoph Hellwig , Steven Rostedt , "H. Peter Anvin" , Anders Kaseorg , Tim Abbott , Andi Kleen , Jason Baron , Mathieu Desnoyers Subject: Re: [PATCH -tip v5 06/10] kprobes/x86: Cleanup save/restore registers Message-ID: <20091124201919.GC5071@nowhere> References: <20091123232115.22071.71558.stgit@dhcp-100-2-132.bos.redhat.com> <20091123232204.22071.60562.stgit@dhcp-100-2-132.bos.redhat.com> <20091124025115.GB6752@nowhere> <4B0BFE21.7000102@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B0BFE21.7000102@redhat.com> User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2009-q4/txt/msg00678.txt.bz2 On Tue, Nov 24, 2009 at 10:39:13AM -0500, Masami Hiramatsu wrote: > Frederic Weisbecker wrote: > > 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? > > Yes, in both cases (kretprobe/optprpbe) it needs to > emulate kprobes behavior. kprobes can be used as > fault injection, it should pop pt_regs. > > > Is it possible to only save/restore the scratch ones? > > Hmm, what code did you mean? Ah this chain of push/pop is there to dump a struct pt_regs for the handler? Sorry, I just thought it was to save the registers from the probed function.