From owner-svn-src-all@freebsd.org Tue Sep 1 04:37:56 2020 Return-Path: Delivered-To: svn-src-all@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 A9FF53DAB6E; Tue, 1 Sep 2020 04:37:56 +0000 (UTC) (envelope-from imp@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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BgZ7S3zyWz4cYC; Tue, 1 Sep 2020 04:37:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 676C7137AD; Tue, 1 Sep 2020 04:37:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0814buSW098369; Tue, 1 Sep 2020 04:37:56 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0814buhY098368; Tue, 1 Sep 2020 04:37:56 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202009010437.0814buhY098368@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 1 Sep 2020 04:37:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r365022 - head/sys/libkern X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/libkern X-SVN-Commit-Revision: 365022 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Sep 2020 04:37:56 -0000 Author: imp Date: Tue Sep 1 04:37:55 2020 New Revision: 365022 URL: https://svnweb.freebsd.org/changeset/base/365022 Log: Smaller crc for the boot loader. Save 7k of text space by using simpler crc32 for standalone case. we don't need all that fancy optimization in the boot loader, so use a simplified version of the CRC function. We could save more by doing it one bit at a time rather than 32, but this is the biggest savings at the smallest performance hit. With LUA and verfied exec, gptboot, gptzfsboot and friends are pushing the ~530k limit and every little bit helps. Reviewed By: allanjude Differential Revision: https://reviews.freebsd.org/D24225 Modified: head/sys/libkern/gsb_crc32.c Modified: head/sys/libkern/gsb_crc32.c ============================================================================== --- head/sys/libkern/gsb_crc32.c Tue Sep 1 01:57:56 2020 (r365021) +++ head/sys/libkern/gsb_crc32.c Tue Sep 1 04:37:55 2020 (r365022) @@ -227,6 +227,7 @@ singletable_crc32c(uint32_t crc, const void *buf, size return crc; } +#ifndef _STANDALONE /* * Copyright (c) 2004-2006 Intel Corporation - All Rights Reserved @@ -788,3 +789,10 @@ calculate_crc32c(uint32_t crc32c, return (multitable_crc32c(crc32c, buffer, length)); } } +#else +uint32_t +calculate_crc32c(uint32_t crc32c, const unsigned char *buffer, unsigned int length) +{ + return (singletable_crc32c(crc32c, buffer, length)); +} +#endif