This source file includes following definitions.
- __xchg
- tas
- 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
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
30 extern inline unsigned long *xchg_u32(void *m, unsigned long val);
31
32
33
34
35
36
37 extern void *xchg_u64(void *ptr, unsigned long val);
38 extern int xchg_u8(char *m, char val);
39
40
41
42
43
44
45
46
47
48 extern void __xchg_called_with_bad_pointer(void);
49
50 static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
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)
67 {
68 return xchg_u8(m,1);
69 }
70
71 extern inline void * xchg_ptr(void * m, void * val)
72 {
73 return (void *) xchg_u32(m, (unsigned long) val);
74 }
75
76 #endif