aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/uaccess_64.h
diff options
context:
space:
mode:
authorGlauber Costa <gcosta@redhat.com>2008-06-13 13:39:25 -0400
committerIngo Molnar <mingo@elte.hu>2008-07-09 03:14:18 -0400
commitca23386216b9d4fc3bb211101205077d2b2916ae (patch)
tree258a4239a07f42da5c6b7d468b75eedcd962cba2 /include/asm-x86/uaccess_64.h
parentbe9d06bfd48934fbd56ccb7476eabccfa31b4afe (diff)
x86: merge common parts of uaccess.
Common parts of uaccess_32.h and uaccess_64.h are put in uaccess.h. Bits in uaccess_32.h and uaccess_64.h that come to this file are equal except for comments and whitespaces differences. Signed-off-by: Glauber Costa <gcosta@redhat.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/asm-x86/uaccess_64.h')
-rw-r--r--include/asm-x86/uaccess_64.h83
1 files changed, 0 insertions, 83 deletions
diff --git a/include/asm-x86/uaccess_64.h b/include/asm-x86/uaccess_64.h
index 3a81775136c8..243dbb467f3a 100644
--- a/include/asm-x86/uaccess_64.h
+++ b/include/asm-x86/uaccess_64.h
@@ -9,88 +9,11 @@
9#include <linux/prefetch.h> 9#include <linux/prefetch.h>
10#include <asm/page.h> 10#include <asm/page.h>
11 11
12#define VERIFY_READ 0
13#define VERIFY_WRITE 1
14
15/*
16 * The fs value determines whether argument validity checking should be
17 * performed or not. If get_fs() == USER_DS, checking is performed, with
18 * get_fs() == KERNEL_DS, checking is bypassed.
19 *
20 * For historical reasons, these macros are grossly misnamed.
21 */
22
23#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
24
25#define KERNEL_DS MAKE_MM_SEG(-1UL)
26#define USER_DS MAKE_MM_SEG(PAGE_OFFSET)
27
28#define get_ds() (KERNEL_DS)
29#define get_fs() (current_thread_info()->addr_limit)
30#define set_fs(x) (current_thread_info()->addr_limit = (x))
31
32#define segment_eq(a, b) ((a).seg == (b).seg)
33
34#define __addr_ok(addr) (!((unsigned long)(addr) & \ 12#define __addr_ok(addr) (!((unsigned long)(addr) & \
35 (current_thread_info()->addr_limit.seg))) 13 (current_thread_info()->addr_limit.seg)))
36 14
37/*
38 * Uhhuh, this needs 65-bit arithmetic. We have a carry..
39 */
40#define __range_not_ok(addr, size) \
41({ \
42 unsigned long flag, roksum; \
43 __chk_user_ptr(addr); \
44 asm("add %3,%1 ; sbb %0,%0 ; cmp %1,%4 ; sbb $0,%0" \
45 : "=&r" (flag), "=r" (roksum) \
46 : "1" (addr), "g" ((long)(size)), \
47 "rm" (current_thread_info()->addr_limit.seg)); \
48 flag; \
49})
50
51#define access_ok(type, addr, size) (likely(__range_not_ok(addr, size) == 0))
52
53/*
54 * The exception table consists of pairs of addresses: the first is the
55 * address of an instruction that is allowed to fault, and the second is
56 * the address at which the program should continue. No registers are
57 * modified, so it is entirely up to the continuation code to figure out
58 * what to do.
59 *
60 * All the routines below use bits of fixup code that are out of line
61 * with the main instruction path. This means when everything is well,
62 * we don't even have to jump over them. Further, they do not intrude
63 * on our cache or tlb entries.
64 */
65
66struct exception_table_entry {
67 unsigned long insn, fixup;
68};
69
70extern int fixup_exception(struct pt_regs *regs);
71
72#define ARCH_HAS_SEARCH_EXTABLE 15#define ARCH_HAS_SEARCH_EXTABLE
73 16
74/*
75 * These are the main single-value transfer routines. They automatically
76 * use the right size if we just have the right pointer type.
77 *
78 * This gets kind of ugly. We want to return _two_ values in "get_user()"
79 * and yet we don't want to do any pointers, because that is too much
80 * of a performance impact. Thus we have a few rather ugly macros here,
81 * and hide all the ugliness from the user.
82 *
83 * The "__xxx" versions of the user access functions are versions that
84 * do not verify the address space, that must have been done previously
85 * with a separate "access_ok()" call (this is used when we do multiple
86 * accesses to the same area of user memory).
87 */
88
89#define __get_user_x(size, ret, x, ptr) \
90 asm volatile("call __get_user_" #size \
91 : "=a" (ret),"=d" (x) \
92 : "0" (ptr)) \
93
94/* Careful: we have to cast the result to the type of the pointer 17/* Careful: we have to cast the result to the type of the pointer
95 * for sign reasons */ 18 * for sign reasons */
96 19
@@ -226,12 +149,6 @@ struct __large_struct { unsigned long buf[100]; };
226 __gu_err; \ 149 __gu_err; \
227}) 150})
228 151
229extern int __get_user_1(void);
230extern int __get_user_2(void);
231extern int __get_user_4(void);
232extern int __get_user_8(void);
233extern int __get_user_bad(void);
234
235#define __get_user_size(x, ptr, size, retval) \ 152#define __get_user_size(x, ptr, size, retval) \
236do { \ 153do { \
237 retval = 0; \ 154 retval = 0; \