From nobody Tue Dec 16 07:08:39 2025 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+107360+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+107360+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1690526519; cv=none; d=zohomail.com; s=zohoarc; b=hUu39g1bZ7kMDxvqLd51U13S1wxnB7k0BLgX7SY/5ccgamRCGDk4i4MBXSxwmYzdU2TaeHbwCcFSLxlaFo/JP9z5LsVy/LuUOtq4z1dY6d+Nu0aLN26x3whi1COZnZweBU7EWRBIeph+/X26iU6+16fU+yGDprfVbap5oXO3kWI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1690526519; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=aMKsIMbjT4erhkX1q6eIU+KAzcXwv3n6+Y29Cbp/XyM=; b=hWUqI2kK6L/lncsCzuLDhwzfvXnqmqLIQDc0e2gkCiXJo3pK3XSS4ZcBVNu3aDH+H8w5W1JdtwSkgkuL+XRds7wptg72WiKmRUAPKzYjxUqWCybZpDh2scXClgXZjZCRC7tx3uFvJ6aOacw5lzATrQ5vpNWasW1bTOxz37ne0jk= 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+107360+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1690526519739670.6378094195612; Thu, 27 Jul 2023 23:41:59 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=traIOFG3MolTohQcAB8Tu2hy6FJQpwIXqTaGbKdGojU=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-IronPort-AV:X-IronPort-AV:X-Received:X-ExtLoop1:X-IronPort-AV:X-IronPort-AV:X-Received:From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:X-Gm-Message-State:Content-Transfer-Encoding; s=20140610; t=1690526519; v=1; b=lWJKKQ9qwmsqgbIGyZOw1s2/oQdGntejEUE82aKBG4moo0bpJu4lOpi1UtImJd4G2i98udgi WEyJnoym/Jqz82OfY5sLojlh5ZLgEKwcUKf8GwRGjIi+WrY0AIKhteQSCforyv14hRcz7RDQuOo 3+r2awdtD5doOIdHCliyZZd8= X-Received: by 127.0.0.2 with SMTP id 4RPFYY1788612xq4SFEG2LaT; Thu, 27 Jul 2023 23:41:59 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web10.27099.1690526517452495356 for ; Thu, 27 Jul 2023 23:41:58 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="434804382" X-IronPort-AV: E=Sophos;i="6.01,236,1684825200"; d="scan'208";a="434804382" X-Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2023 23:41:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10784"; a="762496254" X-IronPort-AV: E=Sophos;i="6.01,236,1684825200"; d="scan'208";a="762496254" X-Received: from liyi4-desktop.ccr.corp.intel.com ([10.239.153.10]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jul 2023 23:41:31 -0700 From: "Li, Yi" To: devel@edk2.groups.io Cc: Yi Li , Jiewen Yao , Xiaoyu Lu , Guomin Jiang Subject: [edk2-devel] [PATCH 22/29] CryptoPkg: add missing gcc instructions Date: Fri, 28 Jul 2023 14:40:08 +0800 Message-Id: <6e605ca30e28c9517520bd8b1a8941a79039ef07.1690444292.git.yi1.li@intel.com> In-Reply-To: References: MIME-Version: 1.0 Precedence: Bulk 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,yi1.li@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: bBqCkIKIMN5vPOnYFvoTewE6x1787277AA= Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1690526521298100035 Content-Type: text/plain; charset="utf-8" Used when build IA32 CryptoPkg by gcc, the definition of the instructions can be found at: https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html Signed-off-by: Yi Li Cc: Jiewen Yao Cc: Xiaoyu Lu Cc: Guomin Jiang --- .../IntrinsicLib/Ia32/MathDivModU64x64.c | 23 ++++++++++++++++ .../Library/IntrinsicLib/Ia32/MathDivS64x64.c | 22 ++++++++++++++++ .../Library/IntrinsicLib/Ia32/MathDivU64x64.c | 22 ++++++++++++++++ .../Library/IntrinsicLib/Ia32/MathModU64x64.c | 26 +++++++++++++++++++ .../Library/IntrinsicLib/IntrinsicLib.inf | 5 +++- 5 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathDivModU64x64.c create mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathDivS64x64.c create mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathDivU64x64.c create mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathModU64x64.c diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathDivModU64x64.c b/Crypt= oPkg/Library/IntrinsicLib/Ia32/MathDivModU64x64.c new file mode 100644 index 0000000000..6c75a1ff1d --- /dev/null +++ b/CryptoPkg/Library/IntrinsicLib/Ia32/MathDivModU64x64.c @@ -0,0 +1,23 @@ +/** @file + 64-bit Math Worker Function. + The 32-bit versions of C compiler generate calls to library routines + to handle 64-bit math. These functions use non-standard calling conventi= ons. + +Copyright (c) 2023, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +/* https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html */ +__attribute__ ((__used__)) +unsigned long long +__udivmoddi4 ( + unsigned long long A, + unsigned long long B, + unsigned long long *C + ) +{ + return DivU64x64Remainder ((UINT64)A, (UINT64)B, (UINT64 *)C); +} diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathDivS64x64.c b/CryptoPk= g/Library/IntrinsicLib/Ia32/MathDivS64x64.c new file mode 100644 index 0000000000..54ff619b61 --- /dev/null +++ b/CryptoPkg/Library/IntrinsicLib/Ia32/MathDivS64x64.c @@ -0,0 +1,22 @@ +/** @file + 64-bit Math Worker Function. + The 32-bit versions of C compiler generate calls to library routines + to handle 64-bit math. These functions use non-standard calling conventi= ons. + +Copyright (c) 2023, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +/* https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html */ +__attribute__ ((__used__)) +long long +__divdi3 ( + long long A, + long long B + ) +{ + return DivS64x64Remainder ((INT64)A, (INT64)B, NULL); +} diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathDivU64x64.c b/CryptoPk= g/Library/IntrinsicLib/Ia32/MathDivU64x64.c new file mode 100644 index 0000000000..dbb7b516fb --- /dev/null +++ b/CryptoPkg/Library/IntrinsicLib/Ia32/MathDivU64x64.c @@ -0,0 +1,22 @@ +/** @file + 64-bit Math Worker Function. + The 32-bit versions of C compiler generate calls to library routines + to handle 64-bit math. These functions use non-standard calling conventi= ons. + +Copyright (c) 2023, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +/* https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html */ +__attribute__ ((__used__)) +unsigned long long +__udivdi3 ( + unsigned long long A, + unsigned long long B + ) +{ + return DivU64x64Remainder ((UINT64)A, (UINT64)B, NULL); +} diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathModU64x64.c b/CryptoPk= g/Library/IntrinsicLib/Ia32/MathModU64x64.c new file mode 100644 index 0000000000..eedd96074e --- /dev/null +++ b/CryptoPkg/Library/IntrinsicLib/Ia32/MathModU64x64.c @@ -0,0 +1,26 @@ +/** @file + 64-bit Math Worker Function. + The 32-bit versions of C compiler generate calls to library routines + to handle 64-bit math. These functions use non-standard calling conventi= ons. + +Copyright (c) 2023, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +/* https://gcc.gnu.org/onlinedocs/gccint/Integer-library-routines.html */ +__attribute__ ((__used__)) +unsigned long long +__umoddi3 ( + unsigned long long A, + unsigned long long B + ) +{ + unsigned long long Reminder; + + DivU64x64Remainder ((UINT64)A, (UINT64)B, (UINT64 *)&Reminder); + + return Reminder; +} diff --git a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf b/CryptoPkg/Li= brary/IntrinsicLib/IntrinsicLib.inf index 4d2440466d..ae238ccc0b 100644 --- a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf +++ b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf @@ -43,7 +43,10 @@ =20 Ia32/MathLShiftS64.nasm | GCC Ia32/MathRShiftU64.nasm | GCC - + Ia32/MathDivModU64x64.c | GCC + Ia32/MathDivS64x64.c | GCC + Ia32/MathDivU64x64.c | GCC + Ia32/MathModU64x64.c | GCC [Sources.X64] CopyMem.c [Sources.RISCV64] --=20 2.31.1.windows.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 (#107360): https://edk2.groups.io/g/devel/message/107360 Mute This Topic: https://groups.io/mt/100406067/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-