[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <18720.64083.306981.779763@drongo.ozlabs.ibm.com>
Date:	Mon, 17 Nov 2008 16:00:03 +1100
From:	Paul Mackerras <paulus@...ba.org>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Peter Zijlstra <peterz@...radead.org>,
	David Miller <davem@...emloft.net>,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Pekka Paalanen <pq@....fi>, linuxppc-dev@...abs.org,
	Rusty Russell <rusty@...tcorp.com.au>,
	Paul Mundt <lethal@...ux-sh.org>,
	Steven Rostedt <srostedt@...hat.com>
Subject: Re: [PATCH 5/7] ftrace, PPC64: handle module trampolines for dyn ftrace
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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Powered by blists - more mailing lists
 
