152715Sbostic/*- 2*61146Sbostic * Copyright (c) 1991, 1993 3*61146Sbostic * The Regents of the University of California. All rights reserved. 452715Sbostic * 552715Sbostic * This code is derived from software contributed to Berkeley by 652715Sbostic * Ralph Campbell. 752715Sbostic * 852715Sbostic * %sccs.include.redist.c% 952715Sbostic */ 1052715Sbostic 1155708Sralph#include <machine/machAsmDefs.h> 1252737Sbostic 1352715Sbostic#if defined(LIBC_SCCS) && !defined(lint) 14*61146Sbostic ASMSTR("@(#)bzero.s 8.1 (Berkeley) 06/04/93") 1552715Sbostic#endif /* LIBC_SCCS and not lint */ 1652715Sbostic 1752715Sbostic/* bzero(s1, n) */ 1852715Sbostic 1952715SbosticLEAF(bzero) 2052715Sbostic .set noreorder 2152715Sbostic blt a1, 12, smallclr # small amount to clear? 2252715Sbostic subu a3, zero, a0 # compute # bytes to word align address 2352715Sbostic and a3, a3, 3 2452715Sbostic beq a3, zero, 1f # skip if word aligned 2552715Sbostic subu a1, a1, a3 # subtract from remaining count 2652715Sbostic swr zero, 0(a0) # clear 1, 2, or 3 bytes to align 2752715Sbostic addu a0, a0, a3 2852715Sbostic1: 2952715Sbostic and v0, a1, 3 # compute number of words left 3052715Sbostic subu a3, a1, v0 3152715Sbostic move a1, v0 3252715Sbostic addu a3, a3, a0 # compute ending address 3352715Sbostic2: 3452715Sbostic addu a0, a0, 4 # clear words 3557857Sralph bne a0, a3, 2b # unrolling loop doesnt help 3657857Sralph sw zero, -4(a0) # since we are limited by memory speed 3752715Sbosticsmallclr: 3852715Sbostic ble a1, zero, 2f 3952715Sbostic addu a3, a1, a0 # compute ending address 4052715Sbostic1: 4152715Sbostic addu a0, a0, 1 # clear bytes 4252715Sbostic bne a0, a3, 1b 4352715Sbostic sb zero, -1(a0) 4452715Sbostic2: 4552715Sbostic j ra 4652715Sbostic nop 4752715SbosticEND(bzero) 48