From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15326 invoked by alias); 24 Nov 2009 15:36:59 -0000 Received: (qmail 15160 invoked by uid 22791); 24 Nov 2009 15:36:58 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 24 Nov 2009 15:36:50 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAOFamb2009072 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 24 Nov 2009 10:36:49 -0500 Received: from [10.11.10.221] (vpn-10-221.rdu.redhat.com [10.11.10.221]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nAOFakXD001436; Tue, 24 Nov 2009 10:36:46 -0500 Message-ID: <4B0BFE21.7000102@redhat.com> Date: Tue, 24 Nov 2009 15:36:00 -0000 From: Masami Hiramatsu User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.4pre) Gecko/20090922 Fedora/3.0-2.7.b4.fc11 Thunderbird/3.0b4 MIME-Version: 1.0 To: Frederic Weisbecker 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 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> In-Reply-To: <20091124025115.GB6752@nowhere> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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/msg00662.txt.bz2 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? Thank you, -- Masami Hiramatsu Software Engineer Hitachi Computer Products (America), Inc. Software Solutions Division e-mail: mhiramat@redhat.com