From e2a3acbed0f66c7d96a2886aab6f0725bf1b0923 Mon Sep 17 00:00:00 2001 From: okuji Date: Sat, 15 Jun 2002 00:47:08 +0000 Subject: [PATCH] 2002-06-15 Yoshinori K. Okuji * stage2/fsys_xfs.c (le32): Don't use bswap, but use xchgb and roll, because 386 doesn't have bswap. Reported by Frode Vatvedt Fjeld . --- ChangeLog | 6 ++++++ stage2/fsys_xfs.c | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index df4be0254..e0f35f126 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-06-15 Yoshinori K. Okuji + + * stage2/fsys_xfs.c (le32): Don't use bswap, but use xchgb and + roll, because 386 doesn't have bswap. Reported by Frode Vatvedt + Fjeld . + 2002-06-12 Yoshinori K. Okuji * netboot/main.c (ifconfig): If GW is specified, clear out the diff --git a/stage2/fsys_xfs.c b/stage2/fsys_xfs.c index e626b878f..b551c07a2 100644 --- a/stage2/fsys_xfs.c +++ b/stage2/fsys_xfs.c @@ -109,7 +109,16 @@ le16 (__uint16_t x) static inline __const__ __uint32_t le32 (__uint32_t x) { +#if 0 + /* 386 doesn't have bswap. */ __asm__("bswap %0" : "=r" (x) : "0" (x)); +#else + /* This is slower but this works on all x86 architectures. */ + __asm__("xchgb %b0, %h0" \ + "\n\troll $16, %0" \ + "\n\txchgb %b0, %h0" \ + : "=q" (x) : "0" (x)); +#endif return x; }