blob: 2e07e0f40c6af3038ca6b69fecfefefe528dc2b8 [file] [log] [blame]
Paul Mundta23ba432007-11-28 20:19:38 +09001#ifndef __ASM_SH_UACCESS_64_H
2#define __ASM_SH_UACCESS_64_H
Linus Torvalds1da177e2005-04-16 15:20:36 -07003
4/*
Paul Mundta23ba432007-11-28 20:19:38 +09005 * include/asm-sh/uaccess_64.h
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
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 Mundta23ba432007-11-28 20:19:38 +090019 * 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 Torvalds1da177e2005-04-16 15:20:36 -070022 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070023
24#define __get_user_size(x,ptr,size,retval) \
25do { \
26 retval = 0; \
27 switch (size) { \
28 case 1: \
Paul Mundt88856d62008-09-29 19:43:44 +090029 retval = __get_user_asm_b((void *)&x, \
30 (long)ptr); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070031 break; \
32 case 2: \
Paul Mundt88856d62008-09-29 19:43:44 +090033 retval = __get_user_asm_w((void *)&x, \
34 (long)ptr); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070035 break; \
36 case 4: \
Paul Mundt88856d62008-09-29 19:43:44 +090037 retval = __get_user_asm_l((void *)&x, \
38 (long)ptr); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070039 break; \
40 case 8: \
Paul Mundt88856d62008-09-29 19:43:44 +090041 retval = __get_user_asm_q((void *)&x, \
42 (long)ptr); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070043 break; \
44 default: \
45 __get_user_unknown(); \
46 break; \
47 } \
48} while (0)
49
Linus Torvalds1da177e2005-04-16 15:20:36 -070050extern 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: \
Paul Mundt88856d62008-09-29 19:43:44 +090061 retval = __put_user_asm_b((void *)&x, \
62 (long)ptr); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070063 break; \
64 case 2: \
Paul Mundt88856d62008-09-29 19:43:44 +090065 retval = __put_user_asm_w((void *)&x, \
66 (long)ptr); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070067 break; \
68 case 4: \
Paul Mundt88856d62008-09-29 19:43:44 +090069 retval = __put_user_asm_l((void *)&x, \
70 (long)ptr); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070071 break; \
72 case 8: \
Paul Mundt88856d62008-09-29 19:43:44 +090073 retval = __put_user_asm_q((void *)&x, \
74 (long)ptr); \
Linus Torvalds1da177e2005-04-16 15:20:36 -070075 break; \
76 default: \
77 __put_user_unknown(); \
78 } \
79} while (0)
80
Linus Torvalds1da177e2005-04-16 15:20:36 -070081extern 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
Paul Mundta23ba432007-11-28 20:19:38 +090087#endif /* __ASM_SH_UACCESS_64_H */