Skip to contentSkip to conversation

byte swapping redux

parisc-linux Grant Grundler 3 participants 7 messages Jun 29, 2003 – Jul 1, 2003

lore
Share & tools
lore
#0 lore raw

Hi all,

Can someone explain why include/asm-parisc/byteorder.h uses the following?

#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) # define __BYTEORDER_HAS_U64__
# define __SWAB_64_THRU_32__
#endif

vs include/asm-sparc64/byeorder.h:
#define __BYTEORDER_HAS_U64__

I'm pretty sure we don't want __SWAB_64_THRU_32__ defined. PA-RISC version of ___arch__swab64() is appropriately defined for both 32 and 64-bit compiles.

For reference include/linux/byteorder/swab.h says:
#ifdef __BYTEORDER_HAS_U64__
static __inline__ __const__ __u64 __fswab64(__u64 x) {
# ifdef __SWAB_64_THRU_32__

        __u32 h = x >> 32;
        __u32 l = x & ((1ULL<<32)-1);
        return (((__u64)__swab32(l)) << 32) |
		((__u64)(__swab32(h)));
#  else
        return __arch__swab64(x);

# endif
}
...

thanks,
grant

#1 lore raw
Quoted 7 lines · Grant Grundler

#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) # define __BYTEORDER_HAS_U64__
# define __SWAB_64_THRU_32__
#endif

vs include/asm-sparc64/byeorder.h:
#define __BYTEORDER_HAS_U64__

BTW, I forgot to mention parisc is picking generic 64-bit swap macros. Instead of 4 cycles, we are talking 30 or so.

grant

#2 lore raw
In reply to Grant Grundler
Quoted 8 lines · Grant Grundler

Hi all,

Can someone explain why include/asm-parisc/byteorder.h uses the following?

#if !defined(__STRICT_ANSI__) || defined(__KERNEL__) # define __BYTEORDER_HAS_U64__
# define __SWAB_64_THRU_32__
#endif

Protection against userspace inclusion. Which shouldn't be happening of course, but some userspace programs are crap.

Quoted 6 lines

vs include/asm-sparc64/byeorder.h:
#define __BYTEORDER_HAS_U64__

I'm pretty sure we don't want __SWAB_64_THRU_32__ defined. PA-RISC version of ___arch__swab64() is appropriately defined for both 32 and 64-bit compiles.

Take it out then; if it works, commit it (to 2.5 anyway).

Signature · 3 lines
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
#3 lore raw
Quoted 2 lines · Matthew Wilcox

Protection against userspace inclusion. Which shouldn't be happening of course, but some userspace programs are crap.

What are they protecting against?
I'll remove it.

Quoted 5 lines
Quoted 3 lines

I'm pretty sure we don't want __SWAB_64_THRU_32__ defined. PA-RISC version of ___arch__swab64() is appropriately defined for both 32 and 64-bit compiles.

Take it out then; if it works, commit it (to 2.5 anyway).

well, I'm still looking at 2.4.x...you know about the problems I had finding my boot disk on the rx2600 (ia64) when trying to boot 2.5.72. I'm not keen on reproducing experience on parisc this weekend.

I was actually trying to get up to speed to test/review Joel's patch.

BTW, Prelimary diff on ftp://ftp.p-l.o/patches/diff-2.4.21-pa1 attempts to fix the byteorder.h mess and first cut at trying to get intermezzo to build. But intermezzo won't assemble because it has field alignment (ldd 52(x) instruction) problems.

thanks,
grant

#4 lore raw
Quoted 4 lines

BTW, Prelimary diff on ftp://ftp.p-l.o/patches/diff-2.4.21-pa1 attempts to fix the byteorder.h mess and first cut at trying to get intermezzo to build. But intermezzo won't assemble because it has field alignment (ldd 52(x) instruction) problems.

Hmm here no pb to build intermezzo (as a module) neither for 2.4.21-pa1 neither 2.4.22-pre2-pa1 (gcc-3.3 32bits at least). So I suspect that it is a pb with binutils (I still have to downgrade it to binutils-2.13.90.0.18-1.7_hppa.deb) which Dave fixed in upstream a time ago but (I don't know why) not yet included in debian dpkg.

hth,
Joel

---------------------------------
Tiscali ADSL: 19,50 euros/mois...abonnez-vous sur www.tiscali.be

#5 lore raw
Quoted 3 lines · Joel Soete

Hmm here no pb to build intermezzo (as a module) neither for 2.4.21-pa1 neither 2.4.22-pre2-pa1 (gcc-3.3 32bits at least). So I suspect that it is a pb with binutils (I still have to downgrade it to binutils-2.13.90.0.18-1.7_hppa.deb)

For the record, here are the toolchain versions I'm using:

grundler@ios:~$ ld -v
GNU ld version 2.14.90.0.1 20030505 Debian GNU/Linux
grundler@ios:~$ gcc -v
Reading specs from /usr/lib/gcc-lib/hppa-linux/3.2.3/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,f77,objc,ada --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared
--with-system-zlib --enable-nls --without-included-gettext
--enable-__cxa_atexit --enable-clocale=gnu --enable-objc-gc hppa-linux
Thread model: posix
gcc version 3.2.3
grundler@ios:~$ 
Quoted 2 lines

which Dave fixed in upstream a time ago but (I don't know why) not yet included in debian dpkg.

Dave isn't responsible for the debian package...find the maintainer.

thanks,
grant

#6 lore raw

Hi Grant,

Quoted 14 lines

For the record, here are the toolchain versions I'm using:

grundler@ios:~$ ld -v
GNU ld version 2.14.90.0.1 20030505 Debian GNU/Linux
grundler@ios:~$ gcc -v
Reading specs from /usr/lib/gcc-lib/hppa-linux/3.2.3/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,f77,objc,ada --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.2 --enable-shared
--with-system-zlib --enable-nls --without-included-gettext
--enable-__cxa_atexit --enable-clocale=gnu --enable-objc-gc hppa-linux
Thread model: posix
gcc version 3.2.3
grundler@ios:~$ 

Ok, and so is it the same pb with binutils 2.13.90 (if you have the opportunity to test it)?

Quoted 4 lines
Quoted 2 lines

which Dave fixed in upstream a time ago but (I don't know why) not yet included in debian dpkg.

Dave isn't responsible for the debian package...find the maintainer.

I will try to find some time to open a pr near debian maintainer ;-)

Thanks,
Joel

PS: The disk I used to test 64bits kernel on teh N class is broken :(, so awaiting a spare part and rebuild a system, here I will go to build the kernel 2.4.21-pa0 and 2.4.21-pa1 (in 32bits mode) then objdump all object and diff them in the hope to find the pb

---------------------------------
Tiscali ADSL: 19,50 euros/mois...abonnez-vous sur www.tiscali.be