• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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)			\
25 do {								\
26 	retval = 0;						\
27 	x = 0;							\
28 	switch (size) {						\
29 	case 1:							\
30 		retval = __get_user_asm_b((void *)&x,		\
31 					  (long)ptr);		\
32 		break;						\
33 	case 2:							\
34 		retval = __get_user_asm_w((void *)&x,		\
35 					  (long)ptr);		\
36 		break;						\
37 	case 4:							\
38 		retval = __get_user_asm_l((void *)&x,		\
39 					  (long)ptr);		\
40 		break;						\
41 	case 8:							\
42 		retval = __get_user_asm_q((void *)&x,		\
43 					  (long)ptr);		\
44 		break;						\
45 	default:						\
46 		__get_user_unknown();				\
47 		break;						\
48 	}							\
49 } while (0)
50 
51 extern long __get_user_asm_b(void *, long);
52 extern long __get_user_asm_w(void *, long);
53 extern long __get_user_asm_l(void *, long);
54 extern long __get_user_asm_q(void *, long);
55 extern void __get_user_unknown(void);
56 
57 #define __put_user_size(x,ptr,size,retval)			\
58 do {								\
59 	retval = 0;						\
60 	switch (size) {						\
61 	case 1:							\
62 		retval = __put_user_asm_b((void *)&x,		\
63 					  (long)ptr);		\
64 		break;						\
65 	case 2:							\
66 		retval = __put_user_asm_w((void *)&x,		\
67 					  (long)ptr);		\
68 		break;						\
69 	case 4:							\
70 		retval = __put_user_asm_l((void *)&x,		\
71 					  (long)ptr);		\
72 		break;						\
73 	case 8:							\
74 		retval = __put_user_asm_q((void *)&x,		\
75 					  (long)ptr);		\
76 		break;						\
77 	default:						\
78 		__put_user_unknown();				\
79 	}							\
80 } while (0)
81 
82 extern long __put_user_asm_b(void *, long);
83 extern long __put_user_asm_w(void *, long);
84 extern long __put_user_asm_l(void *, long);
85 extern long __put_user_asm_q(void *, long);
86 extern void __put_user_unknown(void);
87 
88 #endif /* __ASM_SH_UACCESS_64_H */
89