From: sjg@chromium.org (Simon Glass)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH V2] ARM: Use generic BUG() handler
Date: Thu, 10 Mar 2011 14:19:20 -0800 [thread overview]
Message-ID: <AANLkTinh4-rvhDGesy=STFsiLGyjBb8Scb+BR7tfXQ+G@mail.gmail.com> (raw)
In-Reply-To: <AANLkTinTfHqrbVFh6Q68kP=UKJjye8J+iDhRHTcm8BPF@mail.gmail.com>
On Wed, Mar 9, 2011 at 1:51 AM, Dave Martin <dave.martin@linaro.org> wrote:
> On Wed, Mar 9, 2011 at 2:55 AM, Simon Glass <sjg@chromium.org> wrote:
>> +#ifdef CONFIG_THUMB2_KERNEL
>> +#define BUG_INSTR_VALUE 0xf7f2
>
> This isn't an undefined instruction... it's actually half of some
> 32-bit Thumb instruction. Did you mean 0xdexx instead?
Yes, will fix.
>> +#define BUG_INSTR_TYPE ".hword "
>> +#else
>> +#define BUG_INSTR_VALUE 0xe7f001f2
>> +#define BUG_INSTR_TYPE ".word "
>> +#endif
>> +
>
> This works, but do we really need to split the definition of the bug
> instruction into two macros?
This is so that I can test for the correct instruction word in valid_bug_addr().
>
> Unless you can see a use for calling _BUG() directly with a different
> instruction value, of course...
>
>> + ? ? ? /*
>> + ? ? ? * .exit.text is discarded at runtime, not link time, to deal with
>> + ? ? ? * ?references from bug_table
>> + ? ? ? */
>> + ? ? ? .exit.text : AT(ADDR(.exit.text)) {
>> + ? ? ? ? ? ? ? EXIT_TEXT
>> + ? ? ? }
>> +
>> + ? ? ? .exit.data : AT(ADDR(.exit.data)) {
>> + ? ? ? ? ? ? ? EXIT_DATA
>> + ? ? ? }
>
> This is the same unfortunate hack we have to do for other fixups,
> because there's no way to separate out some of these entries in such a
> way that they can be discarded at link time... ?I did have an idea for
> an extention to gas which would allow fixups and similar data to be
> emitted in separate ancillary sections which the linker can handle
> sensibly, so that bug entries referencing .exit.text (for example) can
> be discarded at link time.
>
> See http://sourceware.org/ml/binutils/2011-02/msg00004.html
>
> I haven't received any support for the idea so far though...
Well yes, and some might even argue that calling BUG() in __exit code
is not a great idea. Here we are adding in all exit data again which
is about 8.5KB in my kernel. These two pages are then reclaimed at
runtime.
However, at present I don't see any alternative to this, and this is
what is done on other architectures to support BUG().
>
> Cheers
> ---Dave
>
I will tidy this up, test it properly on Thumb and submit a patch.
Regards,
Simon
prev parent reply other threads:[~2011-03-10 22:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-09 2:55 [RFC PATCH V2] ARM: Use generic BUG() handler Simon Glass
2011-03-09 9:51 ` Dave Martin
2011-03-10 22:19 ` Simon Glass [this message]
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='AANLkTinh4-rvhDGesy=STFsiLGyjBb8Scb+BR7tfXQ+G@mail.gmail.com' \
--to=sjg@chromium.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 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).