All of lore.kernel.org
 help / color / mirror / Atom feed
From: gangchen@rdamicro.com (Chen Gang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/1] ARM:r0 is also corrupted after calling __do_div64.
Date: Thu, 14 May 2015 11:39:02 +0800	[thread overview]
Message-ID: <555418D6.6000707@rdamicro.com> (raw)
In-Reply-To: <1431427201-14371-1-git-send-email-gangchen@rdamicro.com>

Hi, Russell

The following patch is made according to your suggestion. Could you 
review or merge it before your context is cleaned? Thanks!

Br, Chen Gang

On 05/12/2015 06:40 PM, Chen Gang wrote:
> R0 is corrupted after calling __do_div64 and compiler is not informed
> about this in macro __do_div_asm. If n is to be used again after this
> macro, r0 is not reloaded and n will contain incorrect value
>
> Signed-off-by: Chen Gang <gangchen@rdamicro.com>
> ---
>   arch/arm/include/asm/div64.h | 12 +++++++-----
>   1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/arch/arm/include/asm/div64.h b/arch/arm/include/asm/div64.h
> index a66061a..4829618 100644
> --- a/arch/arm/include/asm/div64.h
> +++ b/arch/arm/include/asm/div64.h
> @@ -34,13 +34,15 @@
>   	register unsigned long long __n   asm("r0") = n;	\
>   	register unsigned long long __res asm("r2");		\
>   	register unsigned int __rem       asm(__xh);		\
> +	register unsigned int __clobber   asm(__xl);		\
>   	asm(	__asmeq("%0", __xh)				\
> -		__asmeq("%1", "r2")				\
> -		__asmeq("%2", "r0")				\
> -		__asmeq("%3", "r4")				\
> +		__asmeq("%1", __xl)				\
> +		__asmeq("%2", "r2")				\
> +		__asmeq("%3", "r0")				\
> +		__asmeq("%4", "r4")				\
>   		"bl	__do_div64"				\
> -		: "=r" (__rem), "=r" (__res)			\
> -		: "r" (__n), "r" (__base)			\
> +		: "=r"(__rem), "=r"(__clobber), "=r"(__res)	\
> +		: "r"(__n), "r"(__base)				\
>   		: "ip", "lr", "cc");				\
>   	n = __res;						\
>   	__rem;							\

  reply	other threads:[~2015-05-14  3:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-12  6:33 [PATCH 1/1] ARM:r0 is also corrupted after calling __do_div64 Chen Gang
2015-05-12 10:00 ` Russell King - ARM Linux
2015-05-12 10:40   ` Chen Gang
2015-05-14  3:39     ` Chen Gang [this message]
2015-05-12 10:42   ` Chen Gang

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=555418D6.6000707@rdamicro.com \
    --to=gangchen@rdamicro.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.