Version:
~ [ 0.6-2.3.46 ] ~
Architecture:
~ [ um ] ~
** Warning: Cannot open xref database.
1 #ifndef __UM_UACCESS_H
2 #define __UM_UACCESS_H
3
4 #include "asm/processor.h"
5 #include "linux/string.h"
6
7 #define VERIFY_READ 0
8 #define VERIFY_WRITE 1
9
10 /*
11 * The fs value determines whether argument validity checking should be
12 * performed or not. If get_fs() == USER_DS, checking is performed, with
13 * get_fs() == KERNEL_DS, checking is bypassed.
14 *
15 * For historical reasons, these macros are grossly misnamed.
16 */
17
18 #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
19
20
21 #define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
22 #define USER_DS MAKE_MM_SEG(PAGE_OFFSET)
23
24 #define get_ds() (KERNEL_DS)
25 #define get_fs() (current->addr_limit)
26 #define set_fs(x) (current->addr_limit = (x))
27
28 /* XXX These ought to examine the maps to see if the access is allowed */
29
30 #define access_ok(type, addr, size) (1)
31 #define verify_area(type, addr, size) (0)
32
33 #define segment_eq(a, b) (1)
34
35 /*
36 #define __generic_copy_to_user(dst, src, count) (memcpy(dst, src, count), 0)
37
38 #define __generic_copy_from_user(dst, src, count) (memcpy(dst, src, count), 0)
39 */
40
41 #define copy_from_user(to, from, n) (memcpy(to, from, n), 0)
42 #define __copy_from_user(to, from, n) (memcpy(to, from, n), 0)
43
44 #define copy_to_user(to, from, n) (memcpy(to, from, n), 0)
45 #define __copy_to_user(to, from, n) (memcpy(to, from, n), 0)
46
47 #define get_user(x, ptr) \
48 ({ __typeof(*(ptr)) val; \
49 memcpy(&val, (ptr), sizeof(*ptr)); \
50 (x) = (__typeof__(*(ptr))) val; \
51 0; \
52 })
53
54 #define __get_user(x, ptr) get_user(x, ptr)
55
56 #define put_user(x, ptr) \
57 ({ __typeof(*(ptr)) val; \
58 val = (__typeof(*(ptr))) (x); \
59 memcpy((ptr), &val, sizeof(*ptr)); \
60 0; \
61 })
62
63 #define __put_user(x, ptr) put_user(x, ptr)
64
65 #define strncpy_from_user(dst, src, count) \
66 (strncpy(dst, src, count), strlen(dst))
67
68 static inline long clear_user(void *mem, unsigned long len)
69 {
70 memset(mem, 0, len);
71 return(len);
72 }
73
74 #define strlen_user(str) (strlen(str) + 1)
75 #define strnlen_user(str, n) (strlen(str) + 1)
76 #endif
77
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.