瀏覽代碼

[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>
tags/v1.20.1
Michael Brown 13 年之前
父節點
當前提交
732bea2f88
共有 1 個文件被更改,包括 3 次插入4 次删除
  1. 3
    4
      src/arch/i386/include/bits/byteswap.h

+ 3
- 4
src/arch/i386/include/bits/byteswap.h 查看文件

@@ -19,7 +19,7 @@ __bswap_variable_16 ( uint16_t x ) {
19 19
 
20 20
 static inline __attribute__ (( always_inline )) void
21 21
 __bswap_16s ( uint16_t *x ) {
22
-	__asm__ ( "rorw $8, %0" : "=g" ( *x ) : "0" ( *x ) );
22
+	__asm__ ( "rorw $8, %0" : "+m" ( *x ) );
23 23
 }
24 24
 
25 25
 static inline __attribute__ (( always_inline, const )) uint32_t
@@ -63,9 +63,8 @@ __bswap_64s ( uint64_t *x ) {
63 63
 		  "xchgl %2,%1\n\t"
64 64
 		  "bswapl %2\n\t"
65 65
 		  "movl %2,%0\n\t"
66
-		  : "=g" ( dwords->low ), "=g" ( dwords->high ),
67
-		    "=r" ( discard )
68
-		  : "0" ( dwords->low ), "1" ( dwords->high ) );
66
+		  : "+m" ( dwords->low ), "+m" ( dwords->high ),
67
+		    "=r" ( discard ) );
69 68
 }
70 69
 
71 70
 #endif /* _BITS_BYTESWAP_H */

Loading…
取消
儲存