summary refs log tree commit diff
path: root/sysdeps/vax
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/vax')
-rw-r--r--sysdeps/vax/DEFS.h61
-rw-r--r--sysdeps/vax/Dist1
-rw-r--r--sysdeps/vax/Makefile32
-rw-r--r--sysdeps/vax/__longjmp.c100
-rw-r--r--sysdeps/vax/bcmp.s57
-rw-r--r--sysdeps/vax/bcopy.s78
-rw-r--r--sysdeps/vax/bsd-_setjmp.S32
-rw-r--r--sysdeps/vax/bsd-setjmp.S32
-rw-r--r--sysdeps/vax/bzero.s53
-rw-r--r--sysdeps/vax/ffs.s48
-rw-r--r--sysdeps/vax/fl.h68
-rw-r--r--sysdeps/vax/htonl.s30
-rw-r--r--sysdeps/vax/htons.s30
-rw-r--r--sysdeps/vax/huge_val.h27
-rw-r--r--sysdeps/vax/index.s99
-rw-r--r--sysdeps/vax/infnan.c62
-rw-r--r--sysdeps/vax/jmp_buf.h7
-rw-r--r--sysdeps/vax/log10.c28
-rw-r--r--sysdeps/vax/memccpy.c45
-rw-r--r--sysdeps/vax/memchr.s73
-rw-r--r--sysdeps/vax/memcmp.s61
-rw-r--r--sysdeps/vax/memmove.s93
-rw-r--r--sysdeps/vax/memset.s55
-rw-r--r--sysdeps/vax/ntohl.s30
-rw-r--r--sysdeps/vax/ntohs.s30
-rw-r--r--sysdeps/vax/rindex.s113
-rw-r--r--sysdeps/vax/setjmp.c33
-rw-r--r--sysdeps/vax/strcat.s66
-rw-r--r--sysdeps/vax/strchr.s105
-rw-r--r--sysdeps/vax/strcpy.s62
-rw-r--r--sysdeps/vax/strcspn.s66
-rw-r--r--sysdeps/vax/strlen.s52
-rw-r--r--sysdeps/vax/strncat.s83
-rw-r--r--sysdeps/vax/strncmp.s89
-rw-r--r--sysdeps/vax/strncpy.s84
-rw-r--r--sysdeps/vax/strpbrk.s68
-rw-r--r--sysdeps/vax/strrchr.s114
-rw-r--r--sysdeps/vax/strsep.s85
-rw-r--r--sysdeps/vax/strspn.s70
-rw-r--r--sysdeps/vax/strstr.s113
40 files changed, 2435 insertions, 0 deletions
diff --git a/sysdeps/vax/DEFS.h b/sysdeps/vax/DEFS.h
new file mode 100644
index 0000000000..01f1f0cdd0
--- /dev/null
+++ b/sysdeps/vax/DEFS.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 1982, 1993
+ *	The Regents of the University of California.  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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ *
+ *	@(#)DEFS.h	8.1 (Berkeley) 6/4/93
+ */
+
+#define R0	0x001
+#define R1	0x002
+#define R2	0x004
+#define R3	0x008
+#define R4	0x010
+#define R5	0x020
+#define R6	0x040
+#define	R7 	0x080
+#define	R8	0x100
+#define	R9	0x200
+#define	R10	0x400
+#define	R11	0x800
+
+#ifdef PROF
+#define	ENTRY(x, regs) \
+	.globl _/**/x; .align 2; _/**/x: .word regs; \
+	.data; 1:; .long 0; .text; moval 1b,r0; jsb mcount
+#define	ASENTRY(x, regs) \
+	.globl x; .align 2; x: .word regs; \
+	.data; 1:; .long 0; .text; moval 1b,r0; jsb mcount
+#else
+#define	ENTRY(x, regs) \
+	.globl _/**/x; .align 2; _/**/x: .word regs
+#define	ASENTRY(x, regs) \
+	.globl x; .align 2; x: .word regs
+#endif
diff --git a/sysdeps/vax/Dist b/sysdeps/vax/Dist
new file mode 100644
index 0000000000..9830be29a4
--- /dev/null
+++ b/sysdeps/vax/Dist
@@ -0,0 +1 @@
+DEFS.h
diff --git a/sysdeps/vax/Makefile b/sysdeps/vax/Makefile
new file mode 100644
index 0000000000..a6149a9524
--- /dev/null
+++ b/sysdeps/vax/Makefile
@@ -0,0 +1,32 @@
+# Copyright (C) 1991, 1994 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Library General Public License for more details.
+
+# You should have received a copy of the GNU Library General Public
+# License along with the GNU C Library; see the file COPYING.LIB.  If
+# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+# Cambridge, MA 02139, USA.
+
+ifeq	($(subdir),math)
+ifndef	math-twiddled
+
+elided-routines := $(elided-routines) acos asin cos sin ceil rint hypot \
+		   __copysign __scalb __drem __logb __finite
+sysdep_routines := $(sysdep_routines) asincos sincos argred \
+		   support exp__E log__L
+
+math-twiddled := t
+endif
+
+bsdmath_dirs := $(bsdmath_dirs) vax
+
+endif
diff --git a/sysdeps/vax/__longjmp.c b/sysdeps/vax/__longjmp.c
new file mode 100644
index 0000000000..0ee040ab25
--- /dev/null
+++ b/sysdeps/vax/__longjmp.c
@@ -0,0 +1,100 @@
+/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc.
+   Derived from @(#)_setjmp.s	5.7 (Berkeley) 6/27/88,
+   Copyright (c) 1980 Regents of the University of California.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+#include <setjmp.h>
+
+#ifndef	__GNUC__
+  #error This file uses GNU C extensions; you must compile with GCC.
+#endif
+
+
+#define	REI	02	/* Vax `rei' opcode.  */
+
+/* Jump to the position specified by ENV, causing the
+   setjmp call there to return VAL, or 1 if VAL is 0.  */
+__NORETURN
+void
+DEFUN(__longjmp, (env, val), CONST __jmp_buf env AND int val)
+{
+  register long int *fp asm("fp");
+  long int *regsave;
+  unsigned long int flags;
+
+  if (env.__fp == NULL)
+    __libc_fatal("longjmp: Invalid ENV argument.\n");
+
+  if (val == 0)
+    val = 1;
+
+  asm volatile("loop:");
+
+  flags = *(long int *) (6 + (char *) fp);
+  regsave = (long int *) (20 + (char *) fp);
+  if (flags & 1)
+    /* R0 was saved by the caller.
+       Store VAL where it will be restored from.  */
+    *regsave++ = val;
+  if (flags & 2)
+    /* R1 was saved by the caller.
+       Store ENV where it will be restored from.  */
+    *regsave = env;
+
+  /* Was the FP saved in the last call the same one in ENV?  */
+  asm volatile("cmpl %0, 12(fp);"
+	       /* Yes, return to it.  */
+	       "beql done;"
+	       /* The FP in ENV is less than the one saved in the last call.
+		  This means we have already returned from the function that
+		  called `setjmp' with ENV!  */
+	       "blssu latejump;" : /* No outputs.  */ : "g" (env.__fp));
+
+  /* We are more than one level below the state in ENV.
+     Return to where we will pop another stack frame.  */
+  asm volatile("movl $loop, 16(fp);"
+	       "ret");
+
+  asm volatile("done:");
+  {
+    char return_insn asm("*16(fp)");
+    if (return_insn == REI)
+      /* We're returning with an `rei' instruction.
+	 Do a return with PSL-PC pop.  */
+      asm volatile("movab 0f, 16(fp)");
+    else
+      /* Do a standard return.  */
+      asm volatile("movab 1f, 16(fp)");
+
+    /* Return.  */
+    asm volatile("ret");
+  }
+
+  asm volatile("0:"	/* `rei' return.  */
+	       /* Compensate for PSL-PC push.  */
+	       "addl2 %0, sp;"
+	       "1:"	/* Standard return.  */
+	       /* Return to saved PC.  */
+	       "jmp %1" : /* No outputs.  */ :
+	       "g" (8), "g" (env.__pc));
+
+  /* Jump here when the FP saved in ENV points
+     to a function that has already returned.  */
+  asm volatile("latejump:");
+  __libc_fatal("longjmp: Attempt to jump to a function that has returned.\n");
+}
diff --git a/sysdeps/vax/bcmp.s b/sysdeps/vax/bcmp.s
new file mode 100644
index 0000000000..d980feb8e4
--- /dev/null
+++ b/sysdeps/vax/bcmp.s
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)bcmp.s	5.6 (Berkeley) 6/1/90"
+#endif /* LIBC_SCCS and not lint */
+
+/* bcmp(s1, s2, n) */
+
+#include "DEFS.h"
+
+ENTRY(bcmp, 0)
+	movl	4(ap),r1
+	movl	8(ap),r3
+	movl	12(ap),r4
+1:
+	movzwl	$65535,r0
+	cmpl	r4,r0
+	jleq	2f
+	subl2	r0,r4
+	cmpc3	r0,(r1),(r3)
+	jeql	1b
+	addl2	r4,r0
+	ret
+2:
+	cmpc3	r4,(r1),(r3)
+	ret
diff --git a/sysdeps/vax/bcopy.s b/sysdeps/vax/bcopy.s
new file mode 100644
index 0000000000..43bb93d216
--- /dev/null
+++ b/sysdeps/vax/bcopy.s
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)bcopy.s	5.6 (Berkeley) 6/1/90"
+#endif /* LIBC_SCCS and not lint */
+
+/* bcopy(from, to, size) */
+
+#include "DEFS.h"
+
+ENTRY(bcopy, R6)
+	movl	4(ap),r1
+	movl	8(ap),r3
+	movl	12(ap),r6
+	cmpl	r1,r3
+	bgtr	2f		# normal forward case
+	blss	3f		# overlapping, must do backwards
+	ret			# equal, nothing to do
+1:
+	subl2	r0,r6
+	movc3	r0,(r1),(r3)
+2:
+	movzwl	$65535,r0
+	cmpl	r6,r0
+	jgtr	1b
+	movc3	r6,(r1),(r3)
+	ret
+3:
+	addl2	r6,r1
+	addl2	r6,r3
+	movzwl	$65535,r0
+	jbr	5f
+4:
+	subl2	r0,r6
+	subl2	r0,r1
+	subl2	r0,r3
+	movc3	r0,(r1),(r3)
+	movzwl	$65535,r0
+	subl2	r0,r1
+	subl2	r0,r3
+5:
+	cmpl	r6,r0
+	jgtr	4b
+	subl2	r6,r1
+	subl2	r6,r3
+	movc3	r6,(r1),(r3)
+	ret
diff --git a/sysdeps/vax/bsd-_setjmp.S b/sysdeps/vax/bsd-_setjmp.S
new file mode 100644
index 0000000000..039fd71fdb
--- /dev/null
+++ b/sysdeps/vax/bsd-_setjmp.S
@@ -0,0 +1,32 @@
+/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  Vax version.
+Copyright (C) 1994 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
+   We cannot do it in C because it must be a tail-call, so frame-unwinding
+   in setjmp doesn't clobber the state restored by longjmp.  */
+
+#include <sysdep.h>
+
+ENTRY (setjmp)
+	popl r0			/* Pop return PC.  */
+	popl r1			/* Pop jmp_buf argument.  */
+	pushl $0		/* Push second argument of zero.  */
+	pushl r1		/* Push back first argument.  */
+	pushl r0		/* Push back return PC.  */
+	jmp C_SYMBOL_NAME (__sigsetjmp)
diff --git a/sysdeps/vax/bsd-setjmp.S b/sysdeps/vax/bsd-setjmp.S
new file mode 100644
index 0000000000..379a65c0e5
--- /dev/null
+++ b/sysdeps/vax/bsd-setjmp.S
@@ -0,0 +1,32 @@
+/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'.  Vax version.
+Copyright (C) 1994 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
+   We cannot do it in C because it must be a tail-call, so frame-unwinding
+   in setjmp doesn't clobber the state restored by longjmp.  */
+
+#include <sysdep.h>
+
+ENTRY (setjmp)
+	popl r0			/* Pop return PC.  */
+	popl r1			/* Pop jmp_buf argument.  */
+	pushl $1		/* Push second argument of one.  */
+	pushl r1		/* Push back first argument.  */
+	pushl r0		/* Push back return PC.  */
+	jmp C_SYMBOL_NAME (__sigsetjmp)
diff --git a/sysdeps/vax/bzero.s b/sysdeps/vax/bzero.s
new file mode 100644
index 0000000000..5f90763d41
--- /dev/null
+++ b/sysdeps/vax/bzero.s
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)bzero.s	5.6 (Berkeley) 6/1/90"
+#endif /* LIBC_SCCS and not lint */
+
+/* bzero(base, length) */
+
+#include "DEFS.h"
+
+ENTRY(bzero, 0)
+	movl	4(ap),r3
+	jbr	2f
+1:
+	subl2	r0,8(ap)
+	movc5	$0,(r3),$0,r0,(r3)
+2:
+	movzwl	$65535,r0
+	cmpl	8(ap),r0
+	jgtr	1b
+	movc5	$0,(r3),$0,8(ap),(r3)
+	ret
diff --git a/sysdeps/vax/ffs.s b/sysdeps/vax/ffs.s
new file mode 100644
index 0000000000..49faffb060
--- /dev/null
+++ b/sysdeps/vax/ffs.s
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)ffs.s	5.6 (Berkeley) 6/1/90"
+#endif /* LIBC_SCCS and not lint */
+
+/* bit = ffs(value) */
+
+#include "DEFS.h"
+
+ENTRY(ffs, 0)
+	ffs	$0,$32,4(ap),r0
+	bneq	1f
+	mnegl	$1,r0
+1:
+	incl	r0
+	ret
diff --git a/sysdeps/vax/fl.h b/sysdeps/vax/fl.h
new file mode 100644
index 0000000000..49e745697a
--- /dev/null
+++ b/sysdeps/vax/fl.h
@@ -0,0 +1,68 @@
+/* Copyright (C) 1991 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#ifndef	__need_HUGE_VAL
+
+/* Floating-point constants for Vaxen.  */
+
+#define	FLT_RADIX	2
+
+#define	FLT_ROUNDS	_FLT_ROUNDS_TONEAREST
+
+#define	FLT_MANT_DIG	23
+#define	DBL_MANT_DIG	55
+#define	LDBL_MANT_DIG	55
+
+#define	FLT_DIG		6
+#define	DBL_DIG		16
+#define	LDBL_DIG	16
+
+#define	FLT_MIN_EXP	(-128)
+#define	DBL_MIN_EXP	(-128)
+#define	LDBL_MIN_EXP	(-128)
+
+#define	FLT_MIN_10_EXP	(-38)
+#define	DBL_MIN_10_EXP	(-38)
+#define	LDBL_MIN_10_EXP	(-38)
+
+#define	FLT_MAX_EXP	127
+#define	DBL_MAX_EXP	127
+#define	LDBL_MAX_EXP	127
+
+#define	FLT_MAX_10_EXP	38
+#define	DBL_MAX_10_EXP	38
+#define	LDBL_MAX_10_EXP	38
+
+#define	FLT_MAX		1.7014116e38
+#define	DBL_MAX		1.70141182460469227e38
+#define	LDBL_MAX	DBL_MAX
+
+#define	FLT_EPSILON	2.384186e-7
+#define	DBL_EPSILON	5.55111512312578270e-17
+#define	LDBL_EPSILON	DBL_EPSILON
+
+#define	FLT_MIN		0.2938736e-38
+#define	DBL_MIN		0.29387358770557187e-38
+#define	LDBL_MIN	DBL_MIN
+
+#else	/* Need HUGE_VAL.  */
+
+/* Used by <stdlib.h> and <math.h> functions for overflow.	*/
+#define	HUGE_VAL	1.70141182460469227e38
+
+#endif	/* Don't need HUGE_VAL.  */
diff --git a/sysdeps/vax/htonl.s b/sysdeps/vax/htonl.s
new file mode 100644
index 0000000000..af5b96c22f
--- /dev/null
+++ b/sysdeps/vax/htonl.s
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)htonl.s	5.5 (Berkeley) 6/27/88"
+#endif /* LIBC_SCCS and not lint */
+
+/* netorder = htonl(hostorder) */
+
+#include "DEFS.h"
+
+ENTRY(htonl, 0)
+	rotl	$-8,4(ap),r0
+	insv	r0,$16,$8,r0
+	movb	7(ap),r0
+	ret
diff --git a/sysdeps/vax/htons.s b/sysdeps/vax/htons.s
new file mode 100644
index 0000000000..c500e84506
--- /dev/null
+++ b/sysdeps/vax/htons.s
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)htons.s	5.5 (Berkeley) 6/27/88"
+#endif /* LIBC_SCCS and not lint */
+
+/* hostorder = htons(netorder) */
+
+#include "DEFS.h"
+
+ENTRY(htons, 0)
+	rotl	$8,4(ap),r0
+	movb	5(ap),r0
+	movzwl	r0,r0
+	ret
diff --git a/sysdeps/vax/huge_val.h b/sysdeps/vax/huge_val.h
new file mode 100644
index 0000000000..58f5415446
--- /dev/null
+++ b/sysdeps/vax/huge_val.h
@@ -0,0 +1,27 @@
+/* `HUGE_VAL' constant for Vaxen.
+   Used by <stdlib.h> and <math.h> functions for overflow.
+
+Copyright (C) 1992 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#ifndef	   _HUGE_VAL_H
+#define	   _HUGE_VAL_H	1
+
+#define	   HUGE_VAL	1.70141182460469227e38
+
+#endif	   /* huge_val.h */
diff --git a/sysdeps/vax/index.s b/sysdeps/vax/index.s
new file mode 100644
index 0000000000..e599b276f0
--- /dev/null
+++ b/sysdeps/vax/index.s
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)index.s	5.6 (Berkeley) 6/1/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Find the first occurence of c in the string cp.
+ * Return pointer to match or null pointer.
+ *
+ * char *
+ * index(cp, c)
+ *	char *cp, c;
+ */
+#include "DEFS.h"
+
+ENTRY(index, 0)
+	movq	4(ap),r1	# r1 = cp; r2 = c
+	tstl	r2		# check for special case c == '\0'
+	bneq	2f
+1:
+	locc	$0,$65535,(r1)	# just find end of string
+	beql	1b		# still looking
+	movl	r1,r0		# found it
+	ret
+2:
+	moval	tbl,r3		# r3 = address of table
+	bbss	$0,(r3),5f	# insure not reentering
+	movab	(r3)[r2],r5	# table entry for c
+	incb	(r5)
+	movzwl	$65535,r4	# fast access
+3:
+	scanc	r4,(r1),(r3),$1	# look for c or '\0'
+	beql	3b		# still looking
+	movl	r1,r0		# return pointer to char
+	tstb	(r0)		#    if have found '\0'
+	bneq	4f
+	clrl	r0		# else return 0
+4:
+	clrb	(r5)		# clean up table
+	clrb	(r3)
+	ret
+
+	.data
+tbl:	.space	256
+	.text
+
+/*
+ * Reentrant, but slower version of index
+ */
+5:
+	movl	r1,r3
+6:
+	locc	$0,$65535,(r3)	# look for '\0'
+	bneq	7f
+	locc	r2,$65535,(r3)	# look for c
+	bneq	8f
+	movl	r1,r3		# reset pointer and ...
+	jbr	6b		# ... try again
+7:
+	subl3	r3,r1,r4	# length of short block
+	incl	r4		# +1 for '\0'
+	locc	r2,r4,(r3)	# look for c
+	bneq	8f
+	ret
+8:
+	movl	r1,r0		# return pointer to char
+	ret
diff --git a/sysdeps/vax/infnan.c b/sysdeps/vax/infnan.c
new file mode 100644
index 0000000000..62ec9dca0f
--- /dev/null
+++ b/sysdeps/vax/infnan.c
@@ -0,0 +1,62 @@
+/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#ifndef	__GNUC__
+  #error This file uses GNU C extensions; you must compile with GCC.
+#else
+
+#include <ansidecl.h>
+#include <errno.h>
+#include <math.h>
+
+/* Deal with an infinite or NaN result.
+   If ERROR is ERANGE, result is +Inf;
+   if ERROR is - ERANGE, result is -Inf;
+   otherwise result is NaN.
+   This will set `errno' to either ERANGE or EDOM,
+   and may return an infinity or NaN, or may do something else.  */
+double
+DEFUN(__infnan, (error), int error)
+{
+  switch (error)
+    {
+    case ERANGE:
+      errno = ERANGE;
+      break;
+
+    case - ERANGE:
+      errno = ERANGE;
+      break;
+
+    default:
+      errno = EDOM;
+      break;
+    }
+
+  /* Trigger a reserved operand fault.  */
+  {
+    double result;
+    asm volatile("emodd %1, %1, %2, %0, %0" : "=r" (result) :
+		 "i" (0), "i" (0x8000));
+    return result;
+  }
+}
+
+#endif
+
+weak_alias (__infnan, infnan)
diff --git a/sysdeps/vax/jmp_buf.h b/sysdeps/vax/jmp_buf.h
new file mode 100644
index 0000000000..7adecd9a17
--- /dev/null
+++ b/sysdeps/vax/jmp_buf.h
@@ -0,0 +1,7 @@
+/* Define the machine-dependent type `jmp_buf'.  Vax version.  */
+
+typedef struct
+  {
+    PTR __fp;
+    PTR __pc;
+  } __jmp_buf[1];
diff --git a/sysdeps/vax/log10.c b/sysdeps/vax/log10.c
new file mode 100644
index 0000000000..08741779eb
--- /dev/null
+++ b/sysdeps/vax/log10.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1991 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+
+#ifndef	FPCONST
+#define	FPCONST(hi0, lo0, hi1, lo1)	{ (lo0), (hi0), (lo1), (hi1) }
+#endif
+
+static CONST short int ln10[] = FPCONST(0x4113, 0x5d8d, 0xddaa, 0xa8ac);
+#define	LN10	(*(CONST double *) ln10)
+
+#include <../sysdeps/generic/log10.c>
diff --git a/sysdeps/vax/memccpy.c b/sysdeps/vax/memccpy.c
new file mode 100644
index 0000000000..9849761f13
--- /dev/null
+++ b/sysdeps/vax/memccpy.c
@@ -0,0 +1,45 @@
+/* Copyright (C) 1991, 1992, 1995 Free Software Foundation, Inc.
+This file is part of the GNU C Library.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <ansidecl.h>
+#include <string.h>
+
+
+/* Copy no more than N bytes of SRC to DEST, stopping when C is found.
+   Return the position in DEST one byte past where C was copied,
+   or NULL if C was not found in the first N bytes of SRC.  */
+PTR
+DEFUN(__memccpy, (dest, src, c, n),
+      PTR dest AND CONST PTR src AND int c AND size_t nbytes)
+{
+  /* Except when N > 65535, this is what a hand-coded version would
+     do anyway.  */
+
+  PTR found = memchr (src, c, n);
+
+  if (found == NULL)
+    {
+      (void) memcpy (dest, src, n);
+      return NULL;
+    }
+
+  (void) memcpy (dest, src, (char *) found + 1 - (char *) src);
+  return (PTR) ((char *) dest + ((char *) found + 1 - (char *) src));
+}
+
+weak_alias (__memccpy, memccpy)
diff --git a/sysdeps/vax/memchr.s b/sysdeps/vax/memchr.s
new file mode 100644
index 0000000000..c7793fb5f8
--- /dev/null
+++ b/sysdeps/vax/memchr.s
@@ -0,0 +1,73 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)memchr.s	5.1 (Berkeley) 5/29/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Find the first occurence of c in the memory at cp (length n).
+ * Return pointer to match or null pointer.
+ *
+ * This code optimises the usual case (0 < n < 65535).
+ *
+ * void *
+ * memchr(cp, c, n)
+ *	char *cp, c;
+ *	size_t n;
+ */
+
+#include "DEFS.h"
+
+ENTRY(memchr, 0)
+	movq	4(ap),r1	# r1 = cp; r2 = c
+	movl	12(ap),r0	# r0 = n
+	movzwl	$65535,r4	# handy constant
+0:
+	cmpl	r0,r4		# check for annoying locc limit
+	bgtru	3f
+
+	/* n <= 65535 */
+	locc	r2,r0,(r1)	# search n bytes for c
+	beql	2f		# done if not found (r0 already 0)
+1:	/* found character c at (r1) */
+	movl	r1,r0
+2:
+	ret
+
+3:	/* n > 65535 */
+	locc	r2,r4,(r1)	# search 65535 bytes for c
+	beql	1b		# done if found
+	decw	r0		# from 0 to 65535
+	subl2	r0,r4		# adjust n
+	brb	0b		# and loop
diff --git a/sysdeps/vax/memcmp.s b/sysdeps/vax/memcmp.s
new file mode 100644
index 0000000000..3854fd8e4a
--- /dev/null
+++ b/sysdeps/vax/memcmp.s
@@ -0,0 +1,61 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)memcmp.s	5.1 (Berkeley) 5/15/90"
+#endif /* LIBC_SCCS and not lint */
+
+/* int memcmp(s1, s2, n) */
+
+#include "DEFS.h"
+
+ENTRY(memcmp, 0)
+	movl	4(ap),r1	/* r1 = s1 */
+	movq	8(ap),r3	/* r3 = s2; r4 = n */
+	movzwl	$65535,r5
+0:
+	cmpl	r4,r5
+	jgtru	3f		/* handle stupid cmpc3 limitation */
+	cmpc3	r4,(r1),(r3)	/* compare */
+	beql	2f		/* done if same (r0 = 0) */
+1:
+	movzbl	(r1),r0
+	movzbl	(r3),r2
+	subl2	r2,r0		/* return *s1 - *s2; s1,s2 unsigned chars */
+2:
+	ret
+3:
+	subl2	r5,r4		/* do 64K; adjust count */
+	cmpc3	r5,(r1),(r3)
+	jeql	0b		/* loop if same */
+	jbr	1b
diff --git a/sysdeps/vax/memmove.s b/sysdeps/vax/memmove.s
new file mode 100644
index 0000000000..8f897fa3f4
--- /dev/null
+++ b/sysdeps/vax/memmove.s
@@ -0,0 +1,93 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)memmove.s	5.1 (Berkeley) 5/15/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * void *memmove(dst, src, size)
+ * returns dst
+ *
+ * This optimises the usual case (count < 65536) at the expense
+ * of some extra memory references and branches when count >= 65536.
+ */
+
+#include "DEFS.h"
+
+ENTRY(memmove, 0)
+	movzwl	$65535,r0	/* r0 = 64K (needed below) */
+	movq	8(ap),r1	/* r1 = src, r2 = length */
+	movl	4(ap),r3	/* r3 = dst */
+	cmpl	r1,r3
+	bgtru	1f		/* normal forward case */
+	beql	2f		/* equal, nothing to do */
+	addl2	r2,r1		/* overlaps iff src<dst but src+len>dst */
+	cmpl	r1,r3
+	bgtru	4f		/* overlapping, must move backwards */
+	subl2	r2,r1
+
+1:	/* move forward */
+	cmpl	r2,r0
+	bgtru	3f		/* stupid movc3 limitation */
+	movc3	r2,(r1),(r3)	/* move it all */
+2:
+	movl	4(ap),r0	/* return original dst */
+	ret
+3:
+	subl2	r0,12(ap)	/* adjust length by 64K */
+	movc3	r0,(r1),(r3)	/* move 64K */
+	movl	12(ap),r2
+	decw	r0		/* from 0 to 65535 */
+	brb	1b		/* retry */
+
+4:	/* move backward */
+	addl2	r2,r3
+5:
+	cmpl	r2,r0
+	bgtru	6f		/* stupid movc3 limitation */
+	subl2	r2,r1
+	subl2	r2,r3
+	movc3	r2,(r1),(r3)	/* move it all */
+	movl	4(ap),r0	/* return original dst */
+	ret
+6:
+	subl2	r0,12(ap)	/* adjust length by 64K */
+	subl2	r0,r1
+	subl2	r0,r3
+	movc3	r0,(r1),(r3)	/* move 64K */
+	movl	12(ap),r2
+	decw	r0
+	subl2	r0,r1
+	subl2	r0,r3
+	brb	5b
diff --git a/sysdeps/vax/memset.s b/sysdeps/vax/memset.s
new file mode 100644
index 0000000000..12b1f74fe3
--- /dev/null
+++ b/sysdeps/vax/memset.s
@@ -0,0 +1,55 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)memset.s	5.2 (Berkeley) 5/12/91"
+#endif /* LIBC_SCCS and not lint */
+
+/* void *memset(base, c, length) */
+
+#include "DEFS.h"
+
+ENTRY(memset, 0)
+	movl	4(ap),r3
+1:
+	movzwl	$65535,r0
+	movq	8(ap),r1
+	cmpl	r2,r0
+	jgtru	2f
+	movc5	$0,(r3),r1,r2,(r3)
+	movl	r1,r0
+	ret
+2:
+	subl2	r0,12(ap)
+	movc5	$0,(r3),r1,r0,(r3)
+	jbr	1b
diff --git a/sysdeps/vax/ntohl.s b/sysdeps/vax/ntohl.s
new file mode 100644
index 0000000000..0fcaa2f8e4
--- /dev/null
+++ b/sysdeps/vax/ntohl.s
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)ntohl.s	5.5 (Berkeley) 6/27/88"
+#endif /* LIBC_SCCS and not lint */
+
+/* hostorder = ntohl(netorder) */
+
+#include "DEFS.h"
+
+ENTRY(ntohl, 0)
+	rotl	$-8,4(ap),r0
+	insv	r0,$16,$8,r0
+	movb	7(ap),r0
+	ret
diff --git a/sysdeps/vax/ntohs.s b/sysdeps/vax/ntohs.s
new file mode 100644
index 0000000000..626a37bf09
--- /dev/null
+++ b/sysdeps/vax/ntohs.s
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)ntohs.s	5.5 (Berkeley) 6/27/88"
+#endif /* LIBC_SCCS and not lint */
+
+/* hostorder = ntohs(netorder) */
+
+#include "DEFS.h"
+
+ENTRY(ntohs, 0)
+	rotl	$8,4(ap),r0
+	movb	5(ap),r0
+	movzwl	r0,r0
+	ret
diff --git a/sysdeps/vax/rindex.s b/sysdeps/vax/rindex.s
new file mode 100644
index 0000000000..76d7e29597
--- /dev/null
+++ b/sysdeps/vax/rindex.s
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)rindex.s	5.6 (Berkeley) 6/1/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Find the last occurence of c in the string cp.
+ * Return pointer to match or null pointer.
+ *
+ * char *
+ * rindex(cp, c)
+ *	char *cp, c;
+ */
+#include "DEFS.h"
+
+ENTRY(rindex, 0)
+	movq	4(ap),r1	# r1 = cp; r2 = c
+	tstl	r2		# check for special case c == '\0'
+	bneq	2f
+1:
+	locc	$0,$65535,(r1)	# just find end of string
+	beql	1b		# still looking
+	movl	r1,r0		# found it
+	ret
+2:
+	moval	tbl,r3		# r3 = address of table
+	bbss	$0,(r3),5f	# insure not reentering
+	movab	(r3)[r2],r5	# table entry for c
+	incb	(r5)
+	clrl	r4		# last found
+3:
+	scanc	$65535,(r1),(r3),$1	# look for c or '\0'
+	beql	3b		# keep looking
+	tstb	(r1)		# if have found '\0'
+	beql	4f		#    we are done
+	movl	r1,r4		# save most recently found
+	incl	r1		# skip over character
+	jbr	3b		# keep looking
+4:
+	movl	r4,r0		# return last found (if any)
+	clrb	(r5)		# clean up table
+	clrb	(r3)
+	ret
+
+	.data
+tbl:	.space	256
+	.text
+
+/*
+ * Reentrant, but slower version of rindex
+ */
+5:
+	movl	r1,r3
+	clrl	r4		# r4 = pointer to last match
+6:
+	locc	$0,$65535,(r3)	# look for '\0'
+	bneq	8f
+	decw	r0		# r0 = 65535
+1:
+	locc	r2,r0,(r3)	# look for c
+	bneq	7f
+	movl	r1,r3		# reset pointer and ...
+	jbr	6b		# ... try again
+7:
+	movl	r1,r4		# stash pointer ...
+	addl3	$1,r1,r3	# ... skip over match and ...
+	decl	r0		# ... decrement count
+	jbr	6b		# ... try again
+8:
+	subl3	r3,r1,r0	# length of short block
+	incl	r0		# +1 for '\0'
+9:
+	locc	r2,r0,(r3)	# look for c
+	beql	0f
+	movl	r1,r4		# stash pointer ...
+	addl3	$1,r1,r3	# ... skip over match ...
+	decl	r0		# ... adjust count and ...
+	jbr	9b		# ... try again
+0:
+	movl	r4,r0		# return stashed pointer
+	ret
diff --git a/sysdeps/vax/setjmp.c b/sysdeps/vax/setjmp.c
new file mode 100644
index 0000000000..9d711cbfda
--- /dev/null
+++ b/sysdeps/vax/setjmp.c
@@ -0,0 +1,33 @@
+/* Copyright (C) 1991, 1992, 1994 Free Software Foundation, Inc.
+   Derived from @(#)_setjmp.s	5.7 (Berkeley) 6/27/88,
+   Copyright (c) 1980 Regents of the University of California.
+
+The GNU C Library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public License as
+published by the Free Software Foundation; either version 2 of the
+License, or (at your option) any later version.
+
+The GNU C Library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with the GNU C Library; see the file COPYING.LIB.  If
+not, write to the Free Software Foundation, Inc., 675 Mass Ave,
+Cambridge, MA 02139, USA.  */
+
+#include <setjmp.h>
+
+
+/* Save the current program position in ENV and return 0.  */
+int
+__sigsetjmp (jmp_buf env, int savemask)
+{
+  /* Save our caller's FP and PC.  */
+  asm ("movl 12(fp), %0" : "=g" (env[0].__jmpbuf[0].__fp));
+  asm ("movl 16(fp), %0" : "=g" (env[0].__jmpbuf[0].__pc));
+
+  /* Save the signal mask if requested.  */
+  return __sigjmp_save (env, savemask);
+}
diff --git a/sysdeps/vax/strcat.s b/sysdeps/vax/strcat.s
new file mode 100644
index 0000000000..7cf8884204
--- /dev/null
+++ b/sysdeps/vax/strcat.s
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)strcat.s	5.6 (Berkeley) 6/1/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Concatenate string s2 to the end of s1
+ * and return the base of s1.
+ *
+ * char *
+ * strcat(s1, s2)
+ *	char *s1, *s2;
+ */
+#include "DEFS.h"
+
+ENTRY(strcat, R6|R7)
+	movq	4(ap), r6	# r6 = s1; r7 = s2
+	movl	r6,r1
+0:
+	locc	$0,$65535,(r1)	# look for '\0'
+	beql	0b
+	movl	r1,r3		# save end of s1
+1:
+	locc	$0,$65535,(r7)	# find length of s2
+	bneq	2f
+	movc3	$65535,(r7),(r3)# copy full block
+	movl	r1,r7
+	jbr	1b
+2:
+	subl2	r7,r1		# calculate length
+	incl	r1
+	movc3	r1,(r7),(r3)	# copy remainder
+	movl	r6,r0
+	ret
diff --git a/sysdeps/vax/strchr.s b/sysdeps/vax/strchr.s
new file mode 100644
index 0000000000..18b53838ec
--- /dev/null
+++ b/sysdeps/vax/strchr.s
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 1988 Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)strchr.s	5.4 (Berkeley) 6/1/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Find the first occurence of c in the string cp.
+ * Return pointer to match or null pointer.
+ *
+ * char *
+ * strchr(cp, c)
+ *	char *cp, c;
+ */
+#include "DEFS.h"
+
+	.lcomm	tbl,256
+
+ENTRY(strchr, 0)
+	movzwl	$65535,r4	/* handy constant */
+	movq	4(ap),r1	/* r1 = cp; r2 = c */
+	movzbl	r2,r2
+	beql	Lzero		/* special case for c == '\0' */
+
+/*
+ * Fancy scanc version.  Alas, it is not reentrant.
+ */
+	movab	tbl,r3		/* r3 = base of table */
+	bbss	$0,(r3),Lreent	/* ensure not reentering */
+	movab	(r3)[r2],r5	
+	incb	(r5)		/* mark both '\0' and c */
+0:
+	scanc	r4,(r1),(r3),$1	/* look for c or '\0' */
+	beql	0b		/* still looking */
+	movl	r1,r0		/* return whatever we found */
+	tstb	(r0)
+	bneq	1f		#	unless it was '\0':
+	clrl	r0		#	then return NULL
+1:
+	clrb	(r5)		/* clean up table */
+	clrb	(r3)
+	ret
+
+/*
+ * Special case for \0.
+ */
+Lzero:
+	locc	r2,r4,(r1)	/* just find end of string */
+	beql	Lzero		/* still looking */
+	movl	r1,r0		/* found it */
+	ret
+
+/*
+ * Slower reentrant version is two two-step searches.  The first
+ * phase runs until we know where the string ends; it locates the
+ * first occurrence of c within a 65535-byte block.  If we find
+ * the end of the string first, we switch to the second phase,
+ * were we look only up to the known end of string.
+ */
+Lreent:
+0:	/* first phase */
+	movl	r1,r3
+	locc	$0,r4,(r3)	/* look for '\0' */
+	bneq	1f
+	locc	r2,r4,(r3)	/* look for c */
+	beql	0b		/* not found: reset pointer and loop */
+	movl	r1,r0		/* found: return it */
+	ret
+1:	/* second phase */
+	subl3	r3,r1,r0	/* length of short block */
+	locc	r2,r0,(r3)	/* look for c */
+	beql	2f		/* not found: return NULL */
+	movl	r1,r0
+2:	ret
diff --git a/sysdeps/vax/strcpy.s b/sysdeps/vax/strcpy.s
new file mode 100644
index 0000000000..56dbe5741c
--- /dev/null
+++ b/sysdeps/vax/strcpy.s
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)strcpy.s	5.6 (Berkeley) 6/1/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Copy string s2 over top of s1.
+ * Return base of s1.
+ *
+ * char *
+ * strcpy(s1, s2)
+ *	char *s1, *s2;
+ */
+#include "DEFS.h"
+
+ENTRY(strcpy, R6)
+	movl	4(ap), r3	# r3 = s1
+	movl	8(ap), r6	# r6 = s2
+1:
+	locc	$0,$65535,(r6)	# find length of s2
+	bneq	2f
+	movc3	$65535,(r6),(r3)# copy full block
+	movl	r1,r6
+	jbr	1b
+2:
+	subl2	r6,r1		# calculate length
+	incl	r1
+	movc3	r1,(r6),(r3)	# copy remainder
+	movl	4(ap),r0	# return base of s1
+	ret
diff --git a/sysdeps/vax/strcspn.s b/sysdeps/vax/strcspn.s
new file mode 100644
index 0000000000..f7b0a99792
--- /dev/null
+++ b/sysdeps/vax/strcspn.s
@@ -0,0 +1,66 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)strcspn.s	5.1 (Berkeley) 5/15/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Span the complement of string s2 (skip characters that are not in s2).
+ * Return the number of characters in s1 that were skipped.
+ *
+ * size_t
+ * strcspn(s1, s2)
+ *	const char *s1, *s2;
+ */
+#include "DEFS.h"
+
+ENTRY(strcspn, 0)
+	subl2	$32,sp		/* make 256 bit table */
+	movc5	$0,(sp),$0,$32,(sp)
+	movq	4(ap),r1	/* r1 = s1, r2 = s2 */
+
+	/* turn on bit for each character in s2, including '\0' */
+1:
+	movzbl	(r2)+,r0
+	bbss	r0,(sp),1b
+	bneq	1b
+	movl	r1,r0		/* r0 = s (current pos in s1) */
+
+	/* look for a character that is in s2 */
+2:
+	movzbl	(r0)+,r2	/* c = *s++ */
+	bbc	r2,(sp),2b	/* loop until c is in table */
+	decl	r0		/* s-- */
+	subl2	r1,r0		/* r0 = s - s1 = count */
+	ret
diff --git a/sysdeps/vax/strlen.s b/sysdeps/vax/strlen.s
new file mode 100644
index 0000000000..2b7e0a7ef4
--- /dev/null
+++ b/sysdeps/vax/strlen.s
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)strlen.s	5.6 (Berkeley) 6/1/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Return the length of cp (not counting '\0').
+ *
+ * strlen(cp)
+ *	char *cp;
+ */
+#include "DEFS.h"
+
+ENTRY(strlen, 0)
+	movl	4(ap),r1
+1:
+	locc	$0,$65535,(r1)	# look for '\0'
+	beql	1b
+	subl3	4(ap),r1,r0	# len = cp - base
+	ret
diff --git a/sysdeps/vax/strncat.s b/sysdeps/vax/strncat.s
new file mode 100644
index 0000000000..bcf29c16c7
--- /dev/null
+++ b/sysdeps/vax/strncat.s
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)strncat.s	5.6 (Berkeley) 6/1/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Concatenate string s2 on the end of s1
+ * and return the base of s1.  The parameter
+ * n is the maximum length of string s2 to
+ * concatenate.
+ *
+ * char *
+ * strncat(s1, s2, n)
+ *	char *s1, *s2;
+ *	int n;
+ */
+#include "DEFS.h"
+
+ENTRY(strncat, R6)
+	movl	12(ap),r6	# r6 = n
+	bleq	done		# n <= 0
+	movl	4(ap),r3	# r3 = s1
+	movl	r3,r1
+0:
+	locc	$0,$65535,(r1)
+	beql	0b
+	movl	r1,r3		# r3 = index(s1, '\0');
+	movl	8(ap),r1	# r1 = s2
+1:
+	movzwl	$65535,r2	# r2 = bytes in first chunk
+	cmpl	r6,r2		# r2 = min(bytes in chunk, n);
+	jgeq	2f
+	movl	r6,r2
+2:
+	subl2	r2,r6		# update n
+	locc	$0,r2,(r1)	# '\0' found?
+	jneq	3f
+	subl2	r2,r1		# back up pointer updated by locc
+	movc3	r2,(r1),(r3)	# copy in next piece
+	tstl	r6		# run out of space?
+	jneq	1b
+	clrb	(r3)		# force '\0' termination
+	jbr	done
+3:
+	subl2	r0,r2		# r2 = number of bytes to move
+	subl2	r2,r1		# back up pointer updated by locc
+	incl	r2		# copy '\0' as well
+	movc3	r2,(r1),(r3)	# copy in last piece
+done:
+	movl	4(ap),r0	# return s1
+	ret
diff --git a/sysdeps/vax/strncmp.s b/sysdeps/vax/strncmp.s
new file mode 100644
index 0000000000..e5bfcf2a73
--- /dev/null
+++ b/sysdeps/vax/strncmp.s
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)strncmp.s	5.6 (Berkeley) 6/1/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Compare at most n characters of string
+ * s1 lexicographically to string s2.
+ * Return:
+ *	0	s1 == s2
+ *	> 0	s1 > s2
+ *	< 0	s2 < s2
+ *
+ * strncmp(s1, s2, n)
+ *	char *s1, *s2;
+ *	int n;
+ */
+#include "DEFS.h"
+
+ENTRY(strncmp, 0)
+	movl	4(ap),r1	# r1 = s1
+	movq	8(ap),r3	# r3 = s2; r4 = n
+1:
+	clrl	r5		# calculate min bytes to next page boundry
+	subb3	r1,$255,r5	# r5 = (bytes - 1) to end of page for s1
+	subb3	r3,$255,r0	# r0 = (bytes - 1) to end of page for s2
+	cmpb	r0,r5		# r5 = min(r0, r5);
+	bgtru	2f
+	movb	r0,r5
+2:
+	incl	r5		# r5 = min bytes to next page boundry
+	cmpl	r4,r5		# r5 = min(n, r5);
+	bgeq	3f
+	movl	r4,r5
+3:
+	cmpc3	r5,(r1),(r3)	# compare strings
+	bneq	4f
+	subl2	r5,r4		# check for end of comparison
+	beql	5f
+	subl2	r5,r1		# check if found null yet
+	locc	$0,r5,(r1)
+	beql	1b		# not yet done, continue checking
+	subl2	r0,r3
+	mnegb	(r3),r0		# r0 = '\0' - *s2
+	cvtbl	r0,r0
+	ret
+4:
+	subl2	r0,r5		# check for null in matching string
+	subl2	r5,r1
+	locc	$0,r5,(r1)
+	bneq	5f
+	subb3	(r3),(r1),r0	# r0 = *s1 - *s2
+	cvtbl	r0,r0
+	ret
+5:
+	clrl	r0		# both the same to null
+	ret
diff --git a/sysdeps/vax/strncpy.s b/sysdeps/vax/strncpy.s
new file mode 100644
index 0000000000..03a09b7bda
--- /dev/null
+++ b/sysdeps/vax/strncpy.s
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1983 Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)strncpy.s	5.6 (Berkeley) 6/1/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Copy string s2 over top of string s1.
+ * Truncate or null-pad to n bytes.
+ *
+ * char *
+ * strncpy(s1, s2, n)
+ *	char *s1, *s2;
+ */
+#include "DEFS.h"
+
+ENTRY(strncpy, R6)
+	movl	12(ap),r6	# r6 = n
+	bleq	done		# n <= 0
+	movl	4(ap),r3	# r3 = s1
+	movl	8(ap),r1	# r1 = s2
+1:
+	movzwl	$65535,r2	# r2 = bytes in first chunk
+	cmpl	r6,r2		# r2 = min(bytes in chunk, n);
+	jgeq	2f
+	movl	r6,r2
+2:
+	subl2	r2,r6		# update n
+	locc	$0,r2,(r1)	# '\0' found?
+	jneq	3f
+	subl2	r2,r1		# back up pointer updated by locc
+	movc3	r2,(r1),(r3)	# copy in next piece
+	tstl	r6		# run out of space?
+	jneq	1b
+	jbr	done
+3:				# copy up to '\0' logic
+	addl2	r0,r6		# r6 = number of null-pad bytes
+	subl2	r0,r2		# r2 = number of bytes to move
+	subl2	r2,r1		# back up pointer updated by locc
+	movc3	r2,(r1),(r3)	# copy in last piece
+4:				# null-pad logic
+	movzwl	$65535,r2	# r2 = bytes in first chunk
+	cmpl	r6,r2		# r2 = min(bytes in chunk, n);
+	jgeq	5f
+	movl	r6,r2
+5:
+	subl2	r2,r6		# update n
+	movc5	$0,(r3),$0,r2,(r3)# pad with '\0's
+	tstl	r6		# finished padding?
+	jneq	4b
+done:
+	movl	4(ap),r0	# return s1
+	ret
diff --git a/sysdeps/vax/strpbrk.s b/sysdeps/vax/strpbrk.s
new file mode 100644
index 0000000000..0d1b25e22f
--- /dev/null
+++ b/sysdeps/vax/strpbrk.s
@@ -0,0 +1,68 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)strpbrk.s	5.1 (Berkeley) 5/15/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Find in s1 the first occurrence of any character from s2.
+ * If there are none, return NULL.
+ *
+ * char *
+ * strpbrk(s1, s2)
+ *	const char *s1, *s2;
+ */
+#include "DEFS.h"
+
+ENTRY(strpbrk, 0)
+	subl2	$32,sp		/* make 256 bit table */
+	movc5	$0,(sp),$0,$32,(sp)
+	movq	4(ap),r0	/* r0 = s1, r1 = s2 */
+
+	/* turn on bit for each character in s2, including '\0' */
+1:
+	movzbl	(r1)+,r2
+	bbss	r2,(sp),1b
+	bneq	1b
+
+	/* look for a character that is in s2 */
+2:
+	movzbl	(r0)+,r2	/* c = *s++ */
+	bbc	r2,(sp),2b	/* loop until c is in table */
+	beql	3f		/* if c==0, go return NULL */
+	decl	r0		/* s-- */
+	ret
+3:
+	clrl	r0
+	ret
diff --git a/sysdeps/vax/strrchr.s b/sysdeps/vax/strrchr.s
new file mode 100644
index 0000000000..f292eaceab
--- /dev/null
+++ b/sysdeps/vax/strrchr.s
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 1988 Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)strrchr.s	5.4 (Berkeley) 6/1/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Find the last occurence of c in the string cp.
+ * Return pointer to match or null pointer.
+ *
+ * char *
+ * strrchr(cp, c)
+ *	char *cp, c;
+ */
+#include "DEFS.h"
+
+	.lcomm	tbl,256
+
+ENTRY(strrchr, 0)
+	movzwl	$65535,r4	/* handy 65535 */
+	movq	4(ap),r1	/* r1 = cp; r2 = c */
+	movzbl	r2,r2
+	beql	Lzero		/* special case for c == '\0' */
+
+	clrl	r5		/* r5 = pointer to last match */
+
+/*
+ * Fancy scanc version.  Alas, it is not reentrant.
+ */
+	movab	tbl,r3		/* r3 = address of table */
+	bbss	$0,(r3),Lreent	/* ensure not reentering */
+	movab	(r3)[r2],r4
+	incb	(r4)		/* mark both '\0' and c */
+0:
+	scanc	$65535,(r1),(r3),$1	/* look for c or '\0' */
+	beql	0b		/* keep looking */
+	tstb	(r1)
+	beql	1f		/* done if '\0' */
+	movab	(r1)+,r5	/* save most recently found, and skip over it */
+	jbr	0b		/* keep looking */
+1:
+	movl	r5,r0		/* return last found (if any) */
+	clrb	(r4)		/* clean up table */
+	clrb	(r3)
+	ret
+
+/*
+ * Special case for \0.
+ */
+Lzero:
+	locc	$0,r4,(r1)	/* just find end of string */
+	beql	Lzero		/* still looking */
+	movl	r1,r0		/* found it */
+	ret
+
+/*
+ * Slower reentrant version is two two-step searches.  The first
+ * phase runs until we know where the string ends; it locates any
+ * occurrences of c within a 65535-byte block.  Once we have found
+ * the end of the string, we find any further occurrences before
+ * that location.
+ */
+Lreent:
+0:	/* first phase */
+	movl	r1,r3
+	locc	$0,r4,(r3)	/* look for '\0' */
+	bneq	1f
+	locc	r2,r4,(r3)	/* continue phase 1 search for c */
+	beql	0b
+	movab	(r1)+,r5	/* found c: save and increment pointer */
+	brb	0b		/* and continue */
+
+1:	/* second phase */
+	subl3	r3,r1,r0	/* length of short block */
+	movl	r3,r1
+2:
+	locc	r2,r0,(r1)	/* look for c */
+	beql	3f		/* skip if not found */
+	movab	(r1)+,r5	/* save pointer as before */
+	sobgtr	r0,2b		/* adjust count and loop */
+3:
+	movl	r5,r0		/* return stashed pointer */
+	ret
diff --git a/sysdeps/vax/strsep.s b/sysdeps/vax/strsep.s
new file mode 100644
index 0000000000..9751acc699
--- /dev/null
+++ b/sysdeps/vax/strsep.s
@@ -0,0 +1,85 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)strsep.s	5.1 (Berkeley) 5/15/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Get next word from string *stringp, where words are
+ * strings separated by characters from delim.
+ *
+ * Writes NULs into the string at *stringp to end tokens.
+ * On return, *stringp points past the last NUL written (if there might
+ * be further tokens), or is NULL (if there are definitely no more tokens).
+ *
+ * If *stringp is NULL, strtoken returns NULL.
+ *
+ * char *
+ * strtoken(stringp, delim)
+ *	register char **stringp;
+ *	register char const *delim;
+ */
+#include "DEFS.h"
+
+ENTRY(strsep, 0)
+	tstl	*4(ap)		/* if (*stringp == NULL) */
+	bneq	0f
+	clrl	r0		#	return (NULL);
+	ret
+
+0:
+	subl2	$32,sp		/* make room for 256 bit table */
+	movc5	$0,(sp),$0,$32,(sp)
+	movq	4(ap),r1	/* r1 = stringp, r2 = delim */
+
+	/* turn on bit for each character in s2, including '\0' */
+1:
+	movzbl	(r2)+,r0
+	bbss	r0,(sp),1b
+	bneq	1b
+
+	movl	(r1),r3		/* r3 = s = *stringp */
+	movl	r3,r0		/* save return value */
+
+	/* scan for delimiters */
+2:
+	movzbl	(r3)+,r2	/* c = *s++ */
+	bbc	r2,(sp),2b	/* loop until c is in table */
+	beql	3f
+	clrb	-1(r3)		/* if c!='\0', s[-1] = 0 */
+	movl	r3,(r1)		/* and *stringp = s */
+	ret
+3:
+	clrl	(r1)		/* else *stringp = NULL */
+	ret
diff --git a/sysdeps/vax/strspn.s b/sysdeps/vax/strspn.s
new file mode 100644
index 0000000000..fc86af7c37
--- /dev/null
+++ b/sysdeps/vax/strspn.s
@@ -0,0 +1,70 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)strspn.s	5.1 (Berkeley) 5/15/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Span the string s2 (skip characters that are in s2).
+ * Return the number of characters in s1 that were skipped.
+ *
+ * size_t
+ * strspn(s1, s2)
+ *	const char *s1, *s2;
+ */
+#include "DEFS.h"
+
+ENTRY(strspn, 0)
+	subl2	$32,sp		/* make 256 bit table */
+	movc5	$0,(sp),$0,$32,(sp)
+	movq	4(ap),r1	/* r1 = s1, r2 = s2 */
+
+	/* turn on bit for each character in s2, including '\0' */
+1:
+	movzbl	(r2)+,r0
+	bbss	r0,(sp),1b
+	bneq	1b
+
+	/* now clear bit for '\0' */
+	/* (this is easier than avoiding setting it in the first place) */
+	bicb2	$1,(sp)		/* stop at '\0' */
+	movl	r1,r0		/* r0 = s (current pos in s1) */
+
+	/* look for a character that is not in s2 */
+2:
+	movzbl	(r0)+,r2	/* c = *s++ */
+	bbs	r2,(sp),2b	/* loop while c is in table */
+	decl	r0		/* s-- */
+	subl2	r1,r0		/* r0 = s - s1 = count */
+	ret
diff --git a/sysdeps/vax/strstr.s b/sysdeps/vax/strstr.s
new file mode 100644
index 0000000000..2e5337595d
--- /dev/null
+++ b/sysdeps/vax/strstr.s
@@ -0,0 +1,113 @@
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * 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 the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+	.asciz "@(#)strstr.s	5.2 (Berkeley) 8/21/90"
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Find the first occurrence of s2 as a substring in s1.
+ * If s2 is empty, return s1.
+ *
+ * char *strstr(s1, s2)
+ *	const char *s1, *s2;
+ */
+#include "DEFS.h"
+
+ENTRY(strstr, 0)
+	movq	4(ap),r3	/* r3 = s1, r4 = s2 */
+	movzwl	$65535,r2	/* r2 = locc/matchc limit */
+	locc	$0,r2,(r4)	/* find '\0' in s2 */
+	beql	4f
+	subl3	r4,r1,r5	/* r5 = strlen(s2) */
+	beql	1f		/* if r5 == 0, return s1 */
+
+	/*
+	 * s2 is short enough to apply matchc.
+	 * If s1 is long, we have to do it in stages.
+	 */
+0:	locc	$0,r2,(r3)	/* find '\0' in s1 */
+	beql	3f
+
+	/*
+	 * Both strings are `short'; we can use matchc directly.
+	 */
+	subl3	r3,r1,r1	/* r1 = strlen(s1) */
+	matchc	r5,(r4),r1,(r3)	/* find substring */
+	bneq	2f
+
+	/*
+	 * r3 points r5 bytes past match.  Return the match.
+	 */
+1:	subl3	r5,r3,r0	/* return (byte_past_match - strlen(s2)) */
+	ret
+
+	/*
+	 * There is no matching substring.
+	 */
+2:	clrl	r0		/* return NULL */
+	ret
+
+	/*
+	 * s1 is too long (> 65535 bytes) to apply matchc directly,
+	 * but s2 is short enough.  Apply s2 to s1, then (if not
+	 * found yet) advancing s1 by (65536-strlen(s2)) bytes and
+	 * loop.
+	 */
+3:	matchc	r5,(r4),r2,(r3)	/* search */
+	beql	1b		/* if found, go return it */
+	decw	r2		/* from 0 to 65535 */
+	incl	r3		/* already advanced 65535, now 65536 */
+	subl2	r5,r3		/* ... minus strlen(s2) */
+	brb	0b
+
+	/*
+	 * s2 is too long (> 65535 bytes) to bother with matchc.
+	 */
+4:	locc	$0,r2,(r1)	/* continue working on strlen(s2) */
+	beql	4b
+	subl3	r1,r4,r5	/* r5 = strlen(s2) */
+	movb	(r4)+,r2	/* r2 = *s2++ */
+	decl	r5		/* fix up length */
+5:	movb	(r3)+,r0	/* r0 = *s1++ */
+	beql	2b		/* if '\0', return NULL */
+	cmpb	r0,r2
+	bneq	5b		/* loop until first char found */
+	pushr	R5|R4|R3|R2	/* save c, s1, s2, n */
+	pushr	R5|R4|R3	/* strncmp(s1, s2, n) */
+	calls	$3,_strncmp
+	popr	R2|R3|R4|R5	/* restore */
+	tstl	r0
+	bneq	5b		/* loop until strncmp says rest same too */
+	subl3	$1,r3,r0	/* return previous s1 */
+	ret