All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] ARM : missing corrupted reg in __do_div_asm
@ 2016-03-28  4:19 Chen Gang
  2016-03-29 10:19 ` Arnd Bergmann
  0 siblings, 1 reply; 24+ messages in thread
From: Chen Gang @ 2016-03-28  4:19 UTC (permalink / raw)
  To: linux-arm-kernel

__xl(R0 in little endian system, or R1 in big endian system) is corrupted
after calling __do_div64 and compiler is not informed about this in
macro __do_div_asm. If n is used again afterwards, __xl won't be
reloaded and n will contain incorrect value.

Signed-off-by: Chen Gang <gangchen@rdamicro.com>
Signed-off-by: Chen Gang <chengang.beijing@gmail.com>
---
 arch/arm/include/asm/div64.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/div64.h b/arch/arm/include/asm/div64.h
index e1f0776..1a6e91a 100644
--- a/arch/arm/include/asm/div64.h
+++ b/arch/arm/include/asm/div64.h
@@ -35,12 +35,14 @@ static inline uint32_t __div64_32(uint64_t *n, uint32_t base)
 	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("%3", "r0")
+		__asmeq("%4", "r4")
 		__asmeq("%2", "r0")
-		__asmeq("%3", "r4")
 		"bl	__do_div64"
-		: "=r" (__rem), "=r" (__res)
+		: "=r" (__rem), "=r" (__res), "=r" (__clobber)
 		: "r" (__n), "r" (__base)
 		: "ip", "lr", "cc");
 	*n = __res;
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 24+ messages in thread
[parent not found: </home/gachen/Re: [PATCH 1_1] ARM:r0 is also corrupted after calling __do_div64..eml>]

end of thread, other threads:[~2016-04-01 11:35 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-28  4:19 [PATCH 1/1] ARM : missing corrupted reg in __do_div_asm Chen Gang
2016-03-29 10:19 ` Arnd Bergmann
2016-03-29 10:26   ` Dave Martin
2016-03-29 10:34     ` Russell King - ARM Linux
2016-03-29 10:56       ` Dave Martin
2016-03-30  3:27         ` 陈刚(Gangchen)
2016-03-30 14:07           ` Dave Martin
2016-03-31  7:56             ` 陈刚(Gangchen)
2016-03-31 10:30               ` Dave Martin
2016-03-31 11:20                 ` 陈刚(Gangchen)
2016-03-31 11:41                   ` Dave Martin
2016-04-01  4:22                     ` [PATCH V3 1/1] ARM : missing corrupted reg in __div64_32 chengang
2016-04-01  8:56                       ` Dave Martin
2016-04-01 10:28                         ` [PATCH V4 " chengang
2016-04-01 11:03                           ` Dave Martin
2016-04-01 11:25                             ` [PATCH V5 " chengang
2016-04-01 11:34                               ` Dave P Martin
2016-04-01 11:35                             ` [PATCH V4 " 陈刚(Gangchen)
2016-03-31 11:41                 ` [PATCH v2 " Chen Gang
2016-03-29 10:58       ` [PATCH 1/1] ARM : missing corrupted reg in __do_div_asm 陈刚(Gangchen)
     [not found] </home/gachen/Re: [PATCH 1_1] ARM:r0 is also corrupted after calling __do_div64..eml>
2015-06-02  6:13 ` Chen Gang
2015-06-08  5:30   ` Chen Gang
2015-06-09 13:09   ` Russell King - ARM Linux
2015-06-28 11:29     ` Chen Gang

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.