Module Name: src
Committed By: dsl
Date: Sun Jul 12 21:24:21 UTC 2009
Modified Files:
src/common/lib/libc/arch/x86_64/string: strlen.S
Log Message:
Add netbsd copyright.
Reorder a few instructions to interleave a dependency chain.
(I'm really not sure of the best order for those instructions!)
To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libc/arch/x86_64/string/strlen.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/common/lib/libc/arch/x86_64/string/strlen.S
diff -u src/common/lib/libc/arch/x86_64/string/strlen.S:1.4 src/common/lib/libc/arch/x86_64/string/strlen.S:1.5
--- src/common/lib/libc/arch/x86_64/string/strlen.S:1.4 Sun Jul 12 21:00:54 2009
+++ src/common/lib/libc/arch/x86_64/string/strlen.S Sun Jul 12 21:24:21 2009
@@ -1,12 +1,43 @@
+/* $NetBSD: strlen.S,v 1.5 2009/07/12 21:24:21 dsl Exp $ */
+
+/*-
+ * Copyright (c) 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by David Laight.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
/*
- * Written by J.T. Conklin <[email protected]>
- * Public domain.
+ * Inspired by a version written by J.T. Conklin <[email protected]>
+ * (Only the long comment really remains his work!)
*/
#include <machine/asm.h>
#if defined(LIBC_SCCS)
- RCSID("$NetBSD: strlen.S,v 1.4 2009/07/12 21:00:54 dsl Exp $")
+ RCSID("$NetBSD: strlen.S,v 1.5 2009/07/12 21:24:21 dsl Exp $")
#endif
/*
@@ -120,10 +151,10 @@
/* Misaligned, read aligned word and make low bytes non-zero */
_ALIGN_TEXT
10:
- mov $1,%rsi
mov %al,%cl
- and $~7,%al /* start of word with buffer */
+ mov $1,%rsi
and $7,%cl /* offset into word 1..7 */
+ and $~7,%al /* start of word with buffer */
shl $3,%cl /* bit count 8, 16 .. 56 */
movq (%rax),%rdx /* first data in high bytes */
shl %cl,%rsi