patch-2.1.53 linux/include/asm-ppc/system.h

Next file: linux/include/asm-sparc/elf.h
Previous file: linux/include/asm-ppc/spinlock.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.52/linux/include/asm-ppc/system.h linux/include/asm-ppc/system.h
@@ -8,6 +8,8 @@
 
 #define __save_flags(flags)	({\
 	__asm__ __volatile__ ("mfmsr %0" : "=r" ((flags)) : : "memory"); })
+#define __save_and_cli(flags)	({__save_flags(flags);__cli();})
+
 extern __inline__ void __restore_flags(unsigned long flags)
 {
         extern unsigned lost_interrupts;
@@ -80,27 +82,29 @@
 extern void dump_regs(struct pt_regs *);
 
 #ifndef __SMP__
+
 #define cli()	__cli()
 #define sti()	__sti()
 #define save_flags(flags)	__save_flags(flags)
 #define restore_flags(flags)	__restore_flags(flags)
 
-#else
-#error need global cli/sti etc. defined for SMP
-#endif
+#else /* __SMP__ */
 
-#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
+extern void __global_cli(void);
+extern void __global_sti(void);
+extern unsigned long __global_save_flags(void);
+extern void __global_restore_flags(unsigned long);
+#define cli() __global_cli()
+#define sti() __global_sti()
+#define save_flags(x) ((x)=__global_save_flags())
+#define restore_flags(x) __global_restore_flags(x)
 
-/* this guy lives in arch/ppc/kernel */
-extern inline unsigned long *xchg_u32(void *m, unsigned long val);
+#endif /* !__SMP__ */
+
+#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
 
-/*
- *  these guys don't exist.
- *  someone should create them.
- *              -- Cort
- */
 extern void *xchg_u64(void *ptr, unsigned long val);
-extern int xchg_u8(char *m, char val);
+extern void *xchg_u32(void *m, unsigned long val);
 
 /*
  * This function doesn't exist, so you'll get a linker error
@@ -112,6 +116,9 @@
  */
 extern void __xchg_called_with_bad_pointer(void);
 
+#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
+#define tas(ptr) (xchg((ptr),1))
+
 static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
 {
 	switch (size) {
@@ -124,13 +131,6 @@
 	return x;
 
 
-}
-
-
-
-extern inline int tas(char * m)
-{
-	return xchg_u8(m,1);
 }
 
 extern inline void * xchg_ptr(void * m, void * val)

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