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

📄 strncpy_from_user.s

📁 优龙2410linux2.6.8内核源代码
💻 S
字号:
/* $Id: strncpy_from_user.S,v 1.6 1999/05/25 16:53:05 jj Exp $ * strncpy_from_user.S: Sparc64 strncpy from userspace. * *  Copyright (C) 1997, 1999 Jakub Jelinek (jj@ultra.linux.cz) */#include <asm/asi.h>#include <asm/errno.h>	.data	.align	80:	.xword	0x0101010101010101	.text	.align	4	/* Must return:	 *	 * -EFAULT		for an exception	 * count		if we hit the buffer limit	 * bytes copied		if we hit a null byte	 * (without the null byte)	 *	 * This implementation assumes:	 * %o1 is 8 aligned => !(%o2 & 7)	 * %o0 is 8 aligned (if not, it will be slooooow, but will work)	 *	 * This is optimized for the common case:	 * in my stats, 90% of src are 8 aligned (even on sparc32)	 * and average length is 18 or so.	 */	.globl	__strncpy_from_user__strncpy_from_user:	/* %o0=dest, %o1=src, %o2=count */	sethi	%hi(0b), %o5		! IEU0	Group	andcc	%o1, 7, %g0		! IEU1	bne,pn	%icc, 30f		! CTI	 ldx	[%o5 + %lo(0b)], %o4	! Load	Group	add	%o0, %o2, %g3		! IEU060:	ldxa	[%o1] %asi, %g1		! Load	Group	brlez,pn %o2, 10f		! CTI	 sllx	%o4, 7, %o5		! IEU0	Group	mov	%o0, %o3		! IEU11:	sub	%g1, %o4, %g2		! IEU0	Group	stx	%g1, [%o0]		! Store	add	%o0, 8, %o0		! IEU1	andcc	%g2, %o5, %g0		! IEU1	Group	bne,pn	%xcc, 5f		! CTI	 add	%o1, 8, %o1		! IEU0	cmp	%o0, %g3		! IEU1	Group	bl,a,pt %xcc, 1b		! CTI61:	 ldxa	[%o1] %asi, %g1		! Load10:	retl				! CTI	Group	 mov	%o2, %o0		! IEU05:	srlx	%g2, 32, %g7		! IEU0	Group	sethi	%hi(0xff00), %g5	! IEU1	andcc	%g7, %o5, %g0		! IEU1	Group	be,pn	%icc, 2f		! CTI	 or	%g5, %lo(0xff00), %g5	! IEU0	srlx	%g1, 48, %g7		! IEU0	Group	andcc	%g7, %g5, %g0		! IEU1	Group	be,pn	%icc, 50f		! CTI	 andcc	%g7, 0xff, %g0		! IEU1	Group	be,pn	%icc, 51f		! CTI	 srlx	%g1, 32, %g7		! IEU0	andcc	%g7, %g5, %g0		! IEU1	Group	be,pn	%icc, 52f		! CTI	 andcc	%g7, 0xff, %g0		! IEU1	Group	be,pn	%icc, 53f		! CTI2:	 andcc	%g2, %o5, %g0		! IEU1	Group	be,pn	%icc, 2f		! CTI	 srl	%g1, 16, %g7		! IEU0	andcc	%g7, %g5, %g0		! IEU1	Group	be,pn	%icc, 54f		! CTI	 andcc	%g7, 0xff, %g0		! IEU1	Group	be,pn	%icc, 55f		! CTI	 andcc	%g1, %g5, %g0		! IEU1	Group	be,pn	%icc, 56f		! CTI	 andcc	%g1, 0xff, %g0		! IEU1	Group	be,a,pn	%icc, 57f		! CTI	 sub	%o0, %o3, %o0		! IEU02:	cmp	%o0, %g3		! IEU1	Group	bl,a,pt	%xcc, 1b		! CTI62:	 ldxa	[%o1] %asi, %g1		! Load	retl				! CTI	Group	 mov	%o2, %o0		! IEU050:	sub	%o0, %o3, %o0	retl	 sub	%o0, 8, %o051:	sub	%o0, %o3, %o0	retl	 sub	%o0, 7, %o052:	sub	%o0, %o3, %o0	retl	 sub	%o0, 6, %o053:	sub	%o0, %o3, %o0	retl	 sub	%o0, 5, %o054:	sub	%o0, %o3, %o0	retl	 sub	%o0, 4, %o055:	sub	%o0, %o3, %o0	retl	 sub	%o0, 3, %o056:	sub	%o0, %o3, %o0	retl	 sub	%o0, 2, %o057:	retl	 sub	%o0, 1, %o030:	brlez,pn %o2, 3f	 sub	%g0, %o2, %o3	add	%o0, %o2, %o063:	lduba	[%o1] %asi, %o41:	add	%o1, 1, %o1	brz,pn	%o4, 2f	 stb	%o4, [%o0 + %o3]	addcc	%o3, 1, %o3	bne,pt	%xcc, 1b64:	 lduba	[%o1] %asi, %o43:	retl	 mov	%o2, %o02:	retl	 add	%o2, %o3, %o0	.section .fixup,#alloc,#execinstr	.align	44:	retl	 mov	-EFAULT, %o0	.section __ex_table,#alloc	.align	4	.word	60b, 4b	.word	61b, 4b	.word	62b, 4b	.word	63b, 4b	.word	64b, 4b

⌨️ 快捷键说明

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