Skip to contentSkip to conversation

x86: Fix grant-table build error

PATCH In review Lin Ming 2 participants 3 messages Mar 22, 2012

lore
Share & tools
lore

Lin Ming

author
#0 lore raw

PATCH 1/1 x86: Fix grant-table build error

Fixes build error with btrw instruction.

xen-unstable/xen/include/asm/grant_table.h:57:
Error: Incorrect register %edx' used with w' suffix

---
 xen/include/asm-x86/grant_table.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
xen/include/asm-x86/grant_table.h +1 -1
index db8bfb4..9b5321b 100644
@@ -54,7 +54,7 @@ static inline void gnttab_clear_flag(unsigned int nr, uint16_t *st)
      * Note that this cannot be clear_bit(), as the access must be
      * confined to the specified 2 bytes.
      */
-    asm volatile ("lock btrw %1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st));
+    asm volatile ("lock btr %1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st));
 }
 
 /* Foreign mappings of HHVM-guest pages do not modify the type count. */
Signature · 1 line
1.7.2.5
#1 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · Lin Ming

Fixes build error with btrw instruction.

xen-unstable/xen/include/asm/grant_table.h:57:
Error: Incorrect register %edx' used with w' suffix

With what gcc?

Quoted 11 lines
---
 xen/include/asm-x86/grant_table.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
xen/include/asm-x86/grant_table.h +0 -0
index db8bfb4..9b5321b 100644

xen/include/asm-x86/grant_table.h static inline void gnttab_clear_flag(unsigned int nr, · line 58

Quoted 6 lines
xen/include/asm-x86/grant_table.h +1 -1
@@ -54,7 +54,7 @@ static inline void gnttab_clear_flag(unsigned int nr, 
 uint16_t *st)
      * Note that this cannot be clear_bit(), as the access must be
      * confined to the specified 2 bytes.
      */
-    asm volatile ("lock btrw %1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st));
+    asm volatile ("lock btr %1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st));

That's definitely not the right way to fix this - did you read the description of the change that introduced this? Nevertheless I admit that change wasn't entirely correct, as it doesn't really allow the compiler to pick a register (apparently it has been picking an immediate number for everyone else up to now). I shall send a proper fix soon.

Jan

Quoted 3 lines
xen/include/asm-x86/grant_table.h +0 -0
 }
 

/* Foreign mappings of HHVM-guest pages do not modify the type count. */

author
#2 lore raw
Quoted 7 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · Lin Ming

Fixes build error with btrw instruction.

xen-unstable/xen/include/asm/grant_table.h:57:
Error: Incorrect register %edx' used with w' suffix

With what gcc?

# gcc --version
gcc (Debian 4.4.5-8) 4.4.5
Quoted 17 lines
Quoted 17 lines

---
 xen/include/asm-x86/grant_table.h |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
xen/include/asm-x86/grant_table.h +0 -1
index db8bfb4..9b5321b 100644
@@ -54,7 +54,7 @@ static inline void gnttab_clear_flag(unsigned int nr,
 uint16_t *st)
       * Note that this cannot be clear_bit(), as the access must be
       * confined to the specified 2 bytes.
       */
-    asm volatile ("lock btrw %1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st));
Quoted 8 lines

xen/include/asm-x86/grant_table.h static inline void gnttab_clear_flag(unsigned int nr, uint16_t *st) · line 57

Quoted 1 line
xen/include/asm-x86/grant_table.h +1 -0
+    asm volatile ("lock btr %1,%0" : "=m" (*st) : "Ir" (nr), "m" (*st));

That's definitely not the right way to fix this - did you read the description of the change that introduced this? Nevertheless I admit that change wasn't entirely correct, as it doesn't really allow the compiler to pick a register (apparently it has been picking an immediate number for everyone else up to now). I shall send a proper fix soon.

I'd like to test it.

Lin Ming