1#ifndef __ASM_SH_UACCESS_64_H 2#define __ASM_SH_UACCESS_64_H 3 4/* 5 * include/asm-sh/uaccess_64.h 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 * 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. 22 */ 23 24#define __get_user_size(x,ptr,size,retval) \ 25do { \ 26 retval = 0; \ 27 switch (size) { \ 28 case 1: \ 29 retval = __get_user_asm_b((void *)&x, \ 30 (long)ptr); \ 31 break; \ 32 case 2: \ 33 retval = __get_user_asm_w((void *)&x, \ 34 (long)ptr); \ 35 break; \ 36 case 4: \ 37 retval = __get_user_asm_l((void *)&x, \ 38 (long)ptr); \ 39 break; \ 40 case 8: \ 41 retval = __get_user_asm_q((void *)&x, \ 42 (long)ptr); \ 43 break; \ 44 default: \ 45 __get_user_unknown(); \ 46 break; \ 47 } \ 48} while (0) 49 50extern long __get_user_asm_b(void *, long); 51extern long __get_user_asm_w(void *, long); 52extern long __get_user_asm_l(void *, long); 53extern long __get_user_asm_q(void *, long); 54extern void __get_user_unknown(void); 55 56#define __put_user_size(x,ptr,size,retval) \ 57do { \ 58 retval = 0; \ 59 switch (size) { \ 60 case 1: \ 61 retval = __put_user_asm_b((void *)&x, \ 62 (long)ptr); \ 63 break; \ 64 case 2: \ 65 retval = __put_user_asm_w((void *)&x, \ 66 (long)ptr); \ 67 break; \ 68 case 4: \ 69 retval = __put_user_asm_l((void *)&x, \ 70 (long)ptr); \ 71 break; \ 72 case 8: \ 73 retval = __put_user_asm_q((void *)&x, \ 74 (long)ptr); \ 75 break; \ 76 default: \ 77 __put_user_unknown(); \ 78 } \ 79} while (0) 80 81extern long __put_user_asm_b(void *, long); 82extern long __put_user_asm_w(void *, long); 83extern long __put_user_asm_l(void *, long); 84extern long __put_user_asm_q(void *, long); 85extern void __put_user_unknown(void); 86 87extern long __strnlen_user(const char *__s, long __n); 88extern int __strncpy_from_user(unsigned long __dest, 89 unsigned long __user __src, int __count); 90 91#endif /* __ASM_SH_UACCESS_64_H */ 92