⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uaccess.h

📁 嵌入式系统设计与实例开发实验教材二源码 多线程应用程序设计 串行端口程序设计 AD接口实验 CAN总线通信实验 GPS通信实验 Linux内核移植与编译实验 IC卡读写实验 SD驱动使
💻 H
📖 第 1 页 / 共 3 页
字号:
		"	move.d $r9,[%0+]\n8:\n" COPY,	\		"9:	addq 4,%2\n" FIXUP,		\		"	.dword 8b,9b\n" TENTRY)#define __asm_copy_to_user_16(to, from, ret) \	__asm_copy_to_user_16x_cont(to, from, ret, "", "", "")#define __asm_copy_to_user_20x_cont(to, from, ret, COPY, FIXUP, TENTRY) \	__asm_copy_to_user_16x_cont(to, from, ret,	\		"	move.d [%1+],$r9\n"		\		"	move.d $r9,[%0+]\n10:\n" COPY,	\		"11:	addq 4,%2\n" FIXUP,		\		"	.dword 10b,11b\n" TENTRY)#define __asm_copy_to_user_20(to, from, ret) \	__asm_copy_to_user_20x_cont(to, from, ret, "", "", "")#define __asm_copy_to_user_24x_cont(to, from, ret, COPY, FIXUP, TENTRY)	\	__asm_copy_to_user_20x_cont(to, from, ret,	\		"	move.d [%1+],$r9\n"		\		"	move.d $r9,[%0+]\n12:\n" COPY,	\		"13:	addq 4,%2\n" FIXUP,		\		"	.dword 12b,13b\n" TENTRY)#define __asm_copy_to_user_24(to, from, ret)	\	__asm_copy_to_user_24x_cont(to, from, ret, "", "", "")/* Define a few clearing asms with exception handlers.  *//* This frame-asm is like the __asm_copy_user_cont one, but has one less   input.  */#define __asm_clear(to, ret, CLEAR, FIXUP, TENTRY) \	__asm__ __volatile__ (				\			CLEAR				\		"1:\n"					\		"	.section .fixup,\"ax\"\n"	\			FIXUP				\		"	jump 1b\n"			\		"	.previous\n"			\		"	.section __ex_table,\"a\"\n"	\			TENTRY				\		"	.previous"			\		: "=r" (to), "=r" (ret)			\		: "0" (to), "1" (ret)			\		: "r9", "memory")#define __asm_clear_1(to, ret) \	__asm_clear(to, ret,			\		"	clear.b [%0+]\n2:\n",	\		"3:	addq 1,%1\n",		\		"	.dword 2b,3b\n")#define __asm_clear_2(to, ret) \	__asm_clear(to, ret,			\		"	clear.w [%0+]\n2:\n",	\		"3:	addq 2,%1\n",		\		"	.dword 2b,3b\n")#define __asm_clear_3(to, ret) \     __asm_clear(to, ret,			\		 "	clear.w [%0+]\n"	\		 "2:	clear.b [%0+]\n3:\n",	\		 "4:	addq 2,%1\n"		\		 "5:	addq 1,%1\n",		\		 "	.dword 2b,4b\n"		\		 "	.dword 3b,5b\n")#define __asm_clear_4x_cont(to, ret, CLEAR, FIXUP, TENTRY) \	__asm_clear(to, ret,				\		"	clear.d [%0+]\n2:\n" CLEAR,	\		"3:	addq 4,%1\n" FIXUP,		\		"	.dword 2b,3b\n" TENTRY)#define __asm_clear_4(to, ret) \	__asm_clear_4x_cont(to, ret, "", "", "")#define __asm_clear_8x_cont(to, ret, CLEAR, FIXUP, TENTRY) \	__asm_clear_4x_cont(to, ret,			\		"	clear.d [%0+]\n4:\n" CLEAR,	\		"5:	addq 4,%1\n" FIXUP,		\		"	.dword 4b,5b\n" TENTRY)#define __asm_clear_8(to, ret) \	__asm_clear_8x_cont(to, ret, "", "", "")#define __asm_clear_12x_cont(to, ret, CLEAR, FIXUP, TENTRY) \	__asm_clear_8x_cont(to, ret,			\		"	clear.d [%0+]\n6:\n" CLEAR,	\		"7:	addq 4,%1\n" FIXUP,		\		"	.dword 6b,7b\n" TENTRY)#define __asm_clear_12(to, ret) \	__asm_clear_12x_cont(to, ret, "", "", "")#define __asm_clear_16x_cont(to, ret, CLEAR, FIXUP, TENTRY) \	__asm_clear_12x_cont(to, ret,			\		"	clear.d [%0+]\n8:\n" CLEAR,	\		"9:	addq 4,%1\n" FIXUP,		\		"	.dword 8b,9b\n" TENTRY)#define __asm_clear_16(to, ret) \	__asm_clear_16x_cont(to, ret, "", "", "")#define __asm_clear_20x_cont(to, ret, CLEAR, FIXUP, TENTRY) \	__asm_clear_16x_cont(to, ret,			\		"	clear.d [%0+]\n10:\n" CLEAR,	\		"11:	addq 4,%1\n" FIXUP,		\		"	.dword 10b,11b\n" TENTRY)#define __asm_clear_20(to, ret) \	__asm_clear_20x_cont(to, ret, "", "", "")#define __asm_clear_24x_cont(to, ret, CLEAR, FIXUP, TENTRY) \	__asm_clear_20x_cont(to, ret,			\		"	clear.d [%0+]\n12:\n" CLEAR,	\		"13:	addq 4,%1\n" FIXUP,		\		"	.dword 12b,13b\n" TENTRY)#define __asm_clear_24(to, ret) \	__asm_clear_24x_cont(to, ret, "", "", "")/* Note that if these expand awfully if made into switch constructs, so   don't do that.  */static inline unsigned long__constant_copy_from_user(void *to, const void *from, unsigned long n){	unsigned long ret = 0;	if (n == 0)		;	else if (n == 1)		__asm_copy_from_user_1(to, from, ret);	else if (n == 2)		__asm_copy_from_user_2(to, from, ret);	else if (n == 3)		__asm_copy_from_user_3(to, from, ret);	else if (n == 4)		__asm_copy_from_user_4(to, from, ret);	else if (n == 5)		__asm_copy_from_user_5(to, from, ret);	else if (n == 6)		__asm_copy_from_user_6(to, from, ret);	else if (n == 7)		__asm_copy_from_user_7(to, from, ret);	else if (n == 8)		__asm_copy_from_user_8(to, from, ret);	else if (n == 9)		__asm_copy_from_user_9(to, from, ret);	else if (n == 10)		__asm_copy_from_user_10(to, from, ret);	else if (n == 11)		__asm_copy_from_user_11(to, from, ret);	else if (n == 12)		__asm_copy_from_user_12(to, from, ret);	else if (n == 13)		__asm_copy_from_user_13(to, from, ret);	else if (n == 14)		__asm_copy_from_user_14(to, from, ret);	else if (n == 15)		__asm_copy_from_user_15(to, from, ret);	else if (n == 16)		__asm_copy_from_user_16(to, from, ret);	else if (n == 20)		__asm_copy_from_user_20(to, from, ret);	else if (n == 24)		__asm_copy_from_user_24(to, from, ret);	else		ret = __generic_copy_from_user(to, from, n);	return ret;}/* Ditto, don't make a switch out of this.  */static inline unsigned long__constant_copy_to_user(void *to, const void *from, unsigned long n){	unsigned long ret = 0;	if (n == 0)		;	else if (n == 1)		__asm_copy_to_user_1(to, from, ret);	else if (n == 2)		__asm_copy_to_user_2(to, from, ret);	else if (n == 3)		__asm_copy_to_user_3(to, from, ret);	else if (n == 4)		__asm_copy_to_user_4(to, from, ret);	else if (n == 5)		__asm_copy_to_user_5(to, from, ret);	else if (n == 6)		__asm_copy_to_user_6(to, from, ret);	else if (n == 7)		__asm_copy_to_user_7(to, from, ret);	else if (n == 8)		__asm_copy_to_user_8(to, from, ret);	else if (n == 9)		__asm_copy_to_user_9(to, from, ret);	else if (n == 10)		__asm_copy_to_user_10(to, from, ret);	else if (n == 11)		__asm_copy_to_user_11(to, from, ret);	else if (n == 12)		__asm_copy_to_user_12(to, from, ret);	else if (n == 13)		__asm_copy_to_user_13(to, from, ret);	else if (n == 14)		__asm_copy_to_user_14(to, from, ret);	else if (n == 15)		__asm_copy_to_user_15(to, from, ret);	else if (n == 16)		__asm_copy_to_user_16(to, from, ret);	else if (n == 20)		__asm_copy_to_user_20(to, from, ret);	else if (n == 24)		__asm_copy_to_user_24(to, from, ret);	else		ret = __generic_copy_to_user(to, from, n);	return ret;}/* No switch, please.  */static inline unsigned long__constant_clear_user(void *to, unsigned long n){	unsigned long ret = 0;	if (n == 0)		;	else if (n == 1)		__asm_clear_1(to, ret);	else if (n == 2)		__asm_clear_2(to, ret);	else if (n == 3)		__asm_clear_3(to, ret);	else if (n == 4)		__asm_clear_4(to, ret);	else if (n == 8)		__asm_clear_8(to, ret);	else if (n == 12)		__asm_clear_12(to, ret);	else if (n == 16)		__asm_clear_16(to, ret);	else if (n == 20)		__asm_clear_20(to, ret);	else if (n == 24)		__asm_clear_24(to, ret);	else		ret = __generic_clear_user(to, n);	return ret;}#define clear_user(to, n)			\(__builtin_constant_p(n) ?			\ __constant_clear_user(to, n) :			\ __generic_clear_user(to, n))#define copy_from_user(to, from, n)		\(__builtin_constant_p(n) ?			\ __constant_copy_from_user(to, from, n) :	\ __generic_copy_from_user(to, from, n))#define copy_to_user(to, from, n)		\(__builtin_constant_p(n) ?			\ __constant_copy_to_user(to, from, n) :		\ __generic_copy_to_user(to, from, n))#define copy_to_user_ret(to,from,n,retval) \	do { if (copy_to_user(to,from,n)) return retval; } while (0)#define copy_from_user_ret(to,from,n,retval) \	do { if (copy_from_user(to,from,n)) return retval; } while (0)/* We let the __ versions of copy_from/to_user inline, because they're often * used in fast paths and have only a small space overhead. */static inline unsigned long__generic_copy_from_user_nocheck(void *to, const void *from, unsigned long n){	return __copy_user_zeroing(to,from,n);}static inline unsigned long__generic_copy_to_user_nocheck(void *to, const void *from, unsigned long n){	return __copy_user(to,from,n);}static inline unsigned long__generic_clear_user_nocheck(void *to, unsigned long n){	return __do_clear_user(to,n);}/* without checking */#define __copy_to_user(to,from,n)   __generic_copy_to_user_nocheck((to),(from),(n))#define __copy_from_user(to,from,n) __generic_copy_from_user_nocheck((to),(from),(n))#define __clear_user(to,n) __generic_clear_user_nocheck((to),(n))/* * Return the size of a string (including the ending 0) * * Return length of string in userspace including terminating 0 * or 0 for error.  Return a value greater than N if too long. */static inline longstrnlen_user(const char *s, long n){	long res, tmp1;	if (!access_ok(VERIFY_READ, s, 0))		return 0;	/*	 * This code is deduced from:	 *	 *	tmp1 = n;	 *	while (tmp1-- > 0 && *s++)	 *	  ;	 *	 *	res = n - tmp1;	 *	 *  (with tweaks).	 */	__asm__ __volatile__ (		"	move.d %1,$r9\n"		"0:\n"		"	ble 1f\n"		"	subq 1,$r9\n"		"	test.b [%0+]\n"		"	bne 0b\n"		"	test.d $r9\n"		"1:\n"		"	move.d %1,%0\n"		"	sub.d $r9,%0\n"		"2:\n"		"	.section .fixup,\"ax\"\n"		"3:	clear.d %0\n"		"	jump 2b\n"		/* There's one address for a fault at the first move, and		   two possible PC values for a fault at the second move,		   being a delay-slot filler.  However, the branch-target		   for the second move is the same as the first address.		   Just so you don't get confused...  */		"	.previous\n"		"	.section __ex_table,\"a\"\n"		"	.dword 0b,3b\n"		"	.dword 1b,3b\n"		"	.previous\n"		: "=r" (res), "=r" (tmp1)		: "0" (s), "1" (n)		: "r9");	return res;}#define strlen_user(str)	strnlen_user((str), 0x7ffffffe)#endif  /* __ASSEMBLY__ */#endif	/* _CRIS_UACCESS_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -