On Wed, 2006-06-21 at 13:49 -0500, Hollis Blanchard wrote:
> diff -r 6f3d44537b76 include/asm-powerpc/xen/asm/synch_bitops.h
> --- a/include/asm-powerpc/xen/asm/synch_bitops.h Fri Jun 16 16:07:38
> 2006 -0500
> +++ b/include/asm-powerpc/xen/asm/synch_bitops.h Wed Jun 21 13:42:56
> 2006 -0500
> @@ -6,6 +6,8 @@
>
> #ifdef CONFIG_SMP
> #include <asm/bitops.h>
> +
> +#define gnttab_cmpxchg_flags(ptr,o,n) synch_cmpxchg((int *)(ptr),o,n)
>
> #define synch_change_bit(a,b) change_bit(a,b)
> #define synch_clear_bit(a,b) clear_bit(a,b)
Of course, this won't work. This should be better:
static inline __u16 gnttab_cmpxchg_flags(__u16 *ptr, __u16 o, __u16 n)
{
unsigned long *laddr;
unsigned long old;
unsigned long new;
unsigned long shift = (sizeof(long) - sizeof(*ptr)) * 8;
BUG_ON((long)ptr % sizeof(long));
laddr = (unsigned long *)ptr;
old = ((unsigned long)o << shift) | (*laddr & ((1UL<<shift)-1));
new = ((unsigned long)n << shift) | (*laddr & ((1UL<<shift)-1));
return synch_cmpxchg(laddr, old, new);
}
It builds at least, and currently there's no way to test this code
(since the virtual IO drivers aren't quite ready yet). If there aren't
any obvious errors detected by inspection, I'll check these revised
versions in tomorrow.
--
Hollis Blanchard
IBM Linux Technology Center
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|