OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-ppc/] [system.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
#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
 
16
/*extern void memcpy(void *, void *, int);*/
17
extern void bzero(void *, int);
18
 
19
struct task_struct;
20
extern void switch_to(struct task_struct *prev, struct task_struct *next);
21
 
22
#define save_flags(flags) _save_flags(&(flags))
23
#define restore_flags(flags) _restore_flags(flags)
24
 
25
#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
26
 
27
/* this guy lives in arch/ppc/kernel */
28
extern inline unsigned long *xchg_u32(void *m, unsigned long val);
29
 
30
/*
31
 *  these guys don't exist.
32
 *  someone should create them.
33
 *              -- Cort
34
 */
35
extern void *xchg_u64(void *ptr, unsigned long val);
36
extern int xchg_u8(char *m, char val);
37
 
38
/*
39
 * This function doesn't exist, so you'll get a linker error
40
 * if something tries to do an invalid xchg().
41
 *
42
 * This only works if the compiler isn't horribly bad at optimizing.
43
 * gcc-2.5.8 reportedly can't handle this, but as that doesn't work
44
 * too well on the alpha anyway..
45
 */
46
extern void __xchg_called_with_bad_pointer(void);
47
 
48
static inline unsigned long __xchg(unsigned long x, void * ptr, int size)
49
{
50
        switch (size) {
51
                case 4:
52
                        return (unsigned long )xchg_u32(ptr, x);
53
                case 8:
54
                        return (unsigned long )xchg_u64(ptr, x);
55
        }
56
        __xchg_called_with_bad_pointer();
57
        return x;
58
 
59
 
60
}
61
 
62
 
63
 
64
extern inline int tas(char * m)
65
{
66
        return xchg_u8(m,1);
67
}
68
 
69
extern inline void * xchg_ptr(void * m, void * val)
70
{
71
        return (void *) xchg_u32(m, (unsigned long) val);
72
}
73
 
74
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.