From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web10.32920.1641827599550995785 for ; Mon, 10 Jan 2022 07:13:20 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=f2MiaOIA; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: yun.lou@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1641827599; x=1673363599; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=PKaVIjACSg7l8aNgpolJbklHTAck85rktDvzf93C4ew=; b=f2MiaOIAffgK/89dvq1Rq8mWsezSGC5X5oUnrUIbf5yus9/51XdvP/RE uYNPzfUUhoJThdqwEbCkAbbkb4ikI1GJaB4roHLA95kKXf5Ra1kIkDXU6 Wmc+3jG3NkOob628NMUiSzKsVCFlay06HSwcT+DQc1lb7lVn3T3Q0klV5 ntaG0kSbdM8Ra0e+n8KZs7Ui97RrigQYJ0PGtFUI3Qb9reu9O+moM/CKS fZ7sVv7ZGAhaM4znEef9sqQ5aWX2VSwa73lSOikmwgoMAoD7q9yyHxuGa FSe13NVVSmaF1O2hUDbIqjM5e4go4+oPlS07CQyJ32vyoXQKO/6sv2GcV w==; X-IronPort-AV: E=McAfee;i="6200,9189,10222"; a="306599896" X-IronPort-AV: E=Sophos;i="5.88,277,1635231600"; d="scan'208";a="306599896" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2022 07:13:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,277,1635231600"; d="scan'208";a="528307375" Received: from shwdeopenlab102.ccr.corp.intel.com ([10.239.183.94]) by orsmga008.jf.intel.com with ESMTP; 10 Jan 2022 07:13:17 -0800 From: "Jason Lou" To: devel@edk2.groups.io Cc: Jason , Ray Ni , Dandan Bi , Liming Gao Subject: [PATCH v2 1/6] MdeModulePkg: Replace Opcode with the corresponding instructions. Date: Mon, 10 Jan 2022 23:12:48 +0800 Message-Id: <20220110151253.3848-1-yun.lou@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3790 Replace Opcode with the corresponding instructions. The code changes have been verified with CompareBuild.py tool, which can be used to compare the results of two different EDK II builds to determine if they generate the same binaries. (tool link: https://github.com/mdkinney/edk2/tree/sandbox/CompareBuild) Signed-off-by: Jason Lou Cc: Ray Ni Cc: Dandan Bi Cc: Liming Gao --- MdeModulePkg/Universal/DebugSupportDxe/Ia32/AsmFuncs.nasm | 20 +++--------= -------- MdeModulePkg/Universal/DebugSupportDxe/X64/AsmFuncs.nasm | 21 +++--------= --------- 2 files changed, 6 insertions(+), 35 deletions(-) diff --git a/MdeModulePkg/Universal/DebugSupportDxe/Ia32/AsmFuncs.nasm b/Md= eModulePkg/Universal/DebugSupportDxe/Ia32/AsmFuncs.nasm index cfb418748f..07fc912fe8 100644 --- a/MdeModulePkg/Universal/DebugSupportDxe/Ia32/AsmFuncs.nasm +++ b/MdeModulePkg/Universal/DebugSupportDxe/Ia32/AsmFuncs.nasm @@ -1,7 +1,7 @@ ;/** @file=0D ; Low leve IA32 specific debug support functions.=0D ;=0D -; Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
= =0D +; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.
= =0D ; SPDX-License-Identifier: BSD-2-Clause-Patent=0D ;=0D ;**/=0D @@ -26,20 +26,6 @@ =0D %define FXSTOR_FLAG 0x1000000 ; bit cpuid 24 of feature flags=0D =0D -;; The FXSTOR and FXRSTOR commands are used for saving and restoring the x= 87,=0D -;; MMX, SSE, SSE2, etc registers. The initialization of the debugsupport = driver=0D -;; MUST check the CPUID feature flags to see that these instructions are a= vailable=0D -;; and fail to init if they are not.=0D -=0D -;; fxstor [edi]=0D -%macro FXSTOR_EDI 0=0D - db 0xf, 0xae, 00000111y ; mod =3D 00, reg/op =3D = 000, r/m =3D 111 =3D [edi]=0D -%endmacro=0D -=0D -;; fxrstor [esi]=0D -%macro FXRSTOR_ESI 0=0D - db 0xf, 0xae, 00001110y ; mod =3D 00, reg/op =3D = 001, r/m =3D 110 =3D [esi]=0D -%endmacro=0D SECTION .data=0D =0D global ASM_PFX(OrigVector)=0D @@ -348,7 +334,7 @@ ExtraPushDone: ; IMPORTANT!! The debug stack has been carefully construct= ed to=0D ; insure that esp and edi are 16 byte aligned when we get = here.=0D ; They MUST be. If they are not, a GP fault will occur.=0D - FXSTOR_EDI=0D + fxsave [edi]=0D =0D ;; UEFI calling convention for IA32 requires that Direction flag in EFLAGs= is clear=0D cld=0D @@ -372,7 +358,7 @@ ExtraPushDone: =0D ;; FX_SAVE_STATE_IA32 FxSaveState;=0D mov esi, esp=0D - FXRSTOR_ESI=0D + fxrstor [esi]=0D add esp, 512=0D =0D ;; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;=0D diff --git a/MdeModulePkg/Universal/DebugSupportDxe/X64/AsmFuncs.nasm b/Mde= ModulePkg/Universal/DebugSupportDxe/X64/AsmFuncs.nasm index 9cc38a3128..c6c5e49189 100644 --- a/MdeModulePkg/Universal/DebugSupportDxe/X64/AsmFuncs.nasm +++ b/MdeModulePkg/Universal/DebugSupportDxe/X64/AsmFuncs.nasm @@ -1,7 +1,7 @@ ;/** @file=0D ; Low level x64 routines used by the debug support driver.=0D ;=0D -; Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
= =0D +; Copyright (c) 2007 - 2022, Intel Corporation. All rights reserved.
= =0D ; SPDX-License-Identifier: BSD-2-Clause-Patent=0D ;=0D ;**/=0D @@ -26,21 +26,6 @@ =0D %define FXSTOR_FLAG 0x1000000 ; bit cpuid 24 of feature flags=0D =0D -;; The FXSTOR and FXRSTOR commands are used for saving and restoring the x= 87,=0D -;; MMX, SSE, SSE2, etc registers. The initialization of the debugsupport = driver=0D -;; MUST check the CPUID feature flags to see that these instructions are a= vailable=0D -;; and fail to init if they are not.=0D -=0D -;; fxstor [rdi]=0D -%macro FXSTOR_RDI 0=0D - db 0xf, 0xae, 00000111y ; mod =3D 00, reg/op =3D = 000, r/m =3D 111 =3D [rdi]=0D -%endmacro=0D -=0D -;; fxrstor [rsi]=0D -%macro FXRSTOR_RSI 0=0D - db 0xf, 0xae, 00001110y ; mod =3D 00, reg/op =3D = 001, r/m =3D 110 =3D [rsi]=0D -%endmacro=0D -=0D SECTION .data=0D =0D global ASM_PFX(OrigVector)=0D @@ -381,7 +366,7 @@ ExtraPushDone: ; IMPORTANT!! The debug stack has been carefully construct= ed to=0D ; insure that rsp and rdi are 16 byte aligned when we get = here.=0D ; They MUST be. If they are not, a GP fault will occur.=0D - FXSTOR_RDI=0D + fxsave [rdi]=0D =0D ;; UEFI calling convention for x64 requires that Direction flag in EFLAGs = is clear=0D cld=0D @@ -404,7 +389,7 @@ ExtraPushDone: =0D ;; FX_SAVE_STATE_X64 FxSaveState;=0D mov rsi, rsp=0D - FXRSTOR_RSI=0D + fxrstor [rsi]=0D add rsp, 512=0D =0D ;; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;=0D --=20 2.28.0.windows.1