Re: [PATCH 5/7] ftrace, PPC64: handle module trampolines for dyn ftrace

From: Paul Mackerras
Date: Mon Nov 17 2008 - 00:06:50 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/