[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.2.10.1311120933060.9667@knanqh.ubzr>
Date: Tue, 12 Nov 2013 09:36:29 -0500 (EST)
From: Nicolas Pitre <nicolas.pitre@...aro.org>
To: Måns Rullgård <mans@...sr.com>
cc: Stephen Boyd <sboyd@...eaurora.org>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@...osoft.com>,
Christopher Covington <cov@...eaurora.org>,
Russell King - ARM Linux <linux@....linux.org.uk>,
Rob Herring <robherring2@...il.com>
Subject: Re: [PATCH v2] ARM: Use udiv/sdiv for __aeabi_{u}idiv library
functions
On Tue, 12 Nov 2013, Måns Rullgård wrote:
> Nicolas Pitre <nicolas.pitre@...aro.org> writes:
>
> > What about this patch which I think is currently your best option. Note
> > it would need to use the facilities from asm/opcodes.h to make it endian
> > agnostic.
> >
> > diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
> > index 6a1b8a81b1..379cffe4ab 100644
> > --- a/arch/arm/kernel/setup.c
> > +++ b/arch/arm/kernel/setup.c
> > @@ -383,6 +383,34 @@ static void __init cpuid_init_hwcaps(void)
> > elf_hwcap |= HWCAP_IDIVT;
> > }
> >
> > + /*
> > + * Patch our division routines with the corresponding opcode
> > + * if the hardware supports it.
> > + */
> > + if (IS_ENABLED(CONFIG_THUMB2_KERNEL) && (elf_hwcap & HWCAP_IDIVT)) {
> > + extern char __aeabi_uidiv, __aeabi_idiv;
>
> It would be safer to declare these as arrays of unspecified size.
> Otherwise the compiler might do evil things with what to it looks like
> out of bounds indexing.
Right.
>
> There should also be some cache maintenance after this patching, or is
> that already happening for some other reason?
This is so early during boot that the MMU isn't even fully initialized
yet. The cache will be flushed.
Nicolas
Powered by blists - more mailing lists