From owner-dev-commits-src-main@freebsd.org Mon Aug 23 16:12:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD47766D6FA; Mon, 23 Aug 2021 16:12:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Gtchn5lYgz3P5y; Mon, 23 Aug 2021 16:12:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB4E917445; Mon, 23 Aug 2021 16:12:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17NGCfnK019199; Mon, 23 Aug 2021 16:12:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17NGCfYu019198; Mon, 23 Aug 2021 16:12:41 GMT (envelope-from git) Date: Mon, 23 Aug 2021 16:12:41 GMT Message-Id: <202108231612.17NGCfYu019198@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 362c5920da56 - main - Remove libkern/bcmp.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 362c5920da56964516ea77e29692857c05c096f7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Aug 2021 16:12:42 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=362c5920da56964516ea77e29692857c05c096f7 commit 362c5920da56964516ea77e29692857c05c096f7 Author: Mateusz Guzik AuthorDate: 2021-08-23 15:40:57 +0000 Commit: Mateusz Guzik CommitDate: 2021-08-23 16:12:12 +0000 Remove libkern/bcmp.c The kernel was migrated to memcmp in ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero) routines.") and there are no remaining architectures using the file. Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/libkern/bcmp.c | 146 ----------------------------------------------------- sys/sys/systm.h | 1 - 2 files changed, 147 deletions(-) diff --git a/sys/libkern/bcmp.c b/sys/libkern/bcmp.c deleted file mode 100644 index 40ef39953c86..000000000000 --- a/sys/libkern/bcmp.c +++ /dev/null @@ -1,146 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1987, 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. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include - -typedef const void *cvp; -typedef const unsigned char *ustring; -typedef unsigned long ul; -typedef const unsigned long *culp; - -/* - * bcmp -- vax cmpc3 instruction - */ -int -(bcmp)(const void *b1, const void *b2, size_t length) -{ -#if BYTE_ORDER == LITTLE_ENDIAN - /* - * The following code is endian specific. Changing it from - * little-endian to big-endian is fairly trivial, but making - * it do both is more difficult. - * - * Note that this code will reference the entire longword which - * includes the final byte to compare. I don't believe this is - * a problem since AFAIK, objects are not protected at smaller - * than longword boundaries. - */ - int shl, shr, len = length; - ustring p1 = b1, p2 = b2; - ul va, vb; - - if (len == 0) - return (0); - - /* - * align p1 to a longword boundary - */ - while ((long)p1 & (sizeof(long) - 1)) { - if (*p1++ != *p2++) - return (1); - if (--len <= 0) - return (0); - } - - /* - * align p2 to longword boundary and calculate the shift required to - * align p1 and p2 - */ - shr = (long)p2 & (sizeof(long) - 1); - if (shr != 0) { - p2 -= shr; /* p2 now longword aligned */ - shr <<= 3; /* offset in bits */ - shl = (sizeof(long) << 3) - shr; - - va = *(culp)p2; - p2 += sizeof(long); - - while ((len -= sizeof(long)) >= 0) { - vb = *(culp)p2; - p2 += sizeof(long); - if (*(culp)p1 != (va >> shr | vb << shl)) - return (1); - p1 += sizeof(long); - va = vb; - } - /* - * At this point, len is between -sizeof(long) and -1, - * representing 0 .. sizeof(long)-1 bytes remaining. - */ - if (!(len += sizeof(long))) - return (0); - - len <<= 3; /* remaining length in bits */ - /* - * The following is similar to the `if' condition - * inside the above while loop. The ?: is necessary - * to avoid accessing the longword after the longword - * containing the last byte to be compared. - */ - return ((((va >> shr | ((shl < len) ? *(culp)p2 << shl : 0)) ^ - *(culp)p1) & ((1L << len) - 1)) != 0); - } else { - /* p1 and p2 have common alignment so no shifting needed */ - while ((len -= sizeof(long)) >= 0) { - if (*(culp)p1 != *(culp)p2) - return (1); - p1 += sizeof(long); - p2 += sizeof(long); - } - - /* - * At this point, len is between -sizeof(long) and -1, - * representing 0 .. sizeof(long)-1 bytes remaining. - */ - if (!(len += sizeof(long))) - return (0); - - return (((*(culp)p1 ^ *(culp)p2) - & ((1L << (len << 3)) - 1)) != 0); - } -#else - const char *p1, *p2; - - if (length == 0) - return(0); - p1 = b1; - p2 = b2; - do - if (*p1++ != *p2++) - break; - while (--length); - return(length); -#endif -} diff --git a/sys/sys/systm.h b/sys/sys/systm.h index da20492966cd..1be8f1ac49be 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -344,7 +344,6 @@ void hexdump(const void *ptr, int length, const char *hdr, int flags); void bcopy(const void * _Nonnull from, void * _Nonnull to, size_t len); void bzero(void * _Nonnull buf, size_t len); void explicit_bzero(void * _Nonnull, size_t); -int bcmp(const void *b1, const void *b2, size_t len); void *memset(void * _Nonnull buf, int c, size_t len); void *memcpy(void * _Nonnull to, const void * _Nonnull from, size_t len);