From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 1E2A2AC0A18 for ; Thu, 3 Aug 2023 04:39:03 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=WdMdXlRqZAVBaPZH4Caq2MZejbFevMNk2QoNPO8Dbrw=; c=relaxed/simple; d=groups.io; h=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:Content-Transfer-Encoding; s=20140610; t=1691037542; v=1; b=MONpb8oa21Q+aT2PAoW7+4cdSsBcZqDpalM785JL8KAoYPDZIQZeow6bFgmQmlY6g3LpChGl D/m/u7a3e/DWeOjEVtzoHvBsVh3j3M3LutkMxzHBQyghlGMcIFcG4oBTGxBt+3hbGY6ytqkVaFs 2dITdFQHogqu4TrAzB67VgiA= X-Received: by 127.0.0.2 with SMTP id m2ghYY7687511xLVOr1OtH2s; Wed, 02 Aug 2023 21:39:02 -0700 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web10.7306.1691037531078533765 for ; Wed, 02 Aug 2023 21:39:02 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10790"; a="456141212" X-IronPort-AV: E=Sophos;i="6.01,251,1684825200"; d="scan'208";a="456141212" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2023 21:39:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10790"; a="794848084" X-IronPort-AV: E=Sophos;i="6.01,251,1684825200"; d="scan'208";a="794848084" X-Received: from liyi4-desktop.ccr.corp.intel.com ([10.239.153.10]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2023 21:39:00 -0700 From: "Li, Yi" To: devel@edk2.groups.io Cc: Yi Li , Jiewen Yao , Xiaoyu Lu , Guomin Jiang Subject: [edk2-devel] [PATCH V2 22/29] CryptoPkg: add missing gcc instructions Date: Thu, 3 Aug 2023 12:37:40 +0800 Message-Id: <52c400fab3bbe8c6f941add9372027fa31b518e6.1691031203.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: 1BrkF9IqnxfeC6PydESNpAFgx7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=MONpb8oa; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io 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/CryptoPkg/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 conventions. + +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/CryptoPkg/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 conventions. + +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/CryptoPkg/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 conventions. + +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/CryptoPkg/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 conventions. + +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/Library/IntrinsicLib/IntrinsicLib.inf index 4d2440466d..ae238ccc0b 100644 --- a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf +++ b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf @@ -43,7 +43,10 @@ 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] -- 2.31.1.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#107503): https://edk2.groups.io/g/devel/message/107503 Mute This Topic: https://groups.io/mt/100520606/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-