summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/include
diff options
context:
space:
mode:
authorMichael Brown2012-03-04 22:41:24 +0100
committerMichael Brown2012-03-04 22:41:24 +0100
commit732bea2f88d0d471e396831b19d2d5d40833c41c (patch)
tree9280045a258fe7932f617a79f70a76ab1211b9d7 /src/arch/i386/include
parent[i386] Fix building on older versions of gcc (diff)
downloadipxe-732bea2f88d0d471e396831b19d2d5d40833c41c.tar.gz
ipxe-732bea2f88d0d471e396831b19d2d5d40833c41c.tar.xz
ipxe-732bea2f88d0d471e396831b19d2d5d40833c41c.zip
[i386] Use memory address constraints in __bswap_16s() and __bswap_64s()
Minimise code size by forcing the use of memory addresses for __bswap_16s() and __bswap_64s(). (__bswap_32s() cannot avoid loading the value into a register.) Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/i386/include')
-rw-r--r--src/arch/i386/include/bits/byteswap.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/arch/i386/include/bits/byteswap.h b/src/arch/i386/include/bits/byteswap.h
index d40771354..f3d30a254 100644
--- a/src/arch/i386/include/bits/byteswap.h
+++ b/src/arch/i386/include/bits/byteswap.h
@@ -19,7 +19,7 @@ __bswap_variable_16 ( uint16_t x ) {
static inline __attribute__ (( always_inline )) void
__bswap_16s ( uint16_t *x ) {
- __asm__ ( "rorw $8, %0" : "=g" ( *x ) : "0" ( *x ) );
+ __asm__ ( "rorw $8, %0" : "+m" ( *x ) );
}
static inline __attribute__ (( always_inline, const )) uint32_t
@@ -63,9 +63,8 @@ __bswap_64s ( uint64_t *x ) {
"xchgl %2,%1\n\t"
"bswapl %2\n\t"
"movl %2,%0\n\t"
- : "=g" ( dwords->low ), "=g" ( dwords->high ),
- "=r" ( discard )
- : "0" ( dwords->low ), "1" ( dwords->high ) );
+ : "+m" ( dwords->low ), "+m" ( dwords->high ),
+ "=r" ( discard ) );
}
#endif /* _BITS_BYTESWAP_H */