uaccess_64.h 2.3 KB
Newer Older
1 2
#ifndef __ASM_SH_UACCESS_64_H
#define __ASM_SH_UACCESS_64_H
L
Linus Torvalds 已提交
3 4

/*
5
 * include/asm-sh/uaccess_64.h
L
Linus Torvalds 已提交
6 7 8 9 10 11 12 13 14 15 16 17 18
 *
 * Copyright (C) 2000, 2001  Paolo Alberelli
 * Copyright (C) 2003, 2004  Paul Mundt
 *
 * User space memory access functions
 *
 * Copyright (C) 1999  Niibe Yutaka
 *
 *  Based on:
 *     MIPS implementation version 1.15 by
 *              Copyright (C) 1996, 1997, 1998 by Ralf Baechle
 *     and i386 version.
 *
19 20 21
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
L
Linus Torvalds 已提交
22 23 24 25 26 27 28
 */

#define __get_user_size(x,ptr,size,retval)			\
do {								\
	retval = 0;						\
	switch (size) {						\
	case 1:							\
29 30
		retval = __get_user_asm_b((void *)&x,		\
					  (long)ptr);		\
L
Linus Torvalds 已提交
31 32
		break;						\
	case 2:							\
33 34
		retval = __get_user_asm_w((void *)&x,		\
					  (long)ptr);		\
L
Linus Torvalds 已提交
35 36
		break;						\
	case 4:							\
37 38
		retval = __get_user_asm_l((void *)&x,		\
					  (long)ptr);		\
L
Linus Torvalds 已提交
39 40
		break;						\
	case 8:							\
41 42
		retval = __get_user_asm_q((void *)&x,		\
					  (long)ptr);		\
L
Linus Torvalds 已提交
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
		break;						\
	default:						\
		__get_user_unknown();				\
		break;						\
	}							\
} while (0)

extern long __get_user_asm_b(void *, long);
extern long __get_user_asm_w(void *, long);
extern long __get_user_asm_l(void *, long);
extern long __get_user_asm_q(void *, long);
extern void __get_user_unknown(void);

#define __put_user_size(x,ptr,size,retval)			\
do {								\
	retval = 0;						\
	switch (size) {						\
	case 1:							\
61 62
		retval = __put_user_asm_b((void *)&x,		\
					  (long)ptr);		\
L
Linus Torvalds 已提交
63 64
		break;						\
	case 2:							\
65 66
		retval = __put_user_asm_w((void *)&x,		\
					  (long)ptr);		\
L
Linus Torvalds 已提交
67 68
		break;						\
	case 4:							\
69 70
		retval = __put_user_asm_l((void *)&x,		\
					  (long)ptr);		\
L
Linus Torvalds 已提交
71 72
		break;						\
	case 8:							\
73 74
		retval = __put_user_asm_q((void *)&x,		\
					  (long)ptr);		\
L
Linus Torvalds 已提交
75 76 77 78 79 80 81 82 83 84 85 86
		break;						\
	default:						\
		__put_user_unknown();				\
	}							\
} while (0)

extern long __put_user_asm_b(void *, long);
extern long __put_user_asm_w(void *, long);
extern long __put_user_asm_l(void *, long);
extern long __put_user_asm_q(void *, long);
extern void __put_user_unknown(void);

87
extern long __strnlen_user(const char *__s, long __n);
88 89
extern int __strncpy_from_user(unsigned long __dest,
	       unsigned long __user __src, int __count);
90

91
#endif /* __ASM_SH_UACCESS_64_H */