lkml.org 
[lkml]   [2014]   [Aug]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH] kprobes: arm: enable OPTPROBES for arm 32
On Wed, Aug 06, 2014 at 03:23:23PM +0100, Jon Medhurst (Tixy) wrote:
> On Tue, 2014-08-05 at 15:28 +0800, Wang Nan wrote:
> > +static inline int
> > +arm_branch_to_addr(unsigned int *pinst, void *src, void *dest)
> > +{
> > + unsigned int inst = 0xea000000;
> > + long offset = (unsigned long)(dest) -
> > + ((unsigned long)(src) + 8);
> > + if ((offset > 0x3fffffc) || (offset < -0x3fffffc)) {
> > + printk(KERN_WARNING "Failed to instrument %pS to %pS\n", src, dest);
> > + return -EINVAL;
> > + }
> > +
> > + inst |= (((unsigned long)offset) >> 2) & (0x00ffffffUL);
> > + *pinst = inst;
> > + return 0;
> > +}
> > +
>
> This looks remarkably similar to the code in arch/arm/kernel/insn.c so I
> think you can probably just use the existing arm_gen_branch() function.

Which would be a better idea as the version found in insn.c is not
buggy.

--
FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up
according to speedtest.net.


\
 
 \ /
  Last update: 2014-08-07 01:21    [W:0.074 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site