From nobody Fri May 3 09:26:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+97583+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+97583+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1671496765; cv=none; d=zohomail.com; s=zohoarc; b=c+Pk+C3F/i2vLZ9AFjy68aAF4IiUHOdz+6aDzGysAWvC3Hpb9TjZh6tsEzNvdWSLdIJ0k1/nrkJ7fWYRs7iemGgBqNFXCWeSe2Rj3i6SJnzvgcKRUWnQ/dZ306/mhWqpnQ76b0ZPDfC/uB95ee/MTDMlaIOh+o2bIagymzgvk/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1671496765; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject; bh=+nak48ZwGscPkn5MIombjI6HWQmH0/Xaeo132tmalQc=; b=f2NU5EwMepvC8UIV9jH7dWsbd6oomTEsbq/aa6brN35WbqeSem45oRff33SnS/dVtJz5yA7gFWOafknrXUksiEQGCxsEpRA3yYaFwDkT1yIO9cDMRYe1p0Ru8U33Iu7D3XPT7y2YUhrzYwtqsHAd+kNOCbdD8Is7HQTKzHChhZw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+97583+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1671496765833913.8785056556925; Mon, 19 Dec 2022 16:39:25 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 6DMIYY1788612xYA9K8JwF6l; Mon, 19 Dec 2022 16:39:25 -0800 X-Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) by mx.groups.io with SMTP id smtpd.web10.143669.1671134412296544870 for ; Thu, 15 Dec 2022 12:00:12 -0800 X-Received: by mail-pl1-f170.google.com with SMTP id l10so96503plb.8 for ; Thu, 15 Dec 2022 12:00:12 -0800 (PST) X-Gm-Message-State: 6c49aB3T5AZZ8HwAV5Mek0x5x1787277AA= X-Google-Smtp-Source: AA0mqf5iimFfausJXCYYr+4TE0bNUR7Ra/Plr3L3Jpain1hr4mTo1BEgR1gleU76CMI+b89XmY0K8w== X-Received: by 2002:a17:902:f54f:b0:189:d068:270 with SMTP id h15-20020a170902f54f00b00189d0680270mr44090017plf.30.1671134411365; Thu, 15 Dec 2022 12:00:11 -0800 (PST) X-Received: from localhost.localdomain (c-24-7-118-148.hsd1.ca.comcast.net. [24.7.118.148]) by smtp.gmail.com with ESMTPSA id t7-20020a1709027fc700b00189f69c1aa0sm5508plb.270.2022.12.15.12.00.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Dec 2022 12:00:10 -0800 (PST) From: "Tuan Phan" To: Cc: devel@edk2.groups.io, sunilvl@ventanamicro.com, Tuan Phan Subject: [edk2-devel] [PATCH] CryptoPkg/IntrinsicLib: RiscV: Provide implementation of memcpy and __ctzdi2 Date: Thu, 15 Dec 2022 09:48:59 -0800 Message-Id: <20221215174859.11638-1-tphan@ventanamicro.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,tphan@ventanamicro.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1671496765; bh=8iNIiB1dVuqK6Os7xr8wzV38ONnNGVSza2H8NSQ8MQ0=; h=Cc:Date:From:Reply-To:Subject:To; b=WXcYywYB1YkKbkxmOBVS2EySnar3WSD1vo4kCSHhkve1x2s3DSK6q5+E8jwzdYXy8XG Zx1/5cw6Thlb38xXLczMsNF39fOEEIB6h5xQLvuPwwC2Wxlz4rrbXsyRo2WMUKoTgJke5 uiDyYgzpXcjvOaIg5wHGB56WfI1ml3n8qng= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1671496767129100004 Content-Type: text/plain; charset="utf-8" The RiscV toolchain doesn't provide __ctzdi2 implementation when compiled with -nostdlib that needed by openssl library when EC=20 enabled. So adding the simple implementation of __ctzdi2. Forcing to use CopyMem of EDK2 as builtin memcpy disabled for RiscV with -fno-builtin-memcpy flag. Signed-off-by: Tuan Phan Acked-by: Sunil V L --- .../Library/IntrinsicLib/CompilerHelper.c | 41 +++++++++++++++++++ .../Library/IntrinsicLib/IntrinsicLib.inf | 6 ++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 CryptoPkg/Library/IntrinsicLib/CompilerHelper.c diff --git a/CryptoPkg/Library/IntrinsicLib/CompilerHelper.c b/CryptoPkg/Li= brary/IntrinsicLib/CompilerHelper.c new file mode 100644 index 000000000000..9e700a11ed17 --- /dev/null +++ b/CryptoPkg/Library/IntrinsicLib/CompilerHelper.c @@ -0,0 +1,41 @@ +/** @file + Implement functions that not available when compiled with -nostdlib flag. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +unsigned int +__ctzdi2 (unsigned long long x) +{ + unsigned int ret =3D 0; + + if (!x) { + return 64; + } + if (!(x & 0xffffffff)) { + x >>=3D 32; + ret |=3D 32; + } + if (!(x & 0xffff)) { + x >>=3D 16; + ret |=3D 16; + } + if (!(x & 0xff)) { + x >>=3D 8; + ret |=3D 8; + } + if (!(x & 0xf)) { + x >>=3D 4; + ret |=3D 4; + } + if (!(x & 0x3)) { + x >>=3D 2; + ret |=3D 2; + } + if (!(x & 0x1)) { + x >>=3D 1; + ret |=3D 1; + } + return ret; +} diff --git a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf b/CryptoPkg/Li= brary/IntrinsicLib/IntrinsicLib.inf index 86e74b57b109..6796b39b07cf 100644 --- a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf +++ b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf @@ -18,7 +18,7 @@ # # The following information is for reference only and not required by the = build tools. # -# VALID_ARCHITECTURES =3D IA32 X64 +# VALID_ARCHITECTURES =3D IA32 X64 RISCV64 # =20 [Sources] @@ -43,6 +43,10 @@ [Sources.X64] CopyMem.c =20 +[Sources.RISCV64] + CopyMem.c + CompilerHelper.c + [Packages] MdePkg/MdePkg.dec =20 --=20 2.25.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#97583): https://edk2.groups.io/g/devel/message/97583 Mute This Topic: https://groups.io/mt/95777532/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-