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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-i960/] [segment.h] - Blame information for rev 1777

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
#ifndef _I960_SEGMENT_H
2
#define _I960_SEGMENT_H
3
 
4
/* define constants */
5
/* Address spaces (FC0-FC2) */
6
#define USER_DATA     (1)
7
#ifndef USER_DS
8
#define USER_DS       (USER_DATA)
9
#endif
10
#define USER_PROGRAM  (2)
11
#define SUPER_DATA    (5)
12
#ifndef KERNEL_DS
13
#define KERNEL_DS     (SUPER_DATA)
14
#endif
15
#define SUPER_PROGRAM (6)
16
#define CPU_SPACE     (7)
17
 
18
#ifndef __ASSEMBLY__
19
 
20
/*
21
 * Uh, these should become the main single-value transfer routines..
22
 * They automatically use the right size if we just have the right
23
 * pointer type..
24
 */
25
#define put_user(x,ptr) __put_user((unsigned long)(x),(ptr),sizeof(*(ptr)))
26
#define get_user(ptr) ((__typeof__(*(ptr)))__get_user((ptr),sizeof(*(ptr))))
27
 
28
/*
29
 * This is a silly but good way to make sure that
30
 * the __put_user function is indeed always optimized,
31
 * and that we use the correct sizes..
32
 */
33
extern int bad_user_access_length(void);
34
 
35
#define __ptr(x) ((unsigned long *)(x))
36
 
37
static inline void __put_user(unsigned long x, void * y, int size)
38
{
39
        switch (size) {
40
                case 1:
41
                        *(char*)y = x;
42
                        break;
43
                case 2:
44
                        *(short*)y = x;
45
                        break;
46
                case 4:
47
                        *(long*)y = x;
48
                        break;
49
                default:
50
                        bad_user_access_length();
51
        }
52
}
53
 
54
static inline unsigned long __get_user(const void * y, int size)
55
{
56
        switch (size) {
57
                case 1:
58
                        return *(unsigned char*) y;
59
                case 2:
60
                        return *(unsigned short*) y;
61
                case 4:
62
                        return *(unsigned long*) y;
63
                default:
64
                        return bad_user_access_length();
65
        }
66
}
67
#undef __ptr
68
 
69
/*
70
 * These are deprecated..
71
 *
72
 * Use "put_user()" and "get_user()" with the proper pointer types instead.
73
 */
74
 
75
#define get_fs_byte(addr) __get_user((const unsigned char *)(addr),1)
76
#define get_fs_word(addr) __get_user((const unsigned short *)(addr),2)
77
#define get_fs_long(addr) __get_user((const unsigned int *)(addr),4)
78
 
79
#define put_fs_byte(x,addr) __put_user((x),(unsigned char *)(addr),1)
80
#define put_fs_word(x,addr) __put_user((x),(unsigned short *)(addr),2)
81
#define put_fs_long(x,addr) __put_user((x),(unsigned int *)(addr),4)
82
 
83
#ifdef WE_REALLY_WANT_TO_USE_A_BROKEN_INTERFACE
84
 
85
static inline unsigned char get_user_byte(const char * addr)
86
{
87
        return __get_user(addr,1);
88
}
89
 
90
static inline unsigned short get_user_word(const short *addr)
91
{
92
        return __get_user(addr,2);
93
}
94
 
95
static inline unsigned long get_user_long(const int *addr)
96
{
97
        return __get_user(addr,4);
98
}
99
 
100
static inline void put_user_byte(char val,char *addr)
101
{
102
        __put_user(val, addr, 1);
103
}
104
 
105
static inline void put_user_word(short val,short * addr)
106
{
107
        __put_user(val, addr, 2);
108
}
109
 
110
static inline void put_user_long(unsigned long val,int * addr)
111
{
112
        __put_user(val, addr, 4);
113
}
114
 
115
#endif
116
 
117
#include <linux/string.h>
118
static inline void __generic_memcpy_tofs(void * to, const void * from, unsigned long n)
119
{
120
        memcpy(to, from, n);
121
}
122
 
123
static inline void __constant_memcpy_tofs(void * to, const void * from, unsigned long n)
124
{
125
        memcpy(to, from, n);
126
}
127
 
128
static inline void __generic_memcpy_fromfs(void * to, const void * from, unsigned long n)
129
{
130
        memcpy(to, from, n);
131
}
132
 
133
static inline void __constant_memcpy_fromfs(void * to, const void * from, unsigned long n)
134
{
135
        memcpy(to, from, n);
136
}
137
 
138
#define memcpy_fromfs(to, from, n) \
139
(__builtin_constant_p(n) ? \
140
 __constant_memcpy_fromfs((to),(from),(n)) : \
141
 __generic_memcpy_fromfs((to),(from),(n)))
142
 
143
#define memcpy_tofs(to, from, n) \
144
(__builtin_constant_p(n) ? \
145
 __constant_memcpy_tofs((to),(from),(n)) : \
146
 __generic_memcpy_tofs((to),(from),(n)))
147
 
148
/*
149
 * Get/set the SFC/DFC registers for MOVES instructions
150
 */
151
 
152
static inline unsigned long get_fs(void)
153
{
154
        return USER_DS;
155
}
156
 
157
static inline unsigned long get_ds(void)
158
{
159
    /* return the supervisor data space code */
160
    return KERNEL_DS;
161
}
162
 
163
static inline void set_fs(unsigned long val)
164
{
165
}
166
 
167
#endif /* __ASSEMBLY__ */
168
 
169
#endif /* _I960_SEGMENT_H */

powered by: WebSVN 2.1.0

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