bzero.s

来自「操作系统SunOS 4.1.3版本的源码」· S 代码 · 共 36 行

S
36
字号
	.data/*	.asciz	"@(#)bzero.s 1.1 92/07/30 SMI"	*/	.text#include "DEFS.h"| Zero block of storage| Usage: bzero(addr, length)ENTRY(bzero)	movl	PARAM,a1	| address	movl	PARAM2,d0	| length	jle     5$		| return if not positive	clrl	d1		| use zero register to avoid clr fetches	btst	#0,PARAMX(3)	| odd address?	jeq	1$		| no, skip	movb	d1,a1@+		| do one byte	subql	#1,d0		| to adjust to even address1$:	movl	d0,a0		| save possibly adjusted count	lsrl	#2,d0		| get count of longs	jra	3$		| go to loop test| Here is the fast inner loop - loop mode on 680102$:	movl	d1,a1@+		| store long3$:	dbra	d0,2$		| decr count; br until done	clrw	d0	subql	#1,d0	bccs	2$| Now up to 3 bytes remain to be cleared	movl	a0,d0		| restore count	btst	#1,d0		| need a short word?	jeq	4$		| no, skip	movw	d1,a1@+		| do a short4$:	btst	#0,d0		| need another byte	jeq	5$		| no, skip	movb	d1,a1@+		| do a byte5$:	RET			| all done

⌨️ 快捷键说明

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