Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753212AbYKQFGb (ORCPT ); Mon, 17 Nov 2008 00:06:31 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750831AbYKQFGV (ORCPT ); Mon, 17 Nov 2008 00:06:21 -0500 Received: from ozlabs.org ([203.10.76.45]:46158 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750764AbYKQFGU (ORCPT ); Mon, 17 Nov 2008 00:06:20 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18720.64083.306981.779763@drongo.ozlabs.ibm.com> Date: Mon, 17 Nov 2008 16:00:03 +1100 From: Paul Mackerras To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , Thomas Gleixner , Peter Zijlstra , David Miller , Benjamin Herrenschmidt , Frederic Weisbecker , Pekka Paalanen , linuxppc-dev@ozlabs.org, Rusty Russell , Paul Mundt , Steven Rostedt Subject: Re: [PATCH 5/7] ftrace, PPC64: handle module trampolines for dyn ftrace In-Reply-To: <20081116212516.000516128@goodmis.org> References: <20081116212428.938752312@goodmis.org> <20081116212516.000516128@goodmis.org> X-Mailer: VM 8.0.11 under Emacs 22.2.1 (powerpc-unknown-linux-gnu) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1323 Lines: 50 Steven Rostedt writes: > + if (!rec->arch.mod) { > + if (!mod) { > + printk(KERN_ERR "No module loaded addr=%lx\n", > + addr); > + return -EFAULT; > + } > + rec->arch.mod = mod; > + } else if (mod) { > + printk(KERN_ERR > + "Record mod %p not equal to passed in mod %p\n", > + rec->arch.mod, mod); > + return -EINVAL; That looks wrong; surely you need an if (mod != rec->arch.mod) somewhere here? > + /* Make sure that that this is still a 24bit jump */ > + if ((*op & 0xff000000) != 0x48000000) { > + printk(KERN_ERR "Not expected bl: opcode is %x\n", *op); > + return -EINVAL; > + } Needs to be if ((*op & 0xfc000003) != 0x48000001) since the major opcode is the top 6 bits, and the bottom 2 bits are the link bit and the absolute address bit. > + /* lets find where the pointer goes */ > + offset = (*op & 0x03fffffc); > + /* make it signed */ > + if (offset & 0x02000000) > + offset |= 0xfe000000; but you got that right... :) > + /* get the address this jumps too */ > + tramp = mod->arch.toc + offset + 32; Why + 32? Paul. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/