in_be64() assembly

Paul Mackerras paulus at samba.org
Wed Jan 5 11:24:44 EST 2005


Jake Moilanen writes:

> In in_be64(), when changed the "m" operand to a "b", the kernel built
> fine (although I haven't tried running it yet).  What does the "b"
> operand mean?

"b" means the value should be in a "base" register, i.e. any gpr other
than gpr0.

Your patch isn't correct.  We can either do:

	__asm__ __volatile__("ld %0,0(%1); twi 0,%0,0; isync"
			     : "=r" (ret) : "b" (addr));

(note no "*" before addr) or we can do

	__asm__ __volatile__("ld%U1%X1 %0,%1; twi 0,%0,0; isync"
			     : "=r" (ret) : "m" (*addr));

On the whole I think I prefer the second.

Paul.



More information about the Linuxppc64-dev mailing list