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

Subversion Repositories or1k_old

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
#ifndef _ASM_PPC_SEGMENT_H
2
#define _ASM_PPC_SEGMENT_H
3
 
4
#include <linux/string.h>
5
 
6
#define put_user(x,ptr) __put_user((unsigned long)(x),(ptr),sizeof(*(ptr)))
7
#define get_user(ptr) ((__typeof__(*(ptr)))__get_user((ptr),sizeof(*(ptr))))
8
 
9
extern int bad_user_access_length(void);
10
 
11
static inline void __put_user(unsigned long x, void * y, int size)
12
{
13
        switch (size) {
14
                case 1:
15
                        *(char *) y = x;
16
                        break;
17
                case 2:
18
                        *(short *) y = x;
19
                        break;
20
                case 4:
21
                        *(int *) y = x;
22
                        break;
23
                case 8:
24
                        *(long *) y = x;
25
                        break;
26
                default:
27
                        bad_user_access_length();
28
        }
29
}
30
 
31
static inline unsigned long __get_user(const void * y, int size)
32
{
33
        switch (size) {
34
                case 1:
35
                        return *(unsigned char *) y;
36
                case 2:
37
                        return *(unsigned short *) y;
38
                case 4:
39
                        return *(unsigned int *) y;
40
                case 8:
41
                        return *(unsigned long *) y;
42
                default:
43
                        return bad_user_access_length();
44
        }
45
}
46
 
47
static inline unsigned char get_user_byte(const char * addr)
48
{
49
        return *addr;
50
}
51
 
52
#define get_fs_byte(addr) get_user_byte((char *)(addr))
53
 
54
static inline unsigned short get_user_word(const short *addr)
55
{
56
        return *addr;
57
}
58
 
59
#define get_fs_word(addr) get_user_word((short *)(addr))
60
 
61
static inline unsigned long get_user_long(const int *addr)
62
{
63
        return *addr;
64
}
65
 
66
#define get_fs_long(addr) get_user_long((int *)(addr))
67
 
68
static inline unsigned long get_user_quad(const long *addr)
69
{
70
        return *addr;
71
}
72
 
73
#define get_fs_quad(addr) get_user_quad((long *)(addr))
74
 
75
static inline void put_user_byte(char val,char *addr)
76
{
77
        *addr = val;
78
}
79
 
80
#define put_fs_byte(x,addr) put_user_byte((x),(char *)(addr))
81
 
82
static inline void put_user_word(short val,short * addr)
83
{
84
        *addr = val;
85
}
86
 
87
#define put_fs_word(x,addr) put_user_word((x),(short *)(addr))
88
 
89
static inline void put_user_long(unsigned long val,int * addr)
90
{
91
        *addr = val;
92
}
93
 
94
#define put_fs_long(x,addr) put_user_long((x),(int *)(addr))
95
 
96
static inline void put_user_quad(unsigned long val,long * addr)
97
{
98
        *addr = val;
99
}
100
 
101
#define put_fs_quad(x,addr) put_user_quad((x),(long *)(addr))
102
 
103
#define memcpy_fromfs(to, from, n) memcpy((to),(from),(n))
104
 
105
#define memcpy_tofs(to, from, n) memcpy((to),(from),(n))
106
 
107
/*
108
 * For segmented architectures, these are used to specify which segment
109
 * to use for the above functions.
110
 *
111
 * The powerpc is not segmented, so these are just dummies.
112
 */
113
 
114
#define KERNEL_DS 0
115
#define USER_DS 1
116
 
117
static inline unsigned long get_fs(void)
118
{
119
        return 0;
120
}
121
 
122
static inline unsigned long get_ds(void)
123
{
124
        return 0;
125
}
126
 
127
static inline void set_fs(unsigned long val)
128
{
129
}
130
 
131
#endif /* _ASM_SEGMENT_H */

powered by: WebSVN 2.1.0

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