Skip to contentSkip to conversation

Use correct byte-sized register constraint in __xchg_op()

PATCH In review Jeremy Fitzhardinge 4 participants 7 messages Apr 2, 2012 – Apr 6, 2012 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Use correct byte-sized register constraint in __xchg_op()

x86-64 can access the low half of any register, but i386 can only do it with a subset of registers. 'r' causes compilation failures on i386, but 'q' expresses the constraint properly.

arch/x86/include/asm/cmpxchg.h +1 -1
index b3b7332..bc18d0e 100644
@@ -43,7 +43,7 @@ extern void __add_wrong_size(void)
 		switch (sizeof(*(ptr))) {				\
 		case __X86_CASE_B:					\
 			asm volatile (lock #op "b %b0, %1\n"		\
-				      : "+r" (__ret), "+m" (*(ptr))	\
+				      : "+q" (__ret), "+m" (*(ptr))	\
 				      : : "memory", "cc");		\
 			break;						\
 		case __X86_CASE_W:					\
#2 lore raw
Quoted 10 lines · Josh Boyer
Quoted 7 lines · Jeremy Fitzhardinge

x86-64 can access the low half of any register, but i386 can only do it with a subset of registers.  'r' causes compilation failures on i386, but 'q' expresses the constraint properly.

This should be CC'd to stable, given the bug shows up in 3.3, right?

Er.. this patch seems to have been lost in limbo. Is anyone following up on it?

josh

#3 lore raw

Hi Josh,
You are right, this bug also affects 3.3 and IMO should be fixed there, too!
-Thomas

Am Donnerstag, den 05.04.2012, 16:27 -0400 schrieb Josh Boyer:

Quoted 17 lines · Josh Boyer
Quoted 10 lines · Jeremy Fitzhardinge
Quoted 7 lines

x86-64 can access the low half of any register, but i386 can only do it with a subset of registers. 'r' causes compilation failures on i386, but 'q' expresses the constraint properly.

This should be CC'd to stable, given the bug shows up in 3.3, right?

Er.. this patch seems to have been lost in limbo. Is anyone following up on it?

josh

#4 lore raw
In reply to Jeremy Fitzhardinge

PIng?

Quoted 29 lines · Jeremy Fitzhardinge

x86-64 can access the low half of any register, but i386 can only do it with a subset of registers. 'r' causes compilation failures on i386, but 'q' expresses the constraint properly.

arch/x86/include/asm/cmpxchg.h +1 -2
index b3b7332..bc18d0e 100644
@@ -43,7 +43,7 @@ extern void __add_wrong_size(void)
 		switch (sizeof(*(ptr))) {				\
 		case __X86_CASE_B:					\
 			asm volatile (lock #op "b %b0, %1\n"		\
-				      : "+r" (__ret), "+m" (*(ptr))	\
+				      : "+q" (__ret), "+m" (*(ptr))	\
 				      : : "memory", "cc");		\
 			break;						\
 		case __X86_CASE_W:					\
 
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#5 lore raw

[tip:x86/urgent] x86: Use correct byte-sized register constraint in __xchg_op()

In reply to Jeremy Fitzhardinge
Commit-ID:  2ca052a3710fac208eee690faefdeb8bbd4586a1
Gitweb:     http://git.kernel.org/tip/2ca052a3710fac208eee690faefdeb8bbd4586a1
Author:     Jeremy Fitzhardinge <[email protected]>
AuthorDate: Mon, 2 Apr 2012 16:15:33 -0700
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Fri, 6 Apr 2012 09:39:39 -0700

x86: Use correct byte-sized register constraint in __xchg_op()

x86-64 can access the low half of any register, but i386 can only do it with a subset of registers. 'r' causes compilation failures on i386, but 'q' expresses the constraint properly.

---
 arch/x86/include/asm/cmpxchg.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/include/asm/cmpxchg.h +1 -1
index b3b7332..bc18d0e 100644
@@ -43,7 +43,7 @@ extern void __add_wrong_size(void)
 		switch (sizeof(*(ptr))) {				\
 		case __X86_CASE_B:					\
 			asm volatile (lock #op "b %b0, %1\n"		\
-				      : "+r" (__ret), "+m" (*(ptr))	\
+				      : "+q" (__ret), "+m" (*(ptr))	\
 				      : : "memory", "cc");		\
 			break;						\
 		case __X86_CASE_W:					\
#6 lore raw

[tip:x86/urgent] x86: Use correct byte-sized register constraint in __add()

In reply to Jeremy Fitzhardinge
Commit-ID:  8c91c5325e107ec17e40a59a47c6517387d64eb7
Gitweb:     http://git.kernel.org/tip/8c91c5325e107ec17e40a59a47c6517387d64eb7
Author:     H. Peter Anvin <[email protected]>
AuthorDate: Fri, 6 Apr 2012 09:30:57 -0700
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Fri, 6 Apr 2012 09:40:07 -0700

x86: Use correct byte-sized register constraint in __add()

Similar to:

2ca052a x86: Use correct byte-sized register constraint in __xchg_op()

... the __add() macro also needs to use a "q" constraint in the byte-sized case, lest we try to generate an illegal register.

---
 arch/x86/include/asm/cmpxchg.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/include/asm/cmpxchg.h +1 -1
index bc18d0e..99480e5 100644
@@ -173,7 +173,7 @@ extern void __add_wrong_size(void)
 		switch (sizeof(*(ptr))) {				\
 		case __X86_CASE_B:					\
 			asm volatile (lock "addb %b1, %0\n"		\
-				      : "+m" (*(ptr)) : "ri" (inc)	\
+				      : "+m" (*(ptr)) : "qi" (inc)	\
 				      : "memory", "cc");		\
 			break;						\
 		case __X86_CASE_W:					\