From: jon.medhurst@linaro.org (Jon Medhurst (Tixy))
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: hw_breakpoint: don't fault when debug is not powered
Date: Wed, 09 Nov 2011 13:38:41 +0000 [thread overview]
Message-ID: <1320845921.2427.15.camel@linaro1> (raw)
In-Reply-To: <1320843602-12278-1-git-send-email-linus.walleij@stericsson.com>
On Wed, 2011-11-09 at 14:00 +0100, Linus Walleij wrote:
> From: Rabin Vincent <rabin.vincent@stericsson.com>
>
> If the debug logic is not powered, the processor can unfortunately
> raise an undefined instruction exception on the instruction that
> we use to check if the debug logic is powered up or not.
>
> Handle this with an undef hook, so that the kernel doesn't crash
> on boot on such setups.
>
> Cc: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> arch/arm/kernel/hw_breakpoint.c | 25 +++++++++++++++++++++++++
> 1 files changed, 25 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
> index 814a52a9..f46137c 100644
> --- a/arch/arm/kernel/hw_breakpoint.c
> +++ b/arch/arm/kernel/hw_breakpoint.c
> @@ -854,6 +854,25 @@ static int hw_breakpoint_pending(unsigned long addr, unsigned int fsr,
> return ret;
> }
>
> +static int hw_breakpoint_undef(struct pt_regs *regs, unsigned int instr)
> +{
> + int reg = (instr >> 12) & 15;
> +
> + /* Fake sticky power-down cleared */
> + regs->uregs[reg] = 0;
> + regs->ARM_pc += 4;
> +
> + return 0;
> +}
> +
> +static struct undef_hook hw_breakpoint_hook = {
> + .instr_mask = 0xffff0fff,
> + .instr_val = 0xee110e95,
> + .cpsr_mask = MODE_MASK,
> + .cpsr_val = SVC_MODE,
> + .fn = hw_breakpoint_undef,
> +};
> +
This should work OK on Thumb2 kernels as the encoding for the MRC
instruction is the same as on ARM :-) Is it worth a comment to this
effect?
--
Tixy
next prev parent reply other threads:[~2011-11-09 13:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-09 13:00 [PATCH] ARM: hw_breakpoint: don't fault when debug is not powered Linus Walleij
2011-11-09 13:38 ` Jon Medhurst (Tixy) [this message]
2011-11-09 13:42 ` Will Deacon
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=1320845921.2427.15.camel@linaro1 \
--to=jon.medhurst@linaro.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.