# 2.11BSD#431 - /usr/src/lib/libc/pdp/gen/bzero.s

##### Functions

    _bzero            X

##### Macros

    N                 X

       1: /*
       2:  * Copyright (c) 1987 Regents of the University of California.
       3:  * All rights reserved.  The Berkeley software License Agreement
       4:  * specifies the terms and conditions for redistribution.
       5:  */
       6:
       7: #ifdef LIBC_SCCS
       8:         <@(#)bzero.s	1.2 (Berkeley) 8/21/87\0>
       9:         .even
      10: #endif LIBC_SCCS
      11:
      12: #include "DEFS.h"
      13:
      14: /*
      15:  * bzero(b, length)
      16:  *	caddr_t	b;
      17:  *	u_int	length;
      18:  *
      19:  * Zero length bytes starting at b.  Bzero uses a cost analysis heuristic to
      20:  * determine if it's worth while to try zeroing memory by words.  If length >
      21:  * N, then try for a word zero.  This routine will fail if N < 8.
      22:  * 8 is a good value for N:
      23:  *
      24:  *	Algorithm			Cost (in instructions)
      25:  *	byte loop			2 * length
      26:  *	word loop overhead [worst case]	11
      27:  *	word loop			0.625 * length
      28:  *
      29:  *	N * 2 > 11 + N * 0.625
      30:  *	N > 8
      31:  */
      32: #undef  N
      33: #define N       8.
      34:
      35: ENTRY(bzero)
      36:         mov     4(sp),r0        / if ((r0 = length) == 0)
      37:         beq     2f              /	return
      38:         mov     2(sp),r1        / r1 = b
      39:         cmp     r0,$N           / if (length > N)
      40:         bhi     3f              /	do words
      41: 1:
      42:         clrb    (r1)+           / do  *b++ = 0
      43:         sob     r0,1b           / while (--length)
      44: 2:
      45:         rts     pc              / and return
      46:
      47: /*
      48:  * The length of the zero justifies using a word loop, handling any leading
      49:  * and trailing odd bytes separately.
      50:  */
      51: 3:
      52:         bit     $1,r1           / if (odd leading byte)
      53:         beq     4f              / {	zero it
      54:         clrb    (r1)+           /	length--
      55:         dec     r0              / }
      56: 4:
      57:         mov     r0,-(sp)        / save trailing byte indicator
      58:         asr     r0              / length >>= 1 (unsigned)
      59:         bic     $0100000,r0     / (length is now in remaining words to zero)
      60:         asr     r0              / if (length >>= 1, wasodd(length))
      61:         bcc     5f              /	handle leading non multiple of four
      62:         clr     (r1)+
      63: 5:
      64:         asr     r0              / if (length >>= 1, wasodd(length))
      65:         bcc     6f              /	handle leading non multiple of eight
      66:         clr     (r1)+
      67:         clr     (r1)+
      68: 6:
      69:         clr     (r1)+           / do
      70:         clr     (r1)+           /	clear eight bytes
      71:         clr     (r1)+
      72:         clr     (r1)+
      73:         sob     r0,6b           / while (--length)
      74:         bit     $1,(sp)+        / if (odd trailing byte)
      75:         beq     7f
      76:         clrb    (r1)+           /	zero it
      77: 7:
      78:         rts     pc              / and return

#### Defined functions

_bzero defined in line 35; used 251 times

- in /usr/ingres/source/monitor/quit.c line 69
- in /usr/src/bin/adb/setup.c line 39
- in /usr/src/bin/csh/sh.misc.c line 71
- in /usr/src/bin/date.c line 277
- in /usr/src/bin/disklabel/disklabel.c line 308, 472, 485, 643
- in /usr/src/bin/ld/ld.c line 837
- in /usr/src/bin/login/login.c line 273, 279, 361, 545
- in /usr/src/bin/ping/ping.c line 241
- in /usr/src/bin/ps.c line 634
- in /usr/src/bin/tar.c line 806
- in /usr/src/games/mille/init.c line 13
- in /usr/src/games/robots/make_level.c line 39
- in /usr/src/lib/libc/gen/calloc.c line 17
- in /usr/src/lib/libc/gen/disklabel.c line 78
- in /usr/src/lib/libc/gen/ndbm.c line 180, 241, 280, 306, 328
- in /usr/src/lib/libc/gen/popen.c line 65
- in /usr/src/lib/libc/net/res_send.c line 43
- in /usr/src/libexec/acctd/acctd.c line 324
- in /usr/src/libexec/ftpd/popen.c line 58
- in /usr/src/libexec/identd/src/identd.c line 93
- in /usr/src/libexec/popper/pop_init.c line 44
- in /usr/src/local/mkovmake/mkovmake.c line 502
- in /usr/src/new/PORT/hexdump/display.c line 226, 335
- in /usr/src/new/PORT/perl.1.0.0/perly.c line 766, 781, 880, 931, 987, 1108, 1128, 1390, 2225, 2358
- in /usr/src/new/PORT/perl.1.0.0/x2p/hash.c line 144, 178
- in /usr/src/new/PORT/perl.1.0.0/x2p/str.c line 214
- in /usr/src/new/PORT/perl.1.0.10/perly.c line 796, 811, 910, 961, 1017, 1138, 1158, 1420, 2259, 2392
- in /usr/src/new/PORT/perl.1.0.16/perly.c line 797, 812, 911, 962, 1018, 1139, 1159, 1421, 2260, 2393
- in /usr/src/new/kermit5.188/ckcmdb.c line 76
- in /usr/src/new/pathalias/config.h line 68
- in /usr/src/sbin/dcheck/dcheck.c line 115, 236
- in /usr/src/sbin/dump/dumpdir.c line 196, 234
- in /usr/src/sbin/dump/dumpmain.c line 225-227(3)
- in /usr/src/sbin/fsck/dir.c line 40, 290, 413
- in /usr/src/sbin/fsck/inode.c line 295
- in /usr/src/sbin/fsck/main.c line 253-254(2)
- in /usr/src/sbin/fsck/pass1.c line 35
- in /usr/src/sbin/fsck/pass1b.c line 25
- in /usr/src/sbin/fsck/pass2.c line 25, 130, 151
- in /usr/src/sbin/fsck/pass3.c line 24
- in /usr/src/sbin/fsck/pass4.c line 24
- in /usr/src/sbin/fsck/pass5.c line 24, 155, 165, 176
- in /usr/src/sbin/fsck/setup.c line 103
- in /usr/src/sbin/fsck/utilities.c line 179, 262
- in /usr/src/sbin/icheck/icheck.c line 168, 390, 413, 444
- in /usr/src/sbin/ifconfig/ifconfig.c line 320, 330, 337, 349, 379, 389
- in /usr/src/sbin/init/init.c line 91
- in /usr/src/sbin/mkfs/mkfs.c line 251, 414, 424
- in /usr/src/sbin/ncheck/ncheck.c line 358
- in /usr/src/sbin/reboot/reboot.c line 172
- in /usr/src/sbin/restor/restor.c line 412, 490, 530, 564, 736, 848, 1188
- in /usr/src/sbin/routed/startup.c line 53, 172, 233-235(3), 279
- in /usr/src/sbin/routed/tools/query.c line 74, 105
- in /usr/src/sbin/routed/tools/trace.c line 73
- in /usr/src/sys/conf/netbind.c line 70
- in /usr/src/sys/h/select.h line 61
- in /usr/src/sys/net/if.c line 347
- in /usr/src/sys/net/route.c line 337
- in /usr/src/sys/netinet/if_ether.c line 117
- in /usr/src/sys/netinet/in.c line 358
- in /usr/src/sys/netinet/in_pcb.c line 247, 261
- in /usr/src/sys/netinet/ip_output.c line 81, 433
- in /usr/src/sys/netinet/tcp_debug.c line 73-77(2)
- in /usr/src/sys/netns/ns.c line 200
- in /usr/src/sys/netns/ns_input.c line 415
- in /usr/src/sys/netns/ns_ip.c line 305
- in /usr/src/sys/netns/ns_output.c line 61
- in /usr/src/sys/netns/ns_pcb.c line 209, 222
- in /usr/src/sys/netns/spp_debug.c line 70-74(2)
- in /usr/src/sys/pdp/mem.c line 33
- in /usr/src/sys/pdpif/if_de.c line 1186
- in /usr/src/sys/pdpif/if_qe.c line 491, 540, 766
- in /usr/src/sys/pdpif/if_qt.c line 202
- in /usr/src/sys/pdpstand/conf.c line 146
- in /usr/src/sys/pdpstand/makesimtape.c line 140
- in /usr/src/sys/pdpstand/maketape.c line 95
- in /usr/src/sys/pdpuba/hk.c line 266
- in /usr/src/sys/pdpuba/ra.c line 534, 1294
- in /usr/src/sys/pdpuba/rl.c line 260
- in /usr/src/sys/pdpuba/tmscp.c line 538, 922
- in /usr/src/sys/pdpuba/tmscpdump.c line 64
- in /usr/src/sys/pdpuba/xp.c line 315
- in /usr/src/sys/sys/ingreslock.c line 319
- in /usr/src/sys/sys/kern_fork.c line 81-82(2)
- in /usr/src/sys/sys/kern_prot.c line 208
- in /usr/src/sys/sys/kern_resource.c line 259
- in /usr/src/sys/sys/sys_generic.c line 237, 334-335(2)
- in /usr/src/sys/sys/sys_socket.c line 127
- in /usr/src/sys/sys/tty.c line 664
- in /usr/src/sys/sys/tty_tb.c line 93
- in /usr/src/sys/sys/ufs_alloc.c line 167
- in /usr/src/sys/sys/ufs_inode.c line 508, 642
- in /usr/src/sys/sys/ufs_mount.c line 146-151(2)
- in /usr/src/sys/sys/uipc_mbuf.c line 162
- in /usr/src/sys/sys/uipc_socket.c line 630
- in /usr/src/sys/sys/vm_sched.c line 220
- in /usr/src/ucb/colcrt.c line 194
- in /usr/src/ucb/ftp/ftp.c line 72, 102
- in /usr/src/ucb/man/apropos.c line 86
- in /usr/src/ucb/quota.c line 152
- in /usr/src/ucb/telnet.c line 1974
- in /usr/src/ucb/tftp/main.c line 132
- in /usr/src/ucb/tn3270/datastream.c line 170, 184, 545-550(2)
- in /usr/src/ucb/tn3270/screen.h line 77-78(2)
- in /usr/src/ucb/ul.c line 328
- in /usr/src/usr.bin/tip/aculib/courier.c line 164, 239
- in /usr/src/usr.lib/libutil/logout.c line 44-45(2)
- in /usr/src/usr.lib/libvmf/vmf.c line 212
- in /usr/src/usr.sbin/arp/arp.c line 113, 166, 217
- in /usr/src/usr.sbin/cron/popen.c line 68
- in /usr/src/usr.sbin/dev_mkdb/dev_mkdb.c line 104
- in /usr/src/usr.sbin/edquota/edquota.c line 225
- in /usr/src/usr.sbin/lpr/common.c line 89
- in /usr/src/usr.sbin/lpr/filters/rvcat.c line 851
- in /usr/src/usr.sbin/lpr/filters/vcat.c line 819
- in /usr/src/usr.sbin/mkproto/mkproto.c line 95-97(3), 277, 304
- in /usr/src/usr.sbin/named/named/db_load.c line 386
- in /usr/src/usr.sbin/named/named/db_save.c line 134, 171
- in /usr/src/usr.sbin/named/named/ns_init.c line 272
- in /usr/src/usr.sbin/named/named/ns_main.c line 75
- in /usr/src/usr.sbin/named/named/ns_maint.c line 100, 139, 149
- in /usr/src/usr.sbin/named/named/storage.c line 144
- in /usr/src/usr.sbin/named/tools/nslookup/list.c line 234, 847
- in /usr/src/usr.sbin/named/tools/nslookup/subr.c line 168
- in /usr/src/usr.sbin/ntp/ntp.c line 191
- in /usr/src/usr.sbin/ntp/ntp.h line 82
- in /usr/src/usr.sbin/ntp/ntpd.c line 730
- in /usr/src/usr.sbin/ntp/ntpdc.c line 268
- in /usr/src/usr.sbin/ntp/read_psti.c line 118-123(2)
- in /usr/src/usr.sbin/sendmail.MX/aux/bbn_daemon.c line 63, 189
- in /usr/src/usr.sbin/sendmail.MX/src/parseaddr.c line 861
- in /usr/src/usr.sbin/sendmail.MX/src/queue.c line 183
- in /usr/src/usr.sbin/sendmail.MX/src/readcf.c line 399
- in /usr/src/usr.sbin/sendmail.MX/src/sendmail.h line 81
- in /usr/src/usr.sbin/sendmail.MX/src/stab.c line 116
- in /usr/src/usr.sbin/sendmail/aux/bbn_daemon.c line 63, 189
- in /usr/src/usr.sbin/syslogd/syslogd.c line 953, 1026
- in /usr/src/usr.sbin/timed/timed.c line 606
- in /usr/src/usr.sbin/traceroute/traceroute.c line 220, 358, 389, 436

#### Defined macros

N defined in line 33; used 1 times

- in line 39

Last modified: 1987-08-22 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1649 |