Re: Yet another inline asm worry: mtsp() macro (and may be other)?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 20, 2008 at 03:01:43PM +0100, Joel Soete wrote:
> Well I tried something:
> @@ -103,10 +108,23 @@
>  	cr;				\
>  })
>  
> -#define mtsp(gr, cr) \
> -	__asm__ __volatile__("mtsp %0,%1" \
> -		: /* no outputs */ \
> -		: "r" (gr), "i" (cr) : "memory")
> +#define mtsp(lval, i_sr)					\
> +{								\
> +	if (lval) {						\
> +		unsigned long reg = (unsigned long)(lval);	\
> +		__asm__ __volatile__(				\
> +			"mtsp %0, %%sr%1"			\
> +			: /* no outputs */			\
> +			: "r" (reg), "i" (i_sr)			\
> +			: "memory");				\
> +	} else {						\
> +		__asm__ __volatile__(				\
> +			"mtsp %%r0, %%sr%0"			\
> +			: /* no outputs */			\
> +			: "i" (i_sr)				\
> +			: "memory");				\
> +	};							\
> +}
>  
> that does well the drill for ccio-dma driver but else where (memcpy or cache)
> it looks worse then the original, so get rid of this idea.

Try this instead:

#define mtsp(space, cr)	{						\
	if (__builtin_constant_p(space) && (space == 0)) {		\
		__asm__ __volatile__("mtsp %%r0, %0" :			\
			/* no outputs */ : "i" (cr) : "memory");	\
	} else {							\
		__asm__ __volatile__("mtsp %0, %1" :			\
			/* no outputs */ : "r" (space), "i" (cr) :	\
				"memory");				\
	}								\
}

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux