diff options
author | 2009-08-19 19:47:51 +0000 | |
---|---|---|
committer | 2009-08-19 19:47:51 +0000 | |
commit | 5261dd8e2aa23fa246a8ca4e274ff5054574d79b (patch) | |
tree | b6ee0aa3645afc012f26b26eb013dcda4534051b /sys/lib/libkern/arch/vax/memset.S | |
parent | In ldconfig the dewey field of shlib_list was only partially filled (diff) | |
download | wireguard-openbsd-5261dd8e2aa23fa246a8ca4e274ff5054574d79b.tar.xz wireguard-openbsd-5261dd8e2aa23fa246a8ca4e274ff5054574d79b.zip |
<machine/macros.h> would provide inline version of a few of the functions
traditionnaly found in libkern. However, the memcmp() flavour would behave
as bcmp() with only two possible return values: zero and positive non-zero.
This broke the name cache RB trees which now rely upon proper memcmp()
semantics(negative value, zero, or positive value).
Just give up on these macros and provide the same code as libc, in libkern.
As a side effect, this no longer uses the cmpc3 instruction, which is not
implemented and requires (slow) kernel emulation, on the original uVax.
Diffstat (limited to 'sys/lib/libkern/arch/vax/memset.S')
-rw-r--r-- | sys/lib/libkern/arch/vax/memset.S | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/sys/lib/libkern/arch/vax/memset.S b/sys/lib/libkern/arch/vax/memset.S new file mode 100644 index 00000000000..f8cc2331247 --- /dev/null +++ b/sys/lib/libkern/arch/vax/memset.S @@ -0,0 +1,48 @@ +/* $OpenBSD: memset.S,v 1.1 2009/08/19 19:47:53 miod Exp $ */ +/*- + * Copyright (c) 1990, 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. 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. + */ + +/* void *memset(base, c, length) */ + +#include <machine/asm.h> + +ENTRY(memset, R2|R3|R4|R5) + 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 |