[PATCH] Disable a.out for AMD64
[linux-2.6/history.git] / include / asm-um / uaccess.h
blobe1dfea1088579e7197882d4376f9152bb37d32bd
1 /*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
6 #ifndef __UM_UACCESS_H
7 #define __UM_UACCESS_H
9 #define VERIFY_READ 0
10 #define VERIFY_WRITE 1
13 * The fs value determines whether argument validity checking should be
14 * performed or not. If get_fs() == USER_DS, checking is performed, with
15 * get_fs() == KERNEL_DS, checking is bypassed.
17 * For historical reasons, these macros are grossly misnamed.
20 #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
22 #define KERNEL_DS MAKE_MM_SEG(0xFFFFFFFF)
23 #define USER_DS MAKE_MM_SEG(TASK_SIZE)
25 #define get_ds() (KERNEL_DS)
26 #define get_fs() (current_thread_info()->addr_limit)
27 #define set_fs(x) (current_thread_info()->addr_limit = (x))
29 #define segment_eq(a, b) ((a).seg == (b).seg)
31 #include "um_uaccess.h"
33 #define __copy_from_user(to, from, n) copy_from_user(to, from, n)
35 #define __copy_to_user(to, from, n) copy_to_user(to, from, n)
37 #define __get_user(x, ptr) \
38 ({ \
39 const __typeof__(ptr) __private_ptr = ptr; \
40 __typeof__(*(__private_ptr)) __private_val; \
41 int __private_ret = -EFAULT; \
42 (x) = 0; \
43 if (__copy_from_user(&__private_val, (__private_ptr), \
44 sizeof(*(__private_ptr))) == 0) {\
45 (x) = (__typeof__(*(__private_ptr))) __private_val; \
46 __private_ret = 0; \
47 } \
48 __private_ret; \
49 })
51 #define get_user(x, ptr) \
52 ({ \
53 const __typeof__((*ptr)) *private_ptr = (ptr); \
54 (access_ok(VERIFY_READ, private_ptr, sizeof(*private_ptr)) ? \
55 __get_user(x, private_ptr) : ((x) = 0, -EFAULT)); \
58 #define __put_user(x, ptr) \
59 ({ \
60 __typeof__(ptr) __private_ptr = ptr; \
61 __typeof__(*(__private_ptr)) __private_val; \
62 int __private_ret = -EFAULT; \
63 __private_val = (__typeof__(*(__private_ptr))) (x); \
64 if (__copy_to_user((__private_ptr), &__private_val, \
65 sizeof(*(__private_ptr))) == 0) { \
66 __private_ret = 0; \
67 } \
68 __private_ret; \
71 #define put_user(x, ptr) \
72 ({ \
73 __typeof__(*(ptr)) *private_ptr = (ptr); \
74 (access_ok(VERIFY_WRITE, private_ptr, sizeof(*private_ptr)) ? \
75 __put_user(x, private_ptr) : -EFAULT); \
78 #define strlen_user(str) strnlen_user(str, ~0UL >> 1)
80 struct exception_table_entry
82 unsigned long insn;
83 unsigned long fixup;
86 #endif
89 * Overrides for Emacs so that we follow Linus's tabbing style.
90 * Emacs will notice this stuff at the end of the file and automatically
91 * adjust the settings for this buffer only. This must remain at the end
92 * of the file.
93 * ---------------------------------------------------------------------------
94 * Local variables:
95 * c-file-style: "linux"
96 * End: