From nobody Mon Feb 9 05:41:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) ARC-Seal: i=2; a=rsa-sha256; t=1712849949; cv=pass; d=zohomail.com; s=zohoarc; b=AWgItKvqopxldsFAKcdd+O+zcigoRULM5rwlt5U1A9fBWm69WoMDR1dn76zSG9Id9gSwMRB0l77exHcY/ki4vMdkemcrW41cxZkxKB2ZExi0wdRdjD/pm5Q2HA9h31gAg0+1DjznUKQSBrzFtM7MYI8ziJ3WOoeoixjoKEVMxEs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712849949; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CnTjEaX3hnuMjXMsnX980kERulKrcznM7VftSyLKlZI=; b=LRxkEYweus0s29pGXT4GXmGG2E/FslckATF9ulgPkl4rCKTSOPp+oDpQSXB7u43nmqc+FF2vjznX/jBg2ELwFWYXRy2PSSTJX3JbHuDBHkqe7uIofRntw2Orz5505PYOdz9XJrZ4bhNCj81PX0SGiUb6X83/QaHj3LQIP3CxaVE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass header.i=dpsmith@apertussolutions.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=apertussolutions.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1712849949417500.04560910751354; Thu, 11 Apr 2024 08:39:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.704030.1100123 (Exim 4.92) (envelope-from ) id 1ruwVa-0006FX-NJ; Thu, 11 Apr 2024 15:38:38 +0000 Received: by outflank-mailman (output) from mailman id 704030.1100123; Thu, 11 Apr 2024 15:38:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ruwVa-0006FQ-Ih; Thu, 11 Apr 2024 15:38:38 +0000 Received: by outflank-mailman (input) for mailman id 704030; Thu, 11 Apr 2024 15:38:37 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ruwJy-0000Mi-HD for xen-devel@lists.xenproject.org; Thu, 11 Apr 2024 15:26:38 +0000 Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e2744a0a-f817-11ee-b908-491648fe20b8; Thu, 11 Apr 2024 17:26:37 +0200 (CEST) Received: by mx.zohomail.com with SMTPS id 1712849133372546.854655551866; Thu, 11 Apr 2024 08:25:33 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e2744a0a-f817-11ee-b908-491648fe20b8 ARC-Seal: i=1; a=rsa-sha256; t=1712849135; cv=none; d=zohomail.com; s=zohoarc; b=AM1W3oM3/jBer+uk2dAhpydvxPiQ/v639/VYDawNR1+WcWCzQka2JHvEHLQE+yi+DY2nqF+p1fM8y3exUvlX9JFP06AUQfHRWy3og01fGgJ/lGg1OGwrOrJJEgje7wbiw0kgAdCaxG38cKrCgOeAYEBLk+AP8DaPr23U1Qe8JVw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1712849135; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=CnTjEaX3hnuMjXMsnX980kERulKrcznM7VftSyLKlZI=; b=GuYjC4zciGnSsOPeFDqwQgL2tlRlCGJIVqU5ky6RK0AvmqVp1fii5FS5cpYgNY+Mlg74uTscyhKxc7PVgzRkzuzeH0455ajJxtPdg4nvZRL4YZvVTRuDXTMppehD6e1sIFWroTNHIvR/IGJlJNy6Ui/kKtVDCrbKHCkUq+D6lR0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@apertussolutions.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1712849135; s=zoho; d=apertussolutions.com; i=dpsmith@apertussolutions.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-Id:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=CnTjEaX3hnuMjXMsnX980kERulKrcznM7VftSyLKlZI=; b=lYmTdwQR4nnpkPHJ989rRXQVWJp5sRTKy77MpiThId6AAgnyBnWB5/J/KHMCfSvP xaYjtxmRXGnaCMSZKqJRt1kO9dVjLol5VLsmV070iJQU6QDNnrueBnycW1ruK3BI0zA zdRayhCvKTadoXY1IXWrGr+8JOLVQRg3B2eo+Xo4= From: "Daniel P. Smith" To: xen-devel@lists.xenproject.org Cc: Jason Andryuk , "Daniel P. Smith" , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH 4/5] gzip: move crc state into consilidated gzip state Date: Thu, 11 Apr 2024 11:25:17 -0400 Message-Id: <20240411152518.2995-5-dpsmith@apertussolutions.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240411152518.2995-1-dpsmith@apertussolutions.com> References: <20240411152518.2995-1-dpsmith@apertussolutions.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External X-ZohoMail-DKIM: pass (identity dpsmith@apertussolutions.com) X-ZM-MESSAGEID: 1712849951437100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Daniel P. Smith --- xen/common/gzip/gunzip.c | 11 +++++++---- xen/common/gzip/inflate.c | 12 +++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/xen/common/gzip/gunzip.c b/xen/common/gzip/gunzip.c index 9b4891731b8b..a1b516b925c9 100644 --- a/xen/common/gzip/gunzip.c +++ b/xen/common/gzip/gunzip.c @@ -28,6 +28,9 @@ struct gzip_data { =20 unsigned long bb; /* bit buffer */ unsigned bk; /* bits in bit buffer */ + + unsigned long crc_32_tab[256]; + unsigned long crc; }; =20 #define OF(args) args @@ -78,7 +81,7 @@ static __init void flush_window(struct gzip_data *gd) * The window is equal to the output buffer therefore only need to * compute the crc. */ - unsigned long c =3D crc; + unsigned long c =3D gd->crc; unsigned int n; unsigned char *in, ch; =20 @@ -86,9 +89,9 @@ static __init void flush_window(struct gzip_data *gd) for ( n =3D 0; n < gd->outcnt; n++ ) { ch =3D *in++; - c =3D crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); + c =3D gd->crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8); } - crc =3D c; + gd->crc =3D c; =20 gd->bytes_out +=3D (unsigned long)gd->outcnt; gd->outcnt =3D 0; @@ -129,7 +132,7 @@ __init int perform_gunzip(char *output, char *image, un= signed long image_len) gd.inptr =3D 0; gd.bytes_out =3D 0; =20 - makecrc(); + makecrc(&gd); =20 if ( gunzip(&gd) < 0 ) { diff --git a/xen/common/gzip/inflate.c b/xen/common/gzip/inflate.c index c8dd35962abb..6c8c7452a31f 100644 --- a/xen/common/gzip/inflate.c +++ b/xen/common/gzip/inflate.c @@ -1125,16 +1125,14 @@ static int __init inflate(struct gzip_data *gd) * **********************************************************************/ =20 -static ulg __initdata crc_32_tab[256]; -static ulg __initdata crc; /* initialized in makecrc() so it'll reside in= bss */ -#define CRC_VALUE (crc ^ 0xffffffffUL) +#define CRC_VALUE (gd->crc ^ 0xffffffffUL) =20 /* * Code to compute the CRC-32 table. Borrowed from * gzip-1.0.3/makecrc.c. */ =20 -static void __init makecrc(void) +static void __init makecrc(struct gzip_data *gd) { /* Not copyrighted 1990 Mark Adler */ =20 @@ -1151,7 +1149,7 @@ static void __init makecrc(void) for (i =3D 0; i < sizeof(p)/sizeof(int); i++) e |=3D 1L << (31 - p[i]); =20 - crc_32_tab[0] =3D 0; + gd->crc_32_tab[0] =3D 0; =20 for (i =3D 1; i < 256; i++) { @@ -1162,11 +1160,11 @@ static void __init makecrc(void) if (k & 1) c ^=3D e; } - crc_32_tab[i] =3D c; + gd->crc_32_tab[i] =3D c; } =20 /* this is initialized here so this code could reside in ROM */ - crc =3D (ulg)0xffffffffUL; /* shift register contents */ + gd->crc =3D (ulg)0xffffffffUL; /* shift register contents */ } =20 /* gzip flag byte */ --=20 2.30.2