Skip to contentSkip to conversation

ALPHA: build fixes - force architecture, eliminate wastage

PATCH NAK Ivan Kokshaysky 2 participants 2 messages Apr 11, 2007 Alpha port

lore
Share & tools
lore
#0 lore raw

PATCH 2/7 ALPHA: build fixes - force architecture, eliminate wastage

Files:

arch/alpha/kernel/sys_titan.c

Request EV67 since no TITAN-based machine is any less, or see errors.

include/asm-alpha/compiler.h

Request EV56 so we're sure to get what we want, or see errors.

include/asm-alpha/module.h

Stop all the wasted/worthless "got" messages.

---

arch/alpha/kernel/sys_titan.c +1 -1
diff -Naurp a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c
@@ -257,7 +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));
+		__asm__(".arch ev67; ctlz %1, %0" : "=r"(vector) : "r"(mask));
 		vector = 63 - vector;
 		mask &= ~(1UL << vector);	/* clear it out 	 */
 		vector = 0x900 + (vector << 4);	/* convert to SRM vector */
include/asm-alpha/compiler.h +10 -6
diff -Naurp a/include/asm-alpha/compiler.h b/include/asm-alpha/compiler.h
@@ -78,16 +78,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__
include/asm-alpha/module.h +1 -1
diff -Naurp a/include/asm-alpha/module.h b/include/asm-alpha/module.h
@@ -17,7 +17,7 @@ struct mod_arch_specific
 #define ARCH_SHF_SMALL SHF_ALPHA_GPREL
 
 #ifdef MODULE
-asm(".section .got,\"aws\",@progbits; .align 3; .previous");
+asm(".section .got,\"aw\",@progbits; .align 3; .previous");
 #endif
 
 #endif /*_ALPHA_MODULE_H*/
#1 lore raw

arch/alpha/kernel/sys_titan.c titan_dispatch_irqs(u64 mask) · line 260

Quoted 2 lines · Ivan Kokshaysky
arch/alpha/kernel/sys_titan.c +1 -1
-		__asm__("ctlz %1, %0" : "=r"(vector) : "r"(mask));
+		__asm__(".arch ev67; ctlz %1, %0" : "=r"(vector) : "r"(mask));

This should use __kernel_ctlz, and we should use

#ifdef __alpha_cix__

# if __GNUC__ == 3 && __GNUC_MINOR__ >= 4 || __GNUC__ > 3
#  define __kernel_cttz(x)		__builtin_ctzl(x)
# else
#  define __kernel_cttz(x)                                              \
  ({ unsigned long __kir;                                               \
     __asm__("cttz %1,%0" : "=r"(__kir) : "r"(x));                      \
     __kir; })
# endif
#else
# define __kernel_cttz(x)                                               \
  ({ unsigned long __kir;                                               \
     __asm__(".arch ev67; cttz %1,%0" : "=r"(__kir) : "r"(x));          \
     __kir; })
#endif

etc, for the other __kernel_ctlz and __kernel_ctpop definitions.

include/asm-alpha/module.h struct mod_arch_specific · line 20

Quoted 2 lines
include/asm-alpha/module.h +1 -1
-asm(".section .got,\"aws\",@progbits; .align 3; .previous");
+asm(".section .got,\"aw\",@progbits; .align 3; .previous");

Are you absolutely certain that the got gets put into the correct spot when you do this? It really ought to have the SHF_ALPHA_GPREL bit set, so that the ARCH_SHF_SMALL checks in kernel/module.c do the correct thing.

I NAK this chunk without further proof. Anyway, the *proper* fix is in the assembler; it shouldn't be complaining.

r~