lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:	Sun, 21 Mar 2010 11:01:24 +0100
From:	Geert Uytterhoeven <geert@...ux-m68k.org>
To:	Andreas Schwab <schwab@...ux-m68k.org>
Cc:	"Linux/m68k" <linux-m68k@...r.kernel.org>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] m68k: Fix asm constraints for atomic_sub_and_test() and 
	atomic_add_negative() (was: Re: atomic_sub_and_test() asm constraints)

On Sun, Mar 14, 2010 at 15:30, Andreas Schwab <schwab@...ux-m68k.org> wrote:
> Geert Uytterhoeven <geert@...ux-m68k.org> writes:
>
>> |   CC      mm/memcontrol.o
>> | {standard input}: Assembler messages:
>> | {standard input}:4076: Error: operands mismatch -- statement `subl
>> 12(%fp),170(%a0)' ignored
>>
>> Seems like we have bad asm constraints in
>>
>> static inline int atomic_sub_and_test(int i, atomic_t *v)
>> {
>>         char c;
>>         __asm__ __volatile__("subl %2,%1; seq %0" : "=d" (c), "+m"
>> (*v): "g" (i));
>
> Surely "g" is wrong, sub only accepts a data register as source operand
> when the destination is in memory.

>From cd2b57976949934df61c4406af344294011d5c16 Mon Sep 17 00:00:00 2001
From: Geert Uytterhoeven <geert@...ux-m68k.org>
Date: Sun, 21 Mar 2010 10:52:21 +0100
Subject: [PATCH] m68k: Fix asm constraints for atomic_sub_and_test()
and atomic_add_negative()

Recently, we started seeing this on allmodconfig builds:

  CC      mm/memcontrol.o
{standard input}: Assembler messages:
{standard input}:4076: Error: operands mismatch -- statement `subl
12(%fp),170(%a0)' ignored

Correct the asm constraint, like done for m68knommu.

Signed-off-by: Geert Uytterhoeven <geert@...ux-m68k.org>
---
 arch/m68k/include/asm/atomic_mm.h |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/include/asm/atomic_mm.h
b/arch/m68k/include/asm/atomic_mm.h
index 88b7af2..d9d2ed6 100644
--- a/arch/m68k/include/asm/atomic_mm.h
+++ b/arch/m68k/include/asm/atomic_mm.h
@@ -148,14 +148,18 @@ static inline int atomic_xchg(atomic_t *v, int new)
 static inline int atomic_sub_and_test(int i, atomic_t *v)
 {
 	char c;
-	__asm__ __volatile__("subl %2,%1; seq %0" : "=d" (c), "+m" (*v): "g" (i));
+	__asm__ __volatile__("subl %2,%1; seq %0"
+			     : "=d" (c), "+m" (*v)
+			     : "id" (i));
 	return c != 0;
 }

 static inline int atomic_add_negative(int i, atomic_t *v)
 {
 	char c;
-	__asm__ __volatile__("addl %2,%1; smi %0" : "=d" (c), "+m" (*v): "g" (i));
+	__asm__ __volatile__("addl %2,%1; smi %0"
+			     : "=d" (c), "+m" (*v)
+			     : "id" (i));
 	return c != 0;
 }

-- 
1.6.0.4

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ