Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 100069
b: refs/heads/master
c: 865e5b7
h: refs/heads/master
i:
  100067: 0ae1135
v: v3
  • Loading branch information
Glauber Costa authored and Ingo Molnar committed Jul 9, 2008
1 parent 4806405 commit 2691cd1
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 73 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ca23386216b9d4fc3bb211101205077d2b2916ae
refs/heads/master: 865e5b76505cdade261773bde32f785b3ce579f1
55 changes: 55 additions & 0 deletions trunk/include/asm-x86/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,61 @@ extern int __get_user_bad(void);
: "=a" (ret),"=d" (x) \
: "0" (ptr)) \

/* Careful: we have to cast the result to the type of the pointer
* for sign reasons */

/**
* get_user: - Get a simple variable from user space.
* @x: Variable to store result.
* @ptr: Source address, in user space.
*
* Context: User context only. This function may sleep.
*
* This macro copies a single simple variable from user space to kernel
* space. It supports simple types like char and int, but not larger
* data types like structures or arrays.
*
* @ptr must have pointer-to-simple-variable type, and the result of
* dereferencing @ptr must be assignable to @x without a cast.
*
* Returns zero on success, or -EFAULT on error.
* On error, the variable @x is set to zero.
*/
#ifdef CONFIG_X86_32
#define __get_user_8(__ret_gu, __val_gu, ptr) \
__get_user_x(X, __ret_gu, __val_gu, ptr)
#else
#define __get_user_8(__ret_gu, __val_gu, ptr) \
__get_user_x(8, __ret_gu, __val_gu, ptr)
#endif

#define get_user(x, ptr) \
({ \
int __ret_gu; \
unsigned long __val_gu; \
__chk_user_ptr(ptr); \
switch (sizeof(*(ptr))) { \
case 1: \
__get_user_x(1, __ret_gu, __val_gu, ptr); \
break; \
case 2: \
__get_user_x(2, __ret_gu, __val_gu, ptr); \
break; \
case 4: \
__get_user_x(4, __ret_gu, __val_gu, ptr); \
break; \
case 8: \
__get_user_8(__ret_gu, __val_gu, ptr); \
break; \
default: \
__get_user_x(X, __ret_gu, __val_gu, ptr); \
break; \
} \
(x) = (__typeof__(*(ptr)))__val_gu; \
__ret_gu; \
})


#ifdef CONFIG_X86_32
# include "uaccess_32.h"
#else
Expand Down
43 changes: 0 additions & 43 deletions trunk/include/asm-x86/uaccess_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,49 +24,6 @@ extern struct movsl_mask {
((unsigned long __force)(addr) < \
(current_thread_info()->addr_limit.seg))

/* Careful: we have to cast the result to the type of the pointer
* for sign reasons */

/**
* get_user: - Get a simple variable from user space.
* @x: Variable to store result.
* @ptr: Source address, in user space.
*
* Context: User context only. This function may sleep.
*
* This macro copies a single simple variable from user space to kernel
* space. It supports simple types like char and int, but not larger
* data types like structures or arrays.
*
* @ptr must have pointer-to-simple-variable type, and the result of
* dereferencing @ptr must be assignable to @x without a cast.
*
* Returns zero on success, or -EFAULT on error.
* On error, the variable @x is set to zero.
*/
#define get_user(x, ptr) \
({ \
int __ret_gu; \
unsigned long __val_gu; \
__chk_user_ptr(ptr); \
switch (sizeof(*(ptr))) { \
case 1: \
__get_user_x(1, __ret_gu, __val_gu, ptr); \
break; \
case 2: \
__get_user_x(2, __ret_gu, __val_gu, ptr); \
break; \
case 4: \
__get_user_x(4, __ret_gu, __val_gu, ptr); \
break; \
default: \
__get_user_x(X, __ret_gu, __val_gu, ptr); \
break; \
} \
(x) = (__typeof__(*(ptr)))__val_gu; \
__ret_gu; \
})

extern void __put_user_bad(void);

/*
Expand Down
29 changes: 0 additions & 29 deletions trunk/include/asm-x86/uaccess_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,6 @@

#define ARCH_HAS_SEARCH_EXTABLE

/* Careful: we have to cast the result to the type of the pointer
* for sign reasons */

#define get_user(x, ptr) \
({ \
unsigned long __val_gu; \
int __ret_gu; \
__chk_user_ptr(ptr); \
switch (sizeof(*(ptr))) { \
case 1: \
__get_user_x(1, __ret_gu, __val_gu, ptr); \
break; \
case 2: \
__get_user_x(2, __ret_gu, __val_gu, ptr); \
break; \
case 4: \
__get_user_x(4, __ret_gu, __val_gu, ptr); \
break; \
case 8: \
__get_user_x(8, __ret_gu, __val_gu, ptr); \
break; \
default: \
__get_user_bad(); \
break; \
} \
(x) = (__force typeof(*(ptr)))__val_gu; \
__ret_gu; \
})

extern void __put_user_1(void);
extern void __put_user_2(void);
extern void __put_user_4(void);
Expand Down

0 comments on commit 2691cd1

Please sign in to comment.