Paul Mundt | a23ba43 | 2007-11-28 20:19:38 +0900 | [diff] [blame] | 1 | #ifndef __ASM_SH_UACCESS_64_H |
| 2 | #define __ASM_SH_UACCESS_64_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3 | |
| 4 | /* |
Paul Mundt | a23ba43 | 2007-11-28 20:19:38 +0900 | [diff] [blame] | 5 | * include/asm-sh/uaccess_64.h |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * |
| 7 | * Copyright (C) 2000, 2001 Paolo Alberelli |
| 8 | * Copyright (C) 2003, 2004 Paul Mundt |
| 9 | * |
| 10 | * User space memory access functions |
| 11 | * |
| 12 | * Copyright (C) 1999 Niibe Yutaka |
| 13 | * |
| 14 | * Based on: |
| 15 | * MIPS implementation version 1.15 by |
| 16 | * Copyright (C) 1996, 1997, 1998 by Ralf Baechle |
| 17 | * and i386 version. |
| 18 | * |
Paul Mundt | a23ba43 | 2007-11-28 20:19:38 +0900 | [diff] [blame] | 19 | * This file is subject to the terms and conditions of the GNU General Public |
| 20 | * License. See the file "COPYING" in the main directory of this archive |
| 21 | * for more details. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | |
| 24 | #define __get_user_size(x,ptr,size,retval) \ |
| 25 | do { \ |
| 26 | retval = 0; \ |
| 27 | switch (size) { \ |
| 28 | case 1: \ |
Paul Mundt | 88856d6 | 2008-09-29 19:43:44 +0900 | [diff] [blame] | 29 | retval = __get_user_asm_b((void *)&x, \ |
| 30 | (long)ptr); \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | break; \ |
| 32 | case 2: \ |
Paul Mundt | 88856d6 | 2008-09-29 19:43:44 +0900 | [diff] [blame] | 33 | retval = __get_user_asm_w((void *)&x, \ |
| 34 | (long)ptr); \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | break; \ |
| 36 | case 4: \ |
Paul Mundt | 88856d6 | 2008-09-29 19:43:44 +0900 | [diff] [blame] | 37 | retval = __get_user_asm_l((void *)&x, \ |
| 38 | (long)ptr); \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | break; \ |
| 40 | case 8: \ |
Paul Mundt | 88856d6 | 2008-09-29 19:43:44 +0900 | [diff] [blame] | 41 | retval = __get_user_asm_q((void *)&x, \ |
| 42 | (long)ptr); \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | break; \ |
| 44 | default: \ |
| 45 | __get_user_unknown(); \ |
| 46 | break; \ |
| 47 | } \ |
| 48 | } while (0) |
| 49 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | extern long __get_user_asm_b(void *, long); |
| 51 | extern long __get_user_asm_w(void *, long); |
| 52 | extern long __get_user_asm_l(void *, long); |
| 53 | extern long __get_user_asm_q(void *, long); |
| 54 | extern void __get_user_unknown(void); |
| 55 | |
| 56 | #define __put_user_size(x,ptr,size,retval) \ |
| 57 | do { \ |
| 58 | retval = 0; \ |
| 59 | switch (size) { \ |
| 60 | case 1: \ |
Paul Mundt | 88856d6 | 2008-09-29 19:43:44 +0900 | [diff] [blame] | 61 | retval = __put_user_asm_b((void *)&x, \ |
| 62 | (long)ptr); \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | break; \ |
| 64 | case 2: \ |
Paul Mundt | 88856d6 | 2008-09-29 19:43:44 +0900 | [diff] [blame] | 65 | retval = __put_user_asm_w((void *)&x, \ |
| 66 | (long)ptr); \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | break; \ |
| 68 | case 4: \ |
Paul Mundt | 88856d6 | 2008-09-29 19:43:44 +0900 | [diff] [blame] | 69 | retval = __put_user_asm_l((void *)&x, \ |
| 70 | (long)ptr); \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | break; \ |
| 72 | case 8: \ |
Paul Mundt | 88856d6 | 2008-09-29 19:43:44 +0900 | [diff] [blame] | 73 | retval = __put_user_asm_q((void *)&x, \ |
| 74 | (long)ptr); \ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | break; \ |
| 76 | default: \ |
| 77 | __put_user_unknown(); \ |
| 78 | } \ |
| 79 | } while (0) |
| 80 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | extern long __put_user_asm_b(void *, long); |
| 82 | extern long __put_user_asm_w(void *, long); |
| 83 | extern long __put_user_asm_l(void *, long); |
| 84 | extern long __put_user_asm_q(void *, long); |
| 85 | extern void __put_user_unknown(void); |
| 86 | |
Paul Mundt | a23ba43 | 2007-11-28 20:19:38 +0900 | [diff] [blame] | 87 | #endif /* __ASM_SH_UACCESS_64_H */ |