summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-10-31 00:43:23 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-10-31 00:43:23 +0000
commit1159c743c3a52da52101db4f883ad086a7a38f7d (patch)
tree3aeffe20aecc868865d0fcec828fc022c11f0f6b
parent0970d4a8714e3f3891d2fffd1ea52ae426ff2671 (diff)
Merge NetBSD/Alpha 961020
-rw-r--r--sys/lib/libkern/Makefile18
-rw-r--r--sys/lib/libkern/Makefile.inc32
-rw-r--r--sys/lib/libkern/arch/alpha/DEFS.h30
-rw-r--r--sys/lib/libkern/arch/alpha/Makefile.inc24
-rw-r--r--sys/lib/libkern/arch/alpha/SYS.h53
-rw-r--r--sys/lib/libkern/arch/alpha/byte_swap_2.S5
-rw-r--r--sys/lib/libkern/arch/alpha/byte_swap_4.S5
-rw-r--r--sys/lib/libkern/arch/alpha/bzero.S5
-rw-r--r--sys/lib/libkern/arch/alpha/divrem.m415
-rw-r--r--sys/lib/libkern/arch/alpha/ffs.S92
-rw-r--r--sys/lib/libkern/arch/alpha/htonl.S1
-rw-r--r--sys/lib/libkern/arch/alpha/htons.S1
-rw-r--r--sys/lib/libkern/arch/alpha/ntohl.S1
-rw-r--r--sys/lib/libkern/arch/alpha/ntohs.S1
14 files changed, 155 insertions, 128 deletions
diff --git a/sys/lib/libkern/Makefile b/sys/lib/libkern/Makefile
index caee95f22a8..ceae3e037e9 100644
--- a/sys/lib/libkern/Makefile
+++ b/sys/lib/libkern/Makefile
@@ -1,21 +1,18 @@
-# $OpenBSD: Makefile,v 1.9 1996/08/10 21:41:14 deraadt Exp $
-# $NetBSD: Makefile,v 1.27 1996/05/10 21:27:32 scottr Exp $
+# $OpenBSD: Makefile,v 1.10 1996/10/31 00:43:07 niklas Exp $
+# $NetBSD: Makefile,v 1.31 1996/08/10 04:01:31 mycroft Exp $
LIB= kern
NOPIC=
-DIR= ${KERNREL}${KERNDIR}
+M= ${.CURDIR}/arch/${MACHINE_ARCH}
-CPPFLAGS= -I${DIR}/arch/${MACHINE_ARCH} \
- ${KERNCPPFLAGS:S@-I.@-I${KERNREL}.@g}
+CPPFLAGS= -I$M ${KERNCPPFLAGS}
-.if exists (${DIR}/arch/${MACHINE_ARCH}/Makefile.inc)
-.PATH: ${DIR}/arch/${MACHINE_ARCH}
-.include "${DIR}/arch/${MACHINE_ARCH}/Makefile.inc"
+.if exists ($M/Makefile.inc)
+.PATH: $M
+.include "$M/Makefile.inc"
.endif
-.PATH: ${DIR}
-
.if (${MACHINE_ARCH} != "alpha")
# Quad support
SRCS+= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
@@ -26,6 +23,7 @@ SRCS+= adddi3.c anddi3.c ashldi3.c ashrdi3.c cmpdi2.c divdi3.c iordi3.c \
# Other stuff
SRCS+= md5.c getsn.c srandom.c
+# Files to clean up
CLEANFILES+= lib${LIB}.o lib${LIB}.po
# mcount cannot be compiled with profiling
diff --git a/sys/lib/libkern/Makefile.inc b/sys/lib/libkern/Makefile.inc
index aa1001d759f..840bc3045a6 100644
--- a/sys/lib/libkern/Makefile.inc
+++ b/sys/lib/libkern/Makefile.inc
@@ -1,32 +1,44 @@
-# $OpenBSD: Makefile.inc,v 1.4 1996/05/23 08:34:03 deraadt Exp $
-# $NetBSD: Makefile.inc,v 1.15 1996/05/20 17:23:25 mrg Exp $
+# $OpenBSD: Makefile.inc,v 1.5 1996/10/31 00:43:09 niklas Exp $
+# $NetBSD: Makefile.inc,v 1.22 1996/09/30 15:54:35 ws Exp $
#
# NOTE: $S must correspond to the top of the 'sys' tree
KERNDIR= $S/lib/libkern
-KERNDST= lib/kern
-KERNREL?= ../../
-KERNLIB?= ${KERNDST}/libkern.o
+KERNDST?= ${.OBJDIR}/lib/kern
+KERN_AS?= obj
+
+.if (${KERN_AS} == "library")
+KERNLIB= ${KERNDST}/libkern.a
+KERNLIB_PROF= ${KERNDST}/libkern_p.a
+.else
+KERNLIB= ${KERNDST}/libkern.o
KERNLIB_PROF= ${KERNDST}/libkern.po
+.endif
KERNMAKE= \
- cd ${KERNDST} && ${MAKE} -f ${KERNREL}${KERNDIR}/Makefile \
+ cd ${KERNDIR} && MAKEOBJDIR=${KERNDST} ${MAKE} \
CC='${CC}' CFLAGS='${CFLAGS}' \
AS='${AS}' AFLAGS='${AFLAGS}' \
- LD='${LD}' \
+ LD='${LD}' STRIP='${STRIP}' \
MACHINE='${MACHINE}' MACHINE_ARCH='${MACHINE_ARCH}' \
- KERNCPPFLAGS='${CPPFLAGS}' \
- KERNREL='${KERNREL}' \
- KERNDIR='${KERNDIR}'
+ KERNCPPFLAGS='${CPPFLAGS:S@^-I.@-I../../.@g}'
${KERNLIB}: .NOTMAIN __always_make_kernlib
@echo making sure the kern library is up to date...
+.if (${KERN_AS} == "library")
+ @${KERNMAKE} libkern.a
+.else
@${KERNMAKE} libkern.o
+.endif
${KERNLIB_PROF}: .NOTMAIN __always_make_kernlib
@echo making sure the profiled kern library is up to date...
+.if (${KERN_AS} == "library")
+ @${KERNMAKE} libkern_p.a
+.else
@${KERNMAKE} libkern.po
+.endif
clean:: .NOTMAIN __always_make_kernlib
@echo cleaning the kern library objects
diff --git a/sys/lib/libkern/arch/alpha/DEFS.h b/sys/lib/libkern/arch/alpha/DEFS.h
deleted file mode 100644
index 0d16d3972ad..00000000000
--- a/sys/lib/libkern/arch/alpha/DEFS.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $NetBSD: DEFS.h,v 1.1 1995/02/13 21:49:11 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <machine/asm.h>
diff --git a/sys/lib/libkern/arch/alpha/Makefile.inc b/sys/lib/libkern/arch/alpha/Makefile.inc
index 5cdbfb0b3c9..a8db36a1d02 100644
--- a/sys/lib/libkern/arch/alpha/Makefile.inc
+++ b/sys/lib/libkern/arch/alpha/Makefile.inc
@@ -1,9 +1,9 @@
-# $OpenBSD: Makefile.inc,v 1.4 1996/05/01 15:08:15 deraadt Exp $
-# $NetBSD: Makefile.inc,v 1.5 1996/04/17 22:46:34 cgd Exp $
+# $OpenBSD: Makefile.inc,v 1.5 1996/10/31 00:43:12 niklas Exp $
+# $NetBSD: Makefile.inc,v 1.9 1996/08/27 00:44:24 cgd Exp $
SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \
- bcmp.c bzero.S ffs.c strcat.c strcmp.c strcpy.c strlen.c strncmp.c \
- strncpy.c scanc.c skpc.c locc.c htonl.S htons.S ntohl.S ntohs.S \
+ bcmp.c bzero.S ffs.S strcat.c strcmp.c strcpy.c strlen.c strncmp.c \
+ strncpy.c scanc.c skpc.c htonl.S htons.S ntohl.S ntohs.S \
random.c strncasecmp.c
# `source' files built from m4 source
@@ -12,42 +12,42 @@ SRCS+= __remqu.S __remq.S __remlu.S __reml.S
CLEANFILES+= __divqu.S __divq.S __divlu.S __divl.S
CLEANFILES+= __remqu.S __remq.S __remlu.S __reml.S
-__divqu.S: ${DIR}/arch/alpha/divrem.m4
+__divqu.S: ${M}/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@(echo "define(NAME,\`__divqu')define(OP,\`div')define(S,\`false')"; \
echo "define(WORDSIZE,64)"; cat ${.ALLSRC}) | m4 > ${.TARGET}
-__divq.S: ${DIR}/arch/alpha/divrem.m4
+__divq.S: ${M}/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@(echo "define(NAME,\`__divq')define(OP,\`div')define(S,\`true')"; \
echo "define(WORDSIZE,64)"; cat ${.ALLSRC}) | m4 > ${.TARGET}
-__divlu.S: ${DIR}/arch/alpha/divrem.m4
+__divlu.S: ${M}/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@(echo "define(NAME,\`__divlu')define(OP,\`div')define(S,\`false')"; \
echo "define(WORDSIZE,32)"; cat ${.ALLSRC}) | m4 > ${.TARGET}
-__divl.S: ${DIR}/arch/alpha/divrem.m4
+__divl.S: ${M}/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@(echo "define(NAME,\`__divl')define(OP,\`div')define(S,\`true')"; \
echo "define(WORDSIZE,32)"; cat ${.ALLSRC}) | m4 > ${.TARGET}
-__remqu.S: ${DIR}/arch/alpha/divrem.m4
+__remqu.S: ${M}/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@(echo "define(NAME,\`__remqu')define(OP,\`rem')define(S,\`false')"; \
echo "define(WORDSIZE,64)"; cat ${.ALLSRC}) | m4 > ${.TARGET}
-__remq.S: ${DIR}/arch/alpha/divrem.m4
+__remq.S: ${M}/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@(echo "define(NAME,\`__remq')define(OP,\`rem')define(S,\`true')"; \
echo "define(WORDSIZE,64)"; cat ${.ALLSRC}) | m4 > ${.TARGET}
-__remlu.S: ${DIR}/arch/alpha/divrem.m4
+__remlu.S: ${M}/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@(echo "define(NAME,\`__remlu')define(OP,\`rem')define(S,\`false')"; \
echo "define(WORDSIZE,32)"; cat ${.ALLSRC}) | m4 > ${.TARGET}
-__reml.S: ${DIR}/arch/alpha/divrem.m4
+__reml.S: ${M}/divrem.m4
@echo 'building ${.TARGET} from ${.ALLSRC}'
@(echo "define(NAME,\`__reml')define(OP,\`rem')define(S,\`true')"; \
echo "define(WORDSIZE,32)"; cat ${.ALLSRC}) | m4 > ${.TARGET}
diff --git a/sys/lib/libkern/arch/alpha/SYS.h b/sys/lib/libkern/arch/alpha/SYS.h
deleted file mode 100644
index 738dda0ee01..00000000000
--- a/sys/lib/libkern/arch/alpha/SYS.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* $NetBSD: SYS.h,v 1.1 1995/02/13 21:49:13 cgd Exp $ */
-
-/*
- * Copyright (c) 1994, 1995 Carnegie-Mellon University.
- * All rights reserved.
- *
- * Author: Chris G. Demetriou
- *
- * Permission to use, copy, modify and distribute this software and
- * its documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
- * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
- * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * Carnegie Mellon requests users of this software to return to
- *
- * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
- * School of Computer Science
- * Carnegie Mellon University
- * Pittsburgh PA 15213-3890
- *
- * any improvements or extensions that they make and grant Carnegie the
- * rights to redistribute these changes.
- */
-
-#include <machine/asm.h>
-#include <sys/syscall.h>
-
-#define CALLSYS(num) \
- CONST(num, v0); \
- call_pal 0x83; /* op_callsys */
-
-#define SYSCALL_NOLABEL(x) \
- CALLSYS(SYS_/**/x); \
- beq a3, 9f; \
- br gp, 8f; \
-8: SETGP(gp); \
- lda at_reg, cerror; \
- jmp zero, (at_reg); \
-9:
-
-#define SYSCALL(x) LEAF(x, 0 /* XXX */); SYSCALL_NOLABEL(x);
-#define RSYSCALL(x) SYSCALL(x); RET; END(x);
-
-#define PSEUDO(x,y) \
-LEAF(x,0); /* unknown # of args */ \
- CALLSYS(SYS_/**/y); \
- RET; \
-END(x);
diff --git a/sys/lib/libkern/arch/alpha/byte_swap_2.S b/sys/lib/libkern/arch/alpha/byte_swap_2.S
index bcc67274837..29d1946200d 100644
--- a/sys/lib/libkern/arch/alpha/byte_swap_2.S
+++ b/sys/lib/libkern/arch/alpha/byte_swap_2.S
@@ -1,4 +1,5 @@
-/* $NetBSD: byte_swap_2.S,v 1.1 1996/04/17 22:46:37 cgd Exp $ */
+/* $OpenBSD: byte_swap_2.S,v 1.2 1996/10/31 00:43:14 niklas Exp $ */
+/* $NetBSD: byte_swap_2.S,v 1.2 1996/10/17 04:26:21 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@@ -27,7 +28,7 @@
* rights to redistribute these changes.
*/
-#include "DEFS.h"
+#include <machine/asm.h>
#ifndef NAME
#define NAME byte_swap_2
diff --git a/sys/lib/libkern/arch/alpha/byte_swap_4.S b/sys/lib/libkern/arch/alpha/byte_swap_4.S
index a60803d2edf..8a6ac788b0e 100644
--- a/sys/lib/libkern/arch/alpha/byte_swap_4.S
+++ b/sys/lib/libkern/arch/alpha/byte_swap_4.S
@@ -1,4 +1,5 @@
-/* $NetBSD: byte_swap_4.S,v 1.1 1996/04/17 22:46:39 cgd Exp $ */
+/* $OpenBSD: byte_swap_4.S,v 1.2 1996/10/31 00:43:15 niklas Exp $ */
+/* $NetBSD: byte_swap_4.S,v 1.2 1996/10/17 04:26:22 cgd Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@@ -27,7 +28,7 @@
* rights to redistribute these changes.
*/
-#include "DEFS.h"
+#include <machine/asm.h>
#ifndef NAME
#define NAME byte_swap_4
diff --git a/sys/lib/libkern/arch/alpha/bzero.S b/sys/lib/libkern/arch/alpha/bzero.S
index 3bf1e75a9f8..32c4952a7c4 100644
--- a/sys/lib/libkern/arch/alpha/bzero.S
+++ b/sys/lib/libkern/arch/alpha/bzero.S
@@ -1,4 +1,5 @@
-/* $NetBSD: bzero.S,v 1.1 1995/10/20 01:16:02 cgd Exp $ */
+/* $OpenBSD: bzero.S,v 1.2 1996/10/31 00:43:16 niklas Exp $ */
+/* $NetBSD: bzero.S,v 1.2 1996/10/17 04:26:24 cgd Exp $ */
/*
* Copyright (c) 1995 Carnegie-Mellon University.
@@ -27,7 +28,7 @@
* rights to redistribute these changes.
*/
-#include "DEFS.h"
+#include <machine/asm.h>
LEAF(bzero,2)
ble a1,bzero_done
diff --git a/sys/lib/libkern/arch/alpha/divrem.m4 b/sys/lib/libkern/arch/alpha/divrem.m4
index f0a9a10409a..cc4e71c2278 100644
--- a/sys/lib/libkern/arch/alpha/divrem.m4
+++ b/sys/lib/libkern/arch/alpha/divrem.m4
@@ -1,4 +1,5 @@
-/* $NetBSD: divrem.m4,v 1.3 1995/10/20 00:53:28 cgd Exp $ */
+/* $OpenBSD: divrem.m4,v 1.3 1996/10/31 00:43:17 niklas Exp $ */
+/* $NetBSD: divrem.m4,v 1.5 1996/10/17 04:26:25 cgd Exp $ */
/*
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
@@ -54,7 +55,7 @@ define(CC, `t2')
define(T_0, `t3')
ifelse(S, `true', `define(NEG, `t4')')
-#include "DEFS.h"
+#include <machine/asm.h>
LEAF(NAME, 0) /* XXX */
lda sp, -64(sp)
@@ -112,7 +113,7 @@ ifelse(WORDSIZE, `32', `
/* kill the special cases. */
beq B, Ldotrap /* division by zero! */
-1: cmpult A, B, CC /* A < B? */
+ cmpult A, B, CC /* A < B? */
/* RESULT is already zero, from above. A is untouched. */
bne CC, Lret_result
@@ -125,7 +126,7 @@ ifelse(WORDSIZE, `32', `
* Find out how many bits of zeros are at the beginning of the divisor.
*/
LBbits:
- CONST(1, T_0) /* I = 0; BIT = 1<<WORDSIZE-1 */
+ ldiq T_0, 1 /* I = 0; BIT = 1<<WORDSIZE-1 */
mov zero, I
sll T_0, WORDSIZE-1, BIT
LBloop:
@@ -138,7 +139,7 @@ LBloop:
LAbits:
beq I, Ldodiv /* If I = 0, divide now. */
- CONST(1, T_0) /* BIT = 1<<WORDSIZE-1 */
+ ldiq T_0, 1 /* BIT = 1<<WORDSIZE-1 */
sll T_0, WORDSIZE-1, BIT
LAloop:
@@ -150,7 +151,7 @@ LAloop:
Ldodiv:
sll B, I, B /* B <<= i */
- CONST(1, T_0)
+ ldiq T_0, 1
sll T_0, I, BIT
Ldivloop:
@@ -187,7 +188,7 @@ ifelse(S, `true',
ret zero, (t9), 1
Ldotrap:
- CONST(-2, a0) /* This is the signal to SIGFPE! */
+ ldiq a0, -2 /* This is the signal to SIGFPE! */
call_pal PAL_gentrap
ifelse(OP, `div',
`', ` mov zero, A /* so that zero will be returned */
diff --git a/sys/lib/libkern/arch/alpha/ffs.S b/sys/lib/libkern/arch/alpha/ffs.S
new file mode 100644
index 00000000000..76e0e76ca7d
--- /dev/null
+++ b/sys/lib/libkern/arch/alpha/ffs.S
@@ -0,0 +1,92 @@
+/* $OpenBSD: ffs.S,v 1.1 1996/10/31 00:43:18 niklas Exp $ */
+/* $NetBSD: ffs.S,v 1.3 1996/10/17 04:26:26 cgd Exp $ */
+
+/*
+ * Copyright (c) 1995 Christopher G. Demetriou
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Christopher G. Demetriou
+ * for the NetBSD Project.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <machine/asm.h>
+
+LEAF(ffs, 1)
+ addl a0, 0, t0
+ beq t0, Lallzero
+
+ /*
+ * Initialize return value (v0), and set up t1 so that it
+ * contains the mask with only the lowest bit set.
+ */
+ subl zero, t0, t1
+ ldil v0, 1
+ and t0, t1, t1
+
+ and t1, 0xff, t2
+ bne t2, Ldo8
+
+ /*
+ * If lower 16 bits empty, add 16 to result and use upper 16.
+ */
+ zapnot t1, 0x03, t3
+ bne t3, Ldo16
+ sra t1, 16, t1
+ addl v0, 16, v0
+
+Ldo16:
+ /*
+ * If lower 8 bits empty, add 8 to result and use upper 8.
+ */
+ and t1, 0xff, t4
+ bne t4, Ldo8
+ sra t1, 8, t1
+ addl v0, 8, v0
+
+Ldo8:
+ and t1, 0x0f, t5 /* lower 4 of 8 empty? */
+ and t1, 0x33, t6 /* lower 2 of each 4 empty? */
+ and t1, 0x55, t7 /* lower 1 of each 2 empty? */
+
+ /* If lower 4 bits empty, add 4 to result. */
+ bne t5, Ldo4
+ addl v0, 4, v0
+
+Ldo4: /* If lower 2 bits of each 4 empty, add 2 to result. */
+ bne t6, Ldo2
+ addl v0, 2, v0
+
+Ldo2: /* If lower bit of each 2 empty, add 1 to result. */
+ bne t7, Ldone
+ addl v0, 1, v0
+
+Ldone:
+ RET
+
+Lallzero:
+ bis zero, zero, v0
+ RET
+END(ffs)
diff --git a/sys/lib/libkern/arch/alpha/htonl.S b/sys/lib/libkern/arch/alpha/htonl.S
index e1871e0d10e..bfa4d31d6c0 100644
--- a/sys/lib/libkern/arch/alpha/htonl.S
+++ b/sys/lib/libkern/arch/alpha/htonl.S
@@ -1,3 +1,4 @@
+/* $OpenBSD: htonl.S,v 1.2 1996/10/31 00:43:19 niklas Exp $ */
/* $NetBSD: htonl.S,v 1.1 1996/04/17 22:46:41 cgd Exp $ */
/*
diff --git a/sys/lib/libkern/arch/alpha/htons.S b/sys/lib/libkern/arch/alpha/htons.S
index 7ab417a7792..66ccd0cd684 100644
--- a/sys/lib/libkern/arch/alpha/htons.S
+++ b/sys/lib/libkern/arch/alpha/htons.S
@@ -1,3 +1,4 @@
+/* $OpenBSD: htons.S,v 1.2 1996/10/31 00:43:20 niklas Exp $ */
/* $NetBSD: htons.S,v 1.1 1996/04/17 22:46:43 cgd Exp $ */
/*
diff --git a/sys/lib/libkern/arch/alpha/ntohl.S b/sys/lib/libkern/arch/alpha/ntohl.S
index 9689ef135f5..5109d6d8a2e 100644
--- a/sys/lib/libkern/arch/alpha/ntohl.S
+++ b/sys/lib/libkern/arch/alpha/ntohl.S
@@ -1,3 +1,4 @@
+/* $OpenBSD: ntohl.S,v 1.2 1996/10/31 00:43:21 niklas Exp $ */
/* $NetBSD: ntohl.S,v 1.1 1996/04/17 22:46:45 cgd Exp $ */
/*
diff --git a/sys/lib/libkern/arch/alpha/ntohs.S b/sys/lib/libkern/arch/alpha/ntohs.S
index 13362133638..4e2213ba827 100644
--- a/sys/lib/libkern/arch/alpha/ntohs.S
+++ b/sys/lib/libkern/arch/alpha/ntohs.S
@@ -1,3 +1,4 @@
+/* $OpenBSD: ntohs.S,v 1.2 1996/10/31 00:43:22 niklas Exp $ */
/* $NetBSD: ntohs.S,v 1.1 1996/04/17 22:46:46 cgd Exp $ */
/*