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

📄 blkcopy.s,v

📁 TCP-IP红宝书源代码
💻 S,V
字号:
head	1.1;
access;
symbols;
locks
	dls:1.1; strict;
comment	@# @;


1.1
date	97.09.21.19.27.40;	author dls;	state Dist;
branches;
next	;


desc
@@


1.1
log
@pre-3e code
@
text
@/* blkcopy.s - blkcopy */

/*------------------------------------------------------------------------
 * blkcopy - copy "count" bytes from "src" to "dst"
 *	blkcopy(dst, src, count)
 *------------------------------------------------------------------------
 */
	.globl	_blkcopy
/*
 * NOTE: to handle overlapping buffers in the copy, blkcopy() copies 
 *	bytes back-to-front if src < dst, front-to-back otherwise
 */
	.align	2
_blkcopy:
	pushl	%esi
	pushl	%edi
	movl	12(%esp),%edi
	movl	16(%esp),%esi
	movl	20(%esp),%ecx
	cmpl	%edi,%esi
	jle	L100
	sarl	$2,%ecx			/* long word count	*/
	cld
	rep
	movsl
	movl	20(%esp),%ecx
	andl	$3,%ecx			/* move residual bytes	*/
	rep
	movsb
	popl 	%edi
	popl	%esi
	ret
L100:		/* backwards blkcopy */
	decl	%ecx
	addl	%ecx,%esi		/* set pointers to end	*/
	addl	%ecx,%edi
	incl	%ecx
	std
	andl	$3,%ecx			/* move residual bytes */
	rep
	movsb
	subl	$3,%esi		/* convert to long word pointer	*/
	subl	$3,%edi		/* convert to long word pointer	*/
	movl	20(%esp),%ecx
	sarl	$2,%ecx			/* long-word count	*/
	rep
	movsl
	popl	%edi
	popl	%esi
	ret
@

⌨️ 快捷键说明

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