mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Måns Rullgård" <mans@mansr.com>
To: Nicolas Pitre <nicolas.pitre@linaro.org>
Cc: "Stephen Boyd" <sboyd@codeaurora.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	"Jean-Christophe PLAGNIOL-VILLARD" <plagnioj@jcrosoft.com>,
	"Christopher Covington" <cov@codeaurora.org>,
	"Russell King - ARM Linux" <linux@arm.linux.org.uk>,
	"Måns Rullgård" <mans@mansr.com>,
	"Rob Herring" <robherring2@gmail.com>
Subject: Re: [PATCH v2] ARM: Use udiv/sdiv for __aeabi_{u}idiv library functions
Date: Tue, 12 Nov 2013 14:22:55 +0000	[thread overview]
Message-ID: <yw1xhabhvgw0.fsf@unicorn.mansr.com> (raw)
In-Reply-To: <alpine.LFD.2.10.1311120839310.9667@knanqh.ubzr> (Nicolas Pitre's message of "Tue, 12 Nov 2013 09:01:16 -0500 (EST)")

Nicolas Pitre <nicolas.pitre@linaro.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.

There should also be some cache maintenance after this patching, or is
that already happening for some other reason?

-- 
Måns Rullgård
mans@mansr.com

  parent reply	other threads:[~2013-11-12 14:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-08 23:00 Stephen Boyd
2013-11-09  6:46 ` Matt Sealey
2013-11-09 18:20   ` Måns Rullgård
2013-11-12  1:23   ` Stephen Boyd
2013-11-10  5:03 ` Nicolas Pitre
2013-11-12  2:34   ` Stephen Boyd
2013-11-12 11:28     ` Måns Rullgård
2013-11-12 14:01     ` Nicolas Pitre
2013-11-12 14:04       ` Russell King - ARM Linux
2013-11-12 14:16         ` Nicolas Pitre
2013-11-12 14:17         ` Ben Dooks
2013-11-12 14:32           ` Nicolas Pitre
2013-11-12 14:40             ` Måns Rullgård
2013-11-12 14:55               ` Nicolas Pitre
2013-11-12 15:20                 ` Nicolas Pitre
2013-11-12 18:03                 ` Måns Rullgård
2013-11-12 14:22       ` Måns Rullgård [this message]
2013-11-12 14:36         ` Nicolas Pitre
2013-11-11  7:46 ` Uwe Kleine-König
2013-11-12  2:35   ` Stephen Boyd

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=yw1xhabhvgw0.fsf@unicorn.mansr.com \
    --to=mans@mansr.com \
    --cc=cov@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=nicolas.pitre@linaro.org \
    --cc=plagnioj@jcrosoft.com \
    --cc=robherring2@gmail.com \
    --cc=sboyd@codeaurora.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

all inboxes | Powered by JetHome®