Re: [PATCH] Fix ppc64 out_be64

From: Roland Dreier
Date: Sun Jun 13 2004 - 11:49:03 EST


Benjamin> Ugh ? The syntax of std is std rS, ds(rA), so your fix
Benjamin> doesn't look good to me, and it definitely builds with
Benjamin> the current syntax, though I agree the type is indeed
Benjamin> wrong. I also spotted another bug where we forgot to
Benjamin> change an eieio into sync in there though.

Although the kernel builds, it's only because no one actually uses
out_be64. You can try the old version and see:

> cat foo.c
static inline void out_be64(volatile unsigned long *addr, unsigned
long val)
{
__asm__ __volatile__("std %1,0(%0); eieio" : "=m" (*addr) :
"r" (val));
}

void foo(void *x, unsigned long y)
{
out_be64(x, y);
}
$ ${CROSS_COMPILE}gcc -save-temps -c foo.c
foo.s: Assembler messages:
foo.s:49: Error: syntax error; found `(' but expected `)'
foo.s:49: Error: junk at end of line: `(9))'

Looking at foo.s, it's pretty obvious that %0 is already in the ds(rA)
form, and adding 0() around it breaks things. out_be64 expands to:

#APP
std 0,0(0(9)); eieio
#NO_APP

It's possible this is an artifact of my cross-toolchain (gcc
3.4.0/binutils 2.15 built with Dan Kegel's crosstool),

Benjamin> Does this totally untested patch works for you ?

Yes, that looks fine (after fixing val to be unsigned long in
out_be64). You know infinitely more about ppc64 asm than I do so I'm
sure your version is better.

Thanks,
Roland
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/