From: tixy@yxit.co.uk (Tixy)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] ARM: kprobes: Fix probing of conditionally executed instructions
Date: Tue, 05 Apr 2011 07:53:20 +0100 [thread overview]
Message-ID: <1301986400.2609.26.camel@computer2.home> (raw)
In-Reply-To: <alpine.LFD.2.00.1104041647400.28032@xanadu.home>
On Mon, 2011-04-04 at 17:00 -0400, Nicolas Pitre wrote:
> On Mon, 4 Apr 2011, Tixy wrote:
>
> > diff --git a/arch/arm/kernel/kprobes-decode.c b/arch/arm/kernel/kprobes-decode.c
> > index 8f6ed43..c88c8d2 100644
> > --- a/arch/arm/kernel/kprobes-decode.c
> > +++ b/arch/arm/kernel/kprobes-decode.c
> > @@ -63,6 +63,7 @@
> >
> > #include <linux/kernel.h>
> > #include <linux/kprobes.h>
> > +#include "kprobes-decode.h"
> >
> > #define sign_extend(x, signbit) ((x) | (0 - ((x) & (1 << (signbit)))))
> >
> > @@ -1384,6 +1385,13 @@ space_cccc_111x(kprobe_opcode_t insn, struct arch_specific_insn *asi)
> > return INSN_GOOD;
> > }
> >
> > +static kprobe_check_cc* const condition_checks[16] = {
> > + &__check_eq, &__check_ne, &__check_cs, &__check_cc,
> > + &__check_mi, &__check_pl, &__check_vs, &__check_vc,
> > + &__check_hi, &__check_ls, &__check_ge, &__check_lt,
> > + &__check_gt, &__check_le, &__check_al, &__check_al
> > +};
>
> Here you create an array of function pointers.
>
> > diff --git a/arch/arm/kernel/kprobes-decode.h b/arch/arm/kernel/kprobes-decode.h
> > new file mode 100644
> > index 0000000..d6b4337
> > --- /dev/null
> > +++ b/arch/arm/kernel/kprobes-decode.h
> > @@ -0,0 +1,98 @@
> > +/*
> > + * arch/arm/kernel/kprobes-decode.h
> > + *
> > + * Copyright (C) 2011 Jon Medhurst <tixy@yxit.co.uk>.
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + */
> > +
> > +static inline unsigned long __kprobes __check_eq(unsigned long cpsr)
> > +{
> > + return cpsr & PSR_Z_BIT;
> > +}
>
> And those functions are declared static inline in a header file.
>
> Because the array needs pointers to those functions, there is no way the
> compiler will be able to make them inline. Better put them right before
> the array.
Those functions will also be needed in future for use in a switch
statement for thumb handling code. I wanted to avoid cut'n'paste of the
tests.
If you want, I can put them in the C file now, and move them to a header
when the thumb code gets released. I guess I should have done that
anyway, the thumb code could evolve.
I'm still getting use to juggling patches and branches now the ARM fixes
have interrupted the thumb work.
--
Tixy
next prev parent reply other threads:[~2011-04-05 6:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-04 20:33 [PATCH 0/4] ARM: kprobes: Fixes for ARM instruction emulation Tixy
2011-04-04 20:33 ` [PATCH 1/4] ARM: kprobes: Fix probing of conditionally executed instructions Tixy
2011-04-04 21:00 ` Nicolas Pitre
2011-04-05 6:53 ` Tixy [this message]
2011-04-04 20:33 ` [PATCH 2/4] ARM: kprobes: Remove redundant condition checks from simulation routines Tixy
2011-04-04 20:33 ` [PATCH 3/4] ARM: kprobes: Fix emulation of CMP, CMN, TST and TEQ instructions Tixy
2011-04-04 20:33 ` [PATCH 4/4] ARM: kprobes: Fix emulation of data processing (immediate) instructions Tixy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1301986400.2609.26.camel@computer2.home \
--to=tixy@yxit.co.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).