1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef __ASM_SH_UACCESS_64_H 3 #define __ASM_SH_UACCESS_64_H 4 5 /* 6 * include/asm-sh/uaccess_64.h 7 * 8 * Copyright (C) 2000, 2001 Paolo Alberelli 9 * Copyright (C) 2003, 2004 Paul Mundt 10 * 11 * User space memory access functions 12 * 13 * Copyright (C) 1999 Niibe Yutaka 14 * 15 * Based on: 16 * MIPS implementation version 1.15 by 17 * Copyright (C) 1996, 1997, 1998 by Ralf Baechle 18 * and i386 version. 19 */ 20 21 #define __get_user_size(x,ptr,size,retval) \ 22 do { \ 23 retval = 0; \ 24 x = 0; \ 25 switch (size) { \ 26 case 1: \ 27 retval = __get_user_asm_b((void *)&x, \ 28 (long)ptr); \ 29 break; \ 30 case 2: \ 31 retval = __get_user_asm_w((void *)&x, \ 32 (long)ptr); \ 33 break; \ 34 case 4: \ 35 retval = __get_user_asm_l((void *)&x, \ 36 (long)ptr); \ 37 break; \ 38 case 8: \ 39 retval = __get_user_asm_q((void *)&x, \ 40 (long)ptr); \ 41 break; \ 42 default: \ 43 __get_user_unknown(); \ 44 break; \ 45 } \ 46 } while (0) 47 48 extern long __get_user_asm_b(void *, long); 49 extern long __get_user_asm_w(void *, long); 50 extern long __get_user_asm_l(void *, long); 51 extern long __get_user_asm_q(void *, long); 52 extern void __get_user_unknown(void); 53 54 #define __put_user_size(x,ptr,size,retval) \ 55 do { \ 56 retval = 0; \ 57 switch (size) { \ 58 case 1: \ 59 retval = __put_user_asm_b((void *)&x, \ 60 (__force long)ptr); \ 61 break; \ 62 case 2: \ 63 retval = __put_user_asm_w((void *)&x, \ 64 (__force long)ptr); \ 65 break; \ 66 case 4: \ 67 retval = __put_user_asm_l((void *)&x, \ 68 (__force long)ptr); \ 69 break; \ 70 case 8: \ 71 retval = __put_user_asm_q((void *)&x, \ 72 (__force long)ptr); \ 73 break; \ 74 default: \ 75 __put_user_unknown(); \ 76 } \ 77 } while (0) 78 79 extern long __put_user_asm_b(void *, long); 80 extern long __put_user_asm_w(void *, long); 81 extern long __put_user_asm_l(void *, long); 82 extern long __put_user_asm_q(void *, long); 83 extern void __put_user_unknown(void); 84 85 #endif /* __ASM_SH_UACCESS_64_H */ 86