root/include/asm-ppc/system.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. __xchg
  2. tas
  3. xchg_ptr

   1 #ifndef __PPC_SYSTEM_H
   2 #define __PPC_SYSTEM_H
   3 
   4 #if 0
   5 #define mb() \
   6 __asm__ __volatile__("mb": : :"memory")
   7 #endif
   8 #define mb()  __asm__ __volatile__ (""   : : :"memory")
   9 
  10 
  11 extern void __save_flags(long *flags);
  12 extern void __restore_flags(long flags);
  13 extern void sti(void);
  14 extern void cli(void);
  15 extern int _disable_interrupts(void);
  16 extern void _enable_interrupts(int);
  17 
  18 /*extern void memcpy(void *, void *, int);*/
  19 extern void bzero(void *, int);
  20 
  21 struct task_struct;
  22 extern void switch_to(struct task_struct *);
  23 
  24 #define save_flags(flags) __save_flags(&(flags))
  25 #define restore_flags(flags) __restore_flags(flags)
  26 
  27 #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
  28 
  29 /* this guy lives in arch/ppc/kernel */
  30 extern inline unsigned long *xchg_u32(void *m, unsigned long val);
  31 
  32 /*
  33  *  these guys don't exist.
  34  *  someone should create them.
  35  *              -- Cort
  36  */
  37 extern void *xchg_u64(void *ptr, unsigned long val);
  38 extern int xchg_u8(char *m, char val);
  39 
  40 /*
  41  * This function doesn't exist, so you'll get a linker error
  42  * if something tries to do an invalid xchg().
  43  *
  44  * This only works if the compiler isn't horribly bad at optimizing.
  45  * gcc-2.5.8 reportedly can't handle this, but as that doesn't work
  46  * too well on the alpha anyway..
  47  */
  48 extern void __xchg_called_with_bad_pointer(void);
  49 
  50 static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
     /* [previous][next][first][last][top][bottom][index][help] */
  51 {
  52         switch (size) {
  53                 case 4:
  54                         return (unsigned long )xchg_u32(ptr, x);
  55                 case 8:
  56                         return (unsigned long )xchg_u64(ptr, x);
  57         }
  58         __xchg_called_with_bad_pointer();
  59         return x;
  60 
  61 
  62 }
  63 
  64 
  65 
  66 extern inline int tas(char * m)
     /* [previous][next][first][last][top][bottom][index][help] */
  67 {
  68         return xchg_u8(m,1);
  69 }
  70 
  71 extern inline void * xchg_ptr(void * m, void * val)
     /* [previous][next][first][last][top][bottom][index][help] */
  72 {
  73         return (void *) xchg_u32(m, (unsigned long) val);
  74 }
  75 
  76 #endif

/* [previous][next][first][last][top][bottom][index][help] */