From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH] ARM: panic with a message when relocation type is unknown
Date: Fri, 31 May 2019 11:56:59 -0700 [thread overview]
Message-ID: <CAHQ1cqEMhG-AYqzheMgnU+G_72ct6RM7ZesUJe9+aEeVhAAEEQ@mail.gmail.com> (raw)
In-Reply-To: <20190531090224.21707-1-a.fatoum@pengutronix.de>
On Fri, May 31, 2019 at 2:02 AM Ahmad Fatoum <a.fatoum@pengutronix.de> wrote:
>
> Currently such failures result in a
>
> >00000000 00000000
>
> ### ERROR ### Please RESET the board ###
>
> With this patch this now becomes
>
> >00000000 00000000
> Unknown relocation type
> ### ERROR ### Please RESET the board ###
>
> which improves user experience a little bit.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> arch/arm/cpu/common.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/cpu/common.c b/arch/arm/cpu/common.c
> index 821cafbf26c2..3668c5977ca9 100644
> --- a/arch/arm/cpu/common.c
> +++ b/arch/arm/cpu/common.c
> @@ -78,7 +78,7 @@ void relocate_to_current_adr(void)
> putc_ll(' ');
> puthex_ll(rel->r_addend);
> putc_ll('\n');
> - panic("");
> + panic("Unknown relocation type");
> }
>
> dstart += sizeof(*rel);
> @@ -108,7 +108,7 @@ void relocate_to_current_adr(void)
> putc_ll(' ');
> puthex_ll(rel->r_offset);
> putc_ll('\n');
> - panic("");
> + panic("Unknown relocation type");
Looking at this code makes me wonder if calls to panic() are even
appropriate here. I am not sure there's any guarantee that by the time
we get to this line relocation for "Unknown relocation type"(or
original "") string would be processed and panic() would get right
arguments not to mention all of the functions called as a part of
panic() and their potential dependencies. Another thing about painc()
is in PBL it completely ignores passed arguments, so no message will
be printed there.
Maybe it'd make sense to go in a different direction and drop calls to
panic() altogether and replace them with:
puts_ll(relocation_failed_message());
hang();
where relocation_failed_message() on ARM can be something like:
.section .text.relocation_failed_message
ENTRY(relocation_failed_message)
push {lr}
bl 1f
.byte 'U, 'n, 'k, 'n, 'o, 'w, 'n, '\ , 'r, 'e, 'l, 'o, 'c, 'a, 't, 'i,
'o, 'n, '\ , 't, 'y, 'p, 'e, '\r, '\n, 0x00
1:
mov r0, lr
/* In case we are in thumb */
bic r0, r0, #1
pop {pc}
ENDPROC(relocation_failed_message)
to guarantee that it won't depend on relocation? Might be an overkill
though, so take this with a grain of salt.
Thanks,
Andrey Smirnov
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2019-05-31 18:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-31 9:02 Ahmad Fatoum
2019-05-31 14:43 ` Sam Ravnborg
2019-06-03 5:21 ` Ahmad Fatoum
2019-06-03 5:26 ` Ahmad Fatoum
2019-05-31 18:56 ` Andrey Smirnov [this message]
2019-06-03 13:03 ` Ahmad Fatoum
2019-06-04 6:10 ` Andrey Smirnov
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=CAHQ1cqEMhG-AYqzheMgnU+G_72ct6RM7ZesUJe9+aEeVhAAEEQ@mail.gmail.com \
--to=andrew.smirnov@gmail.com \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@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