[U-Boot] instruction "xchgb" for x86_64
Bin Meng
bmeng.cn at gmail.com
Wed Aug 14 07:35:00 UTC 2019
Hi James,
On Wed, Aug 14, 2019 at 1:08 PM James Wang <James.Wang at rohde-schwarz.com>
wrote:
> Hi Simon,
>
>
>
> This is James and am working on u-boot to bring back MinGW tool chain for
> cross compiling host tools for Windows on Linux. After complete the code, I
> plan to generate a patch for community review.
>
Do you mean cross compiling U-Boot's mkimage tool for Windows on Linux
using gcc-mingw-w64? Do you want to support building U-Boot on Windows as
well?
>
>
> During work, I face an compiling error in file
> <arch/x86/include/asm/byteorder.h> with macro *CONFIG_IS_ENABLED*. After
> some background study, seems this macro should not be available when
> compiling host tools.
>
>
>
> After check history, it’s from 909780506773a9b09ae88cb267dbfa6a8d0caa7b on
> 2017-01-16 22:04:04, Below is the log message
>
>
>
> * x86: Fix up byteorder.h for x86_64*
>
>
>
> * Remove the very old x86 code and add support for 64-bit.*
>
>
>
> * Signed-off-by: Simon Glass <sjg at chromium.org <sjg at chromium.org>>*
>
> *Reviewed-by: Bin Meng bmeng.cn at gmail.com <bmeng.cn at gmail.com>*
>
>
>
> Below are the relevant changes.
>
>
>
> *+#define _constant_swab16(x)
> ((__u16)( \*
>
> *+ (((__u16)(x) & (__u16)0x00ffU) << 8) |
> \*
>
> *+ (((__u16)(x) & (__u16)0xff00U) >> 8)))*
>
> *+*
>
> *static __inline__ __u16 ___arch__swab16(__u16 x)*
>
> *{*
>
> *+#if CONFIG_IS_ENABLED(X86_64) *
>
> *+ return _constant_swab16(x);*
>
> *+#else*
>
> * __asm__("xchgb %b0,%h0" /* swap
> bytes */ \*
>
> * : "=q" (x) \*
>
> * : "0" (x)); \*
>
> * return x;*
>
> *+#endif*
>
> *}*
>
>
>
> I am not familiar with x86 instructions and not understand the purpose of
> this change, is it because instruction “xchgb” not available on 64-bit
> architecture or something else?
>
I can't remember the details of why Simon changed this. xchgb is available
in 64-bit. We probably need revert this change, Simon?
Regards,
Bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 13947 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190814/a3f884c1/attachment.png>
More information about the U-Boot
mailing list