mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ALPHA: build fixes - force architecture (take 2)
@ 2007-04-12  8:01 Ivan Kokshaysky
  2007-04-12 21:16 ` Richard Henderson
  0 siblings, 1 reply; 4+ messages in thread
From: Ivan Kokshaysky @ 2007-04-12  8:01 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Richard Henderson, Jay Estabrook, linux-kernel

[CIX stuff reworked, .got change dropped as Richard suggested]

Override compiler .arch directive for generic kernel build.

Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>

--- linux.orig/arch/alpha/kernel/sys_titan.c	Thu Apr 12 01:19:47 2007
+++ linux/arch/alpha/kernel/sys_titan.c	Thu Apr 12 01:40:19 2007
@@ -257,8 +257,7 @@ titan_dispatch_irqs(u64 mask)
 	 */
 	while (mask) {
 		/* convert to SRM vector... priority is <63> -> <0> */
-		__asm__("ctlz %1, %0" : "=r"(vector) : "r"(mask));
-		vector = 63 - vector;
+		vector = 63 - __kernel_ctlz(mask);
 		mask &= ~(1UL << vector);	/* clear it out 	 */
 		vector = 0x900 + (vector << 4);	/* convert to SRM vector */
 		
--- linux.orig/include/asm-alpha/compiler.h	Thu Apr 12 01:19:47 2007
+++ linux/include/asm-alpha/compiler.h	Thu Apr 12 01:37:01 2007
@@ -17,9 +17,6 @@
 # define __kernel_extbl(val, shift)	__builtin_alpha_extbl(val, shift)
 # define __kernel_extwl(val, shift)	__builtin_alpha_extwl(val, shift)
 # define __kernel_cmpbge(a, b)		__builtin_alpha_cmpbge(a, b)
-# define __kernel_cttz(x)		__builtin_ctzl(x)
-# define __kernel_ctlz(x)		__builtin_clzl(x)
-# define __kernel_ctpop(x)		__builtin_popcountl(x)
 #else
 # define __kernel_insbl(val, shift)					\
   ({ unsigned long __kir;						\
@@ -49,17 +46,39 @@
   ({ unsigned long __kir;						\
      __asm__("cmpbge %r2,%1,%0" : "=r"(__kir) : "rI"(b), "rJ"(a));	\
      __kir; })
+#endif
+
+#ifdef __alpha_cix__
+# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3
+#  define __kernel_cttz(x)		__builtin_ctzl(x)
+#  define __kernel_ctlz(x)		__builtin_clzl(x)
+#  define __kernel_ctpop(x)		__builtin_popcountl(x)
+# else
+#  define __kernel_cttz(x)						\
+   ({ unsigned long __kir;						\
+      __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x));			\
+      __kir; })
+#  define __kernel_ctlz(x)						\
+   ({ unsigned long __kir;						\
+      __asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x));			\
+      __kir; })
+#  define __kernel_ctpop(x)						\
+   ({ unsigned long __kir;						\
+      __asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x));			\
+      __kir; })
+# endif
+#else
 # define __kernel_cttz(x)						\
   ({ unsigned long __kir;						\
-     __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x));			\
+     __asm__(".arch ev67; cttz %1,%0" : "=r"(__kir) : "r"(x));		\
      __kir; })
 # define __kernel_ctlz(x)						\
   ({ unsigned long __kir;						\
-     __asm__("ctlz %1,%0" : "=r"(__kir) : "r"(x));			\
+     __asm__(".arch ev67; ctlz %1,%0" : "=r"(__kir) : "r"(x));		\
      __kir; })
 # define __kernel_ctpop(x)						\
   ({ unsigned long __kir;						\
-     __asm__("ctpop %1,%0" : "=r"(__kir) : "r"(x));			\
+     __asm__(".arch ev67; ctpop %1,%0" : "=r"(__kir) : "r"(x));		\
      __kir; })
 #endif
 
@@ -78,16 +97,20 @@
 #else
 #define __kernel_ldbu(mem)				\
   ({ unsigned char __kir;				\
-     __asm__("ldbu %0,%1" : "=r"(__kir) : "m"(mem));	\
+     __asm__(".arch ev56;				\
+	      ldbu %0,%1" : "=r"(__kir) : "m"(mem));	\
      __kir; })
 #define __kernel_ldwu(mem)				\
   ({ unsigned short __kir;				\
-     __asm__("ldwu %0,%1" : "=r"(__kir) : "m"(mem));	\
+     __asm__(".arch ev56;				\
+	      ldwu %0,%1" : "=r"(__kir) : "m"(mem));	\
      __kir; })
-#define __kernel_stb(val,mem) \
-  __asm__("stb %1,%0" : "=m"(mem) : "r"(val))
-#define __kernel_stw(val,mem) \
-  __asm__("stw %1,%0" : "=m"(mem) : "r"(val))
+#define __kernel_stb(val,mem)				\
+  __asm__(".arch ev56;					\
+	   stb %1,%0" : "=m"(mem) : "r"(val))
+#define __kernel_stw(val,mem)				\
+  __asm__(".arch ev56;					\
+	   stw %1,%0" : "=m"(mem) : "r"(val))
 #endif
 
 #ifdef __KERNEL__

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALPHA: build fixes - force architecture (take 2)
  2007-04-12  8:01 [PATCH] ALPHA: build fixes - force architecture (take 2) Ivan Kokshaysky
@ 2007-04-12 21:16 ` Richard Henderson
  2007-04-13 19:05   ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2007-04-12 21:16 UTC (permalink / raw)
  To: Ivan Kokshaysky; +Cc: Andrew Morton, Jay Estabrook, linux-kernel

On Thu, Apr 12, 2007 at 12:01:10PM +0400, Ivan Kokshaysky wrote:
> [CIX stuff reworked, .got change dropped as Richard suggested]
> 
> Override compiler .arch directive for generic kernel build.
> 
> Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>

Signed-off-by: Richard Henderson  <rth@twiddle.net>



r~

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALPHA: build fixes - force architecture (take 2)
  2007-04-12 21:16 ` Richard Henderson
@ 2007-04-13 19:05   ` Andrew Morton
  2007-04-13 20:11     ` Ivan Kokshaysky
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2007-04-13 19:05 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Ivan Kokshaysky, Jay Estabrook, linux-kernel

On Thu, 12 Apr 2007 14:16:39 -0700
Richard Henderson <rth@twiddle.net> wrote:

> On Thu, Apr 12, 2007 at 12:01:10PM +0400, Ivan Kokshaysky wrote:
> > [CIX stuff reworked, .got change dropped as Richard suggested]
> > 
> > Override compiler .arch directive for generic kernel build.
> > 
> > Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> 
> Signed-off-by: Richard Henderson  <rth@twiddle.net>
> 

So I currently have

alpha-fix-bootp-image-creation.patch
alpha-prctl-macros.patch
alpha-fixes-for-specific-machine-types.patch
alpha-more-fixes-for-specific-machine-types.patch
alpha-build-fixes-force-architecture.patch

Which of these do you think should be in 2.6.21?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ALPHA: build fixes - force architecture (take 2)
  2007-04-13 19:05   ` Andrew Morton
@ 2007-04-13 20:11     ` Ivan Kokshaysky
  0 siblings, 0 replies; 4+ messages in thread
From: Ivan Kokshaysky @ 2007-04-13 20:11 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Richard Henderson, Jay Estabrook, linux-kernel

On Fri, Apr 13, 2007 at 12:05:03PM -0700, Andrew Morton wrote:
> alpha-fix-bootp-image-creation.patch
> alpha-prctl-macros.patch
> alpha-fixes-for-specific-machine-types.patch
> alpha-more-fixes-for-specific-machine-types.patch
> alpha-build-fixes-force-architecture.patch
> 
> Which of these do you think should be in 2.6.21?

The last one, definitely. Of course, it would be nice to get the
"specific machine" stuff there too, but it's not so critical.

Ivan.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-04-13 20:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-12  8:01 [PATCH] ALPHA: build fixes - force architecture (take 2) Ivan Kokshaysky
2007-04-12 21:16 ` Richard Henderson
2007-04-13 19:05   ` Andrew Morton
2007-04-13 20:11     ` Ivan Kokshaysky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome