uaccess.h (762f99f4f3cb41a775b5157dd761217beba65873) | uaccess.h (12700c17fc286149324f92d6d380bc48e43f253d) |
---|---|
1/* 2 * include/asm-xtensa/uaccess.h 3 * 4 * User space memory access functions 5 * 6 * These routines provide basic accessing functions to the user memory 7 * space for the kernel. This header file provides functions such as: 8 * --- 21 unchanged lines hidden (view full) --- 30 */ 31 32#define KERNEL_DS ((mm_segment_t) { 0 }) 33#define USER_DS ((mm_segment_t) { 1 }) 34 35#define get_fs() (current->thread.current_ds) 36#define set_fs(val) (current->thread.current_ds = (val)) 37 | 1/* 2 * include/asm-xtensa/uaccess.h 3 * 4 * User space memory access functions 5 * 6 * These routines provide basic accessing functions to the user memory 7 * space for the kernel. This header file provides functions such as: 8 * --- 21 unchanged lines hidden (view full) --- 30 */ 31 32#define KERNEL_DS ((mm_segment_t) { 0 }) 33#define USER_DS ((mm_segment_t) { 1 }) 34 35#define get_fs() (current->thread.current_ds) 36#define set_fs(val) (current->thread.current_ds = (val)) 37 |
38#define uaccess_kernel() (get_fs().seg == KERNEL_DS.seg) | 38#include <asm-generic/access_ok.h> |
39 | 39 |
40#define __kernel_ok (uaccess_kernel()) 41#define __user_ok(addr, size) \ 42 (((size) <= TASK_SIZE)&&((addr) <= TASK_SIZE-(size))) 43#define __access_ok(addr, size) (__kernel_ok || __user_ok((addr), (size))) 44#define access_ok(addr, size) __access_ok((unsigned long)(addr), (size)) 45 46#define user_addr_max() (uaccess_kernel() ? ~0UL : TASK_SIZE) 47 | |
48/* 49 * These are the main single-value transfer routines. They 50 * automatically use the right size if we just have the right pointer 51 * type. 52 * 53 * This gets kind of ugly. We want to return _two_ values in 54 * "get_user()" and yet we don't want to do any pointers, because that 55 * is too much of a performance impact. Thus we have a few rather ugly --- 264 unchanged lines hidden --- | 40/* 41 * These are the main single-value transfer routines. They 42 * automatically use the right size if we just have the right pointer 43 * type. 44 * 45 * This gets kind of ugly. We want to return _two_ values in 46 * "get_user()" and yet we don't want to do any pointers, because that 47 * is too much of a performance impact. Thus we have a few rather ugly --- 264 unchanged lines hidden --- |