* [PATCH] arm: common: document safe usage of arm_setup_stack
@ 2018-12-04 9:15 Ahmad Fatoum
2018-12-14 15:32 ` Ahmad Fatoum
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2018-12-04 9:15 UTC (permalink / raw)
To: barebox
Cc: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
arch/arm/include/asm/common.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm/include/asm/common.h b/arch/arm/include/asm/common.h
index c32cdfe5ec2f..72ac988cc131 100644
--- a/arch/arm/include/asm/common.h
+++ b/arch/arm/include/asm/common.h
@@ -46,6 +46,12 @@ static inline unsigned long get_sp(void)
return sp;
}
+/*
+ * At least with GCC 7.3.1, listing sp in the clobber register can generate
+ * erroneous accesses to the fp, even in __naked functions. Therefore _always_
+ * branch to a noinline function as soon as possible (usually after relocation
+ * and c_setup).
+ */
static inline void arm_setup_stack(unsigned long top)
{
__asm__ __volatile__("mov sp, %0"
--
2.19.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] arm: common: document safe usage of arm_setup_stack
2018-12-04 9:15 [PATCH] arm: common: document safe usage of arm_setup_stack Ahmad Fatoum
@ 2018-12-14 15:32 ` Ahmad Fatoum
0 siblings, 0 replies; 2+ messages in thread
From: Ahmad Fatoum @ 2018-12-14 15:32 UTC (permalink / raw)
To: barebox
Hello,
On 4/12/18 10:15, Ahmad Fatoum wrote:
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> arch/arm/include/asm/common.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/arm/include/asm/common.h b/arch/arm/include/asm/common.h
> index c32cdfe5ec2f..72ac988cc131 100644
> --- a/arch/arm/include/asm/common.h
> +++ b/arch/arm/include/asm/common.h
> @@ -46,6 +46,12 @@ static inline unsigned long get_sp(void)
> return sp;
> }
>
> +/*
> + * At least with GCC 7.3.1, listing sp in the clobber register can generate
> + * erroneous accesses to the fp, even in __naked functions. Therefore _always_
> + * branch to a noinline function as soon as possible (usually after relocation
> + * and c_setup).
> + */
> static inline void arm_setup_stack(unsigned long top)
> {
> __asm__ __volatile__("mov sp, %0"
>
any comments?
Cheers
Ahmad
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-14 15:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-04 9:15 [PATCH] arm: common: document safe usage of arm_setup_stack Ahmad Fatoum
2018-12-14 15:32 ` Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox