patch-2.1.37 linux/include/asm-alpha/system.h

Next file: linux/include/asm-i386/bitops.h
Previous file: linux/include/asm-alpha/spinlock.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.36/linux/include/asm-alpha/system.h linux/include/asm-alpha/system.h
@@ -56,63 +56,95 @@
 #define halt() __asm__ __volatile__ ("call_pal %0" : : "i" (PAL_halt) : "memory")
 
 #define switch_to(prev,next) do { \
-	current_set[0] = current = next; \
+	current = next; \
 	alpha_switch_to((unsigned long) &current->tss - 0xfffffc0000000000); \
 } while (0)
 
 extern void alpha_switch_to(unsigned long pctxp);
 
-extern void imb(void);
-
 #define mb() \
 __asm__ __volatile__("mb": : :"memory")
 
+#define imb() \
+__asm__ __volatile__ ("call_pal %0" : : "i" (PAL_imb) : "memory")
+
 #define draina() \
 __asm__ __volatile__ ("call_pal %0" : : "i" (PAL_draina) : "memory")
 
-#define getipl(__old_ipl) \
-__asm__ __volatile__( \
-	"call_pal 54\n\t" \
-	"bis $0,$0,%0" \
-	: "=r" (__old_ipl) \
-	: : "$0", "$1", "$16", "$22", "$23", "$24", "$25")
-
-#define setipl(__new_ipl) \
-__asm__ __volatile__( \
-	"bis %0,%0,$16\n\t" \
-	"call_pal 53" \
-	: : "r" (__new_ipl) \
-	: "$0", "$1", "$16", "$22", "$23", "$24", "$25", "memory")
-
-#define swpipl(__old_ipl,__new_ipl) \
-__asm__ __volatile__( \
-	"bis %1,%1,$16\n\t" \
-	"call_pal 53\n\t" \
-	"bis $0,$0,%0" \
-	: "=r" (__old_ipl) \
-	: "r" (__new_ipl) \
-	: "$0", "$1", "$16", "$22", "$23", "$24", "$25", "memory")
+#define call_pal1(palno,arg) \
+({ \
+	register unsigned long __r0 __asm__("$0"); \
+	register unsigned long __r16 __asm__("$16"); __r16 = arg; \
+	__asm__ __volatile__( \
+		"call_pal %3" \
+		:"=r" (__r0),"=r" (__r16) \
+		:"1" (__r16),"i" (palno) \
+		:"$1", "$22", "$23", "$24", "$25", "memory"); \
+	__r0; \
+})
+
+#define getipl() \
+({ \
+	register unsigned long r0 __asm__("$0"); \
+	__asm__ __volatile__( \
+		"call_pal %1" \
+		:"=r" (r0) \
+		:"i" (PAL_rdps) \
+		:"$1", "$16", "$22", "$23", "$24", "$25", "memory"); \
+	r0; \
+})
+
+#define setipl(ipl) \
+do { \
+	register unsigned long __r16 __asm__("$16") = (ipl); \
+	__asm__ __volatile__( \
+		"call_pal %2" \
+		:"=r" (__r16) \
+		:"0" (__r16),"i" (PAL_swpipl) \
+		:"$0", "$1", "$22", "$23", "$24", "$25", "memory"); \
+} while (0)
+
+#define swpipl(ipl) \
+({ \
+	register unsigned long __r0 __asm__("$0"); \
+	register unsigned long __r16 __asm__("$16") = (ipl); \
+	__asm__ __volatile__( \
+		"call_pal %3" \
+		:"=r" (__r0),"=r" (__r16) \
+		:"1" (__r16),"i" (PAL_swpipl) \
+		:"$1", "$22", "$23", "$24", "$25", "memory"); \
+	__r0; \
+})
 
 #define __cli()			setipl(7)
 #define __sti()			setipl(0)
-#define __save_flags(flags)	getipl(flags)
+#define __save_flags(flags)	do { (flags) = getipl(); } while (0)
 #define __restore_flags(flags)	setipl(flags)
 
 #define cli()			setipl(7)
 #define sti()			setipl(0)
-#define save_flags(flags)	getipl(flags)
+#define save_flags(flags)	do { (flags) = getipl(); } while (0)
 #define restore_flags(flags)	setipl(flags)
 
 /*
  * TB routines..
  */
-extern void tbi(long type, ...);
+#define __tbi(nr,arg,arg1...) do { \
+	register unsigned long __r16 __asm__("$16") = (nr); \
+	register unsigned long __r17 __asm__("$17"); arg; \
+	__asm__ __volatile__( \
+		"call_pal %3" \
+		:"=r" (__r16),"=r" (__r17) \
+		:"0" (__r16),"i" (PAL_tbi) ,##arg1 \
+		:"$0", "$1", "$22", "$23", "$24", "$25"); \
+} while (0)
 
-#define tbisi(x)	tbi(1,(x))
-#define tbisd(x)	tbi(2,(x))
-#define tbis(x)		tbi(3,(x))
-#define tbiap()		tbi(-1)
-#define tbia()		tbi(-2)
+#define tbi(x,y)	__tbi(x,__r17=(y),"1" (__r17))
+#define tbisi(x)	__tbi(1,__r17=(x),"1" (__r17))
+#define tbisd(x)	__tbi(2,__r17=(x),"1" (__r17))
+#define tbis(x)		__tbi(3,__r17=(x),"1" (__r17))
+#define tbiap()		__tbi(-1, /* no second argument */)
+#define tbia()		__tbi(-2, /* no second argument */)
 
 /*
  * Give prototypes to shut up gcc.
@@ -129,9 +161,9 @@
 	"	bis %3,%3,%1\n"
 	"	stl_c %1,%2\n"
 	"	beq %1,2f\n"
-	".text 2\n"
+	".section .text2,\"ax\"\n"
 	"2:	br 1b\n"
-	".text"
+	".previous"
 	: "=&r" (val), "=&r" (dummy), "=m" (*m)
 	: "r" (val), "m" (*m));
 
@@ -147,9 +179,9 @@
 	"	bis %3,%3,%1\n"
 	"	stq_c %1,%2\n"
 	"	beq %1,2f\n"
-	".text 2\n"
+	".section .text2,\"ax\"\n"
 	"2:	br 1b\n"
-	".text"
+	".previous"
 	: "=&r" (val), "=&r" (dummy), "=m" (*m)
 	: "r" (val), "m" (*m));
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov