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:21 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=isSZkxEM; 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=1641827601; x=1673363601; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gak3W/q/jdYCfawi1GBfrmp0HGccOzbMhIO/+zRoL64=; b=isSZkxEMH7U8eCqE+VauOJeVP5l5gs4WeCUyMXz0+LyXcnraz1yPNXj+ l2UnlxERtWiphk3QEStgr5hrSI4k54j0uA5ksQE1wpj5bsrfWC1Rv8+m/ iejD1L3tGP97I94W31TIWN76nojkQS9bDWfnbvdHOAXx8XDbywmPw3QKz auqqsObFPl3w/uLUxLn0Ga0MZ6IoJbgico526eSLW70f2PI4+lRF8N7iE 210iZmlAPvA41Sz3rUwHJdfQkFBI+ypJLq1Spits/n3o/G9G7JuntvByT 5RRzQL7FMJ7afDSlutgZcqDI1qZH0hUY56kwGACPzu2+DWHJcBzQ1503V A==; X-IronPort-AV: E=McAfee;i="6200,9189,10222"; a="306599906" X-IronPort-AV: E=Sophos;i="5.88,277,1635231600"; d="scan'208";a="306599906" 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:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,277,1635231600"; d="scan'208";a="528307384" Received: from shwdeopenlab102.ccr.corp.intel.com ([10.239.183.94]) by orsmga008.jf.intel.com with ESMTP; 10 Jan 2022 07:13:19 -0800 From: "Jason Lou" To: devel@edk2.groups.io Cc: Jason , Michael D Kinney , Liming Gao , Zhiguang Liu Subject: [PATCH v2 2/6] MdePkg: Replace Opcode with the corresponding instructions. Date: Mon, 10 Jan 2022 23:12:49 +0800 Message-Id: <20220110151253.3848-2-yun.lou@intel.com> X-Mailer: git-send-email 2.31.1.windows.1 In-Reply-To: <20220110151253.3848-1-yun.lou@intel.com> References: <20220110151253.3848-1-yun.lou@intel.com> 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: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu --- MdePkg/Library/BaseLib/Ia32/EnablePaging64.nasm | 20 ++++++++------------ MdePkg/Library/BaseLib/Ia32/LongJump.nasm | 6 +++--- MdePkg/Library/BaseLib/Ia32/Monitor.nasm | 4 ++-- MdePkg/Library/BaseLib/Ia32/Mwait.nasm | 4 ++-- MdePkg/Library/BaseLib/Ia32/RdRand.nasm | 13 +++++-------- MdePkg/Library/BaseLib/Ia32/ReadDr4.nasm | 6 +++--- MdePkg/Library/BaseLib/Ia32/ReadDr5.nasm | 6 +++--- MdePkg/Library/BaseLib/Ia32/SetJump.nasm | 6 +++--- MdePkg/Library/BaseLib/Ia32/WriteDr4.nasm | 6 +++--- MdePkg/Library/BaseLib/Ia32/WriteDr5.nasm | 6 +++--- MdePkg/Library/BaseLib/X64/DisablePaging64.nasm | 5 ++--- MdePkg/Library/BaseLib/X64/LongJump.nasm | 6 +++--- MdePkg/Library/BaseLib/X64/Monitor.nasm | 4 ++-- MdePkg/Library/BaseLib/X64/Mwait.nasm | 4 ++-- MdePkg/Library/BaseLib/X64/RdRand.nasm | 11 ++++------- MdePkg/Library/BaseLib/X64/ReadDr4.nasm | 4 ++-- MdePkg/Library/BaseLib/X64/ReadDr5.nasm | 4 ++-- MdePkg/Library/BaseLib/X64/ReadMm0.nasm | 7 ++----- MdePkg/Library/BaseLib/X64/ReadMm1.nasm | 7 ++----- MdePkg/Library/BaseLib/X64/ReadMm2.nasm | 7 ++----- MdePkg/Library/BaseLib/X64/ReadMm3.nasm | 7 ++----- MdePkg/Library/BaseLib/X64/ReadMm4.nasm | 7 ++----- MdePkg/Library/BaseLib/X64/ReadMm5.nasm | 7 ++----- MdePkg/Library/BaseLib/X64/ReadMm6.nasm | 7 ++----- MdePkg/Library/BaseLib/X64/ReadMm7.nasm | 7 ++----- MdePkg/Library/BaseLib/X64/SetJump.nasm | 6 +++--- MdePkg/Library/BaseLib/X64/WriteDr4.nasm | 4 ++-- MdePkg/Library/BaseLib/X64/WriteDr5.nasm | 4 ++-- MdePkg/Library/BaseLib/X64/WriteMm0.nasm | 7 ++----- MdePkg/Library/BaseLib/X64/WriteMm1.nasm | 7 ++----- MdePkg/Library/BaseLib/X64/WriteMm2.nasm | 7 ++----- MdePkg/Library/BaseLib/X64/WriteMm3.nasm | 7 ++----- MdePkg/Library/BaseLib/X64/WriteMm4.nasm | 7 ++----- MdePkg/Library/BaseLib/X64/WriteMm5.nasm | 7 ++----- MdePkg/Library/BaseLib/X64/WriteMm6.nasm | 7 ++----- MdePkg/Library/BaseLib/X64/WriteMm7.nasm | 7 ++----- MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.nasm | 10 +++++----- MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.nasm | 8 ++++---- MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.nasm | 8 ++++---- MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.nasm | 10 +++++----- MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.nasm | 6 +++--- MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.nasm | 8 ++++---- 42 files changed, 116 insertions(+), 175 deletions(-) diff --git a/MdePkg/Library/BaseLib/Ia32/EnablePaging64.nasm b/MdePkg/Libra= ry/BaseLib/Ia32/EnablePaging64.nasm index 544e3c3892..ef11458077 100644 --- a/MdePkg/Library/BaseLib/Ia32/EnablePaging64.nasm +++ b/MdePkg/Library/BaseLib/Ia32/EnablePaging64.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -44,16 +44,12 @@ ASM_PFX(InternalX86EnablePaging64): mov cr0, eax ; enable paging=0D retf ; topmost 2 dwords hold the addres= s=0D .0:=0D - DB 0x67, 0x48 ; 32-bit address size, 64-bit op= erand size=0D - mov ebx, [esp] ; mov rbx, [esp]=0D - DB 0x67, 0x48=0D - mov ecx, [esp + 8] ; mov rcx, [esp + 8]=0D - DB 0x67, 0x48=0D - mov edx, [esp + 0x10] ; mov rdx, [esp + 10h]=0D - DB 0x67, 0x48=0D - mov esp, [esp + 0x18] ; mov rsp, [esp + 18h]=0D - DB 0x48=0D - add esp, -0x20 ; add rsp, -20h=0D - call ebx ; call rbx=0D +BITS 64=0D + mov rbx, [esp]=0D + mov rcx, [esp + 8]=0D + mov rdx, [esp + 0x10]=0D + mov rsp, [esp + 0x18]=0D + add rsp, -0x20=0D + call rbx=0D hlt ; no one should get here=0D =0D diff --git a/MdePkg/Library/BaseLib/Ia32/LongJump.nasm b/MdePkg/Library/Bas= eLib/Ia32/LongJump.nasm index f94d10f806..6c13dfe307 100644 --- a/MdePkg/Library/BaseLib/Ia32/LongJump.nasm +++ b/MdePkg/Library/BaseLib/Ia32/LongJump.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006 - 2019, 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 ; Module Name:=0D @@ -39,12 +39,12 @@ ASM_PFX(InternalLongJump): =0D mov edx, [esp + 4] ; edx =3D JumpBuffer=0D mov edx, [edx + 24] ; edx =3D target SSP=0D - READSSP_EAX=0D + rdsspd eax=0D sub edx, eax ; edx =3D delta=0D mov eax, edx ; eax =3D delta=0D =0D shr eax, 2 ; eax =3D delta/sizeof(UINT32)=0D - INCSSP_EAX=0D + incsspd eax=0D =0D CetDone:=0D =0D diff --git a/MdePkg/Library/BaseLib/Ia32/Monitor.nasm b/MdePkg/Library/Base= Lib/Ia32/Monitor.nasm index 28dc0ba70a..70dbe66e27 100644 --- a/MdePkg/Library/BaseLib/Ia32/Monitor.nasm +++ b/MdePkg/Library/BaseLib/Ia32/Monitor.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -31,6 +31,6 @@ ASM_PFX(AsmMonitor): mov eax, [esp + 4]=0D mov ecx, [esp + 8]=0D mov edx, [esp + 12]=0D - DB 0xf, 1, 0xc8 ; monitor=0D + monitor=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/Ia32/Mwait.nasm b/MdePkg/Library/BaseLi= b/Ia32/Mwait.nasm index 3956940cab..2d36a97df6 100644 --- a/MdePkg/Library/BaseLib/Ia32/Mwait.nasm +++ b/MdePkg/Library/BaseLib/Ia32/Mwait.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -29,6 +29,6 @@ global ASM_PFX(AsmMwait) ASM_PFX(AsmMwait):=0D mov eax, [esp + 4]=0D mov ecx, [esp + 8]=0D - DB 0xf, 1, 0xc9 ; mwait=0D + mwait=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/Ia32/RdRand.nasm b/MdePkg/Library/BaseL= ib/Ia32/RdRand.nasm index e12b8e9611..d818b6ef55 100644 --- a/MdePkg/Library/BaseLib/Ia32/RdRand.nasm +++ b/MdePkg/Library/BaseLib/Ia32/RdRand.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
=0D +; Copyright (c) 2015 - 2022, Intel Corporation. All rights reserved.
=0D ; SPDX-License-Identifier: BSD-2-Clause-Patent=0D ;=0D ; Module Name:=0D @@ -25,9 +25,8 @@ SECTION .text ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(InternalX86RdRand16)=0D ASM_PFX(InternalX86RdRand16):=0D - ; rdrand ax ; generate a 16 bit RN into ax=0D + rdrand eax ; generate a 16 bit RN into ax=0D ; CF=3D1 if RN generated ok, otherwise = CF=3D0=0D - db 0xf, 0xc7, 0xf0 ; rdrand r16: "0f c7 /6 ModRM:r/m(w)"= =0D jc rn16_ok ; jmp if CF=3D1=0D xor eax, eax ; reg=3D0 if CF=3D0=0D ret ; return with failure status=0D @@ -45,9 +44,8 @@ rn16_ok: ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(InternalX86RdRand32)=0D ASM_PFX(InternalX86RdRand32):=0D - ; rdrand eax ; generate a 32 bit RN into eax=0D + rdrand eax ; generate a 32 bit RN into eax=0D ; CF=3D1 if RN generated ok, otherwise = CF=3D0=0D - db 0xf, 0xc7, 0xf0 ; rdrand r32: "0f c7 /6 ModRM:r/m(w)"= =0D jc rn32_ok ; jmp if CF=3D1=0D xor eax, eax ; reg=3D0 if CF=3D0=0D ret ; return with failure status=0D @@ -65,14 +63,13 @@ rn32_ok: ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(InternalX86RdRand64)=0D ASM_PFX(InternalX86RdRand64):=0D - ; rdrand eax ; generate a 32 bit RN into eax=0D + rdrand eax ; generate a 32 bit RN into eax=0D ; CF=3D1 if RN generated ok, otherwise = CF=3D0=0D - db 0xf, 0xc7, 0xf0 ; rdrand r32: "0f c7 /6 ModRM:r/m(w)"= =0D jnc rn64_ret ; jmp if CF=3D0=0D mov edx, dword [esp + 4]=0D mov [edx], eax=0D =0D - db 0xf, 0xc7, 0xf0 ; generate another 32 bit RN=0D + rdrand eax ; generate another 32 bit RN=0D jnc rn64_ret ; jmp if CF=3D0=0D mov [edx + 4], eax=0D =0D diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr4.nasm b/MdePkg/Library/Base= Lib/Ia32/ReadDr4.nasm index 81c681de34..1c312b670d 100644 --- a/MdePkg/Library/BaseLib/Ia32/ReadDr4.nasm +++ b/MdePkg/Library/BaseLib/Ia32/ReadDr4.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -31,8 +31,8 @@ ASM_PFX(AsmReadDr4): ; this register will cause a #UD exception.=0D ;=0D ; MS assembler doesn't support this instruction since no one would use= it=0D - ; under normal circustances. Here opcode is used.=0D + ; under normal circustances.=0D ;=0D - DB 0xf, 0x21, 0xe0=0D + mov eax, dr4=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/Ia32/ReadDr5.nasm b/MdePkg/Library/Base= Lib/Ia32/ReadDr5.nasm index e2deacb832..07a1b44a00 100644 --- a/MdePkg/Library/BaseLib/Ia32/ReadDr5.nasm +++ b/MdePkg/Library/BaseLib/Ia32/ReadDr5.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -31,8 +31,8 @@ ASM_PFX(AsmReadDr5): ; this register will cause a #UD exception.=0D ;=0D ; MS assembler doesn't support this instruction since no one would use= it=0D - ; under normal circustances. Here opcode is used.=0D + ; under normal circustances.=0D ;=0D - DB 0xf, 0x21, 0xe8=0D + mov eax, dr5=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/Ia32/SetJump.nasm b/MdePkg/Library/Base= Lib/Ia32/SetJump.nasm index 364613b5f9..2577373241 100644 --- a/MdePkg/Library/BaseLib/Ia32/SetJump.nasm +++ b/MdePkg/Library/BaseLib/Ia32/SetJump.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006 - 2019, 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 ; Module Name:=0D @@ -46,8 +46,8 @@ ASM_PFX(SetJump): jnc CetDone=0D =0D mov eax, 1=0D - INCSSP_EAX ; to read original SSP=0D - READSSP_EAX=0D + incsspd eax ; to read original SSP=0D + rdsspd eax=0D mov [edx + 0x24], eax ; save SSP=0D =0D CetDone:=0D diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr4.nasm b/MdePkg/Library/Bas= eLib/Ia32/WriteDr4.nasm index 0d23fca111..b8479b39f7 100644 --- a/MdePkg/Library/BaseLib/Ia32/WriteDr4.nasm +++ b/MdePkg/Library/BaseLib/Ia32/WriteDr4.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -32,8 +32,8 @@ ASM_PFX(AsmWriteDr4): ; this register will cause a #UD exception.=0D ;=0D ; MS assembler doesn't support this instruction since no one would use= it=0D - ; under normal circustances. Here opcode is used.=0D + ; under normal circustances.=0D ;=0D - DB 0xf, 0x23, 0xe0=0D + mov dr4, eax=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/Ia32/WriteDr5.nasm b/MdePkg/Library/Bas= eLib/Ia32/WriteDr5.nasm index bc5f424b8d..3545561025 100644 --- a/MdePkg/Library/BaseLib/Ia32/WriteDr5.nasm +++ b/MdePkg/Library/BaseLib/Ia32/WriteDr5.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -32,8 +32,8 @@ ASM_PFX(AsmWriteDr5): ; this register will cause a #UD exception.=0D ;=0D ; MS assembler doesn't support this instruction since no one would use= it=0D - ; under normal circustances. Here opcode is used.=0D + ; under normal circustances.=0D ;=0D - DB 0xf, 0x23, 0xe8=0D + mov dr5, eax=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/DisablePaging64.nasm b/MdePkg/Libra= ry/BaseLib/X64/DisablePaging64.nasm index c76ed1a76c..200c408d9a 100644 --- a/MdePkg/Library/BaseLib/X64/DisablePaging64.nasm +++ b/MdePkg/Library/BaseLib/X64/DisablePaging64.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006 - 2008, 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 ; Module Name:=0D @@ -51,8 +51,7 @@ ASM_PFX(InternalX86DisablePaging64): sub eax, 4 ; eax <- One slot below transition= code on the stack=0D push rcx ; push Cs to stack=0D push r10 ; push address of tansition code o= n stack=0D - DB 0x48 ; prefix to composite "retq" with= next "retf"=0D - retf ; Use far return to load CS regist= er from stack=0D + retfq=0D =0D ; Start of transition code=0D .0:=0D diff --git a/MdePkg/Library/BaseLib/X64/LongJump.nasm b/MdePkg/Library/Base= Lib/X64/LongJump.nasm index 59f7092169..2002f65cba 100644 --- a/MdePkg/Library/BaseLib/X64/LongJump.nasm +++ b/MdePkg/Library/BaseLib/X64/LongJump.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006 - 2019, 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 ; Module Name:=0D @@ -41,12 +41,12 @@ ASM_PFX(InternalLongJump): push rdx ; save rdx=0D =0D mov rdx, [rcx + 0xF8] ; rdx =3D target SSP=0D - READSSP_RAX=0D + rdsspq rax=0D sub rdx, rax ; rdx =3D delta=0D mov rax, rdx ; rax =3D delta=0D =0D shr rax, 3 ; rax =3D delta/sizeof(UINT64)=0D - INCSSP_RAX=0D + incsspq rax=0D =0D pop rdx ; restore rdx=0D CetDone:=0D diff --git a/MdePkg/Library/BaseLib/X64/Monitor.nasm b/MdePkg/Library/BaseL= ib/X64/Monitor.nasm index e1ccb83a85..210037d402 100644 --- a/MdePkg/Library/BaseLib/X64/Monitor.nasm +++ b/MdePkg/Library/BaseLib/X64/Monitor.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -32,6 +32,6 @@ ASM_PFX(AsmMonitor): mov eax, ecx=0D mov ecx, edx=0D mov edx, r8d=0D - DB 0xf, 1, 0xc8 ; monitor=0D + monitor=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/Mwait.nasm b/MdePkg/Library/BaseLib= /X64/Mwait.nasm index 83fc895491..c8ad59588b 100644 --- a/MdePkg/Library/BaseLib/X64/Mwait.nasm +++ b/MdePkg/Library/BaseLib/X64/Mwait.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -30,6 +30,6 @@ global ASM_PFX(AsmMwait) ASM_PFX(AsmMwait):=0D mov eax, ecx=0D mov ecx, edx=0D - DB 0xf, 1, 0xc9 ; mwait=0D + mwait=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/RdRand.nasm b/MdePkg/Library/BaseLi= b/X64/RdRand.nasm index 7e7fe99670..73479be8d3 100644 --- a/MdePkg/Library/BaseLib/X64/RdRand.nasm +++ b/MdePkg/Library/BaseLib/X64/RdRand.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
=0D +; Copyright (c) 2015 - 2022, Intel Corporation. All rights reserved.
=0D ; SPDX-License-Identifier: BSD-2-Clause-Patent=0D ;=0D ; Module Name:=0D @@ -26,9 +26,8 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(InternalX86RdRand16)=0D ASM_PFX(InternalX86RdRand16):=0D - ; rdrand ax ; generate a 16 bit RN into eax,=0D + rdrand eax ; generate a 16 bit RN into eax,=0D ; CF=3D1 if RN generated ok, otherwise = CF=3D0=0D - db 0xf, 0xc7, 0xf0 ; rdrand r16: "0f c7 /6 ModRM:r/m(w)"= =0D jc rn16_ok ; jmp if CF=3D1=0D xor rax, rax ; reg=3D0 if CF=3D0=0D ret ; return with failure status=0D @@ -45,9 +44,8 @@ rn16_ok: ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(InternalX86RdRand32)=0D ASM_PFX(InternalX86RdRand32):=0D - ; rdrand eax ; generate a 32 bit RN into eax,=0D + rdrand eax ; generate a 32 bit RN into eax,=0D ; CF=3D1 if RN generated ok, otherwise = CF=3D0=0D - db 0xf, 0xc7, 0xf0 ; rdrand r32: "0f c7 /6 ModRM:r/m(w)"= =0D jc rn32_ok ; jmp if CF=3D1=0D xor rax, rax ; reg=3D0 if CF=3D0=0D ret ; return with failure status=0D @@ -64,9 +62,8 @@ rn32_ok: ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(InternalX86RdRand64)=0D ASM_PFX(InternalX86RdRand64):=0D - ; rdrand rax ; generate a 64 bit RN into rax,=0D + rdrand rax ; generate a 64 bit RN into rax,=0D ; CF=3D1 if RN generated ok, otherwise = CF=3D0=0D - db 0x48, 0xf, 0xc7, 0xf0 ; rdrand r64: "REX.W + 0f c7 /6 ModRM:r= /m(w)"=0D jc rn64_ok ; jmp if CF=3D1=0D xor rax, rax ; reg=3D0 if CF=3D0=0D ret ; return with failure status=0D diff --git a/MdePkg/Library/BaseLib/X64/ReadDr4.nasm b/MdePkg/Library/BaseL= ib/X64/ReadDr4.nasm index 82c0a9a588..90b2172cee 100644 --- a/MdePkg/Library/BaseLib/X64/ReadDr4.nasm +++ b/MdePkg/Library/BaseLib/X64/ReadDr4.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -31,6 +31,6 @@ ASM_PFX(AsmReadDr4): ; There's no obvious reason to access this register, since it's aliase= d to=0D ; DR7 when DE=3D0 or an exception generated when DE=3D1=0D ;=0D - DB 0xf, 0x21, 0xe0=0D + mov rax, dr4=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/ReadDr5.nasm b/MdePkg/Library/BaseL= ib/X64/ReadDr5.nasm index c309c66dfe..c1143f4498 100644 --- a/MdePkg/Library/BaseLib/X64/ReadDr5.nasm +++ b/MdePkg/Library/BaseLib/X64/ReadDr5.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -31,6 +31,6 @@ ASM_PFX(AsmReadDr5): ; There's no obvious reason to access this register, since it's aliase= d to=0D ; DR7 when DE=3D0 or an exception generated when DE=3D1=0D ;=0D - DB 0xf, 0x21, 0xe8=0D + mov rax, dr5=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/ReadMm0.nasm b/MdePkg/Library/BaseL= ib/X64/ReadMm0.nasm index 615721b6aa..e64b2c7882 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm0.nasm +++ b/MdePkg/Library/BaseLib/X64/ReadMm0.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -27,9 +27,6 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(AsmReadMm0)=0D ASM_PFX(AsmReadMm0):=0D - ;=0D - ; 64-bit MASM doesn't support MMX instructions, so use opcode here=0D - ;=0D - DB 0x48, 0xf, 0x7e, 0xc0=0D + movq rax, mm0=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/ReadMm1.nasm b/MdePkg/Library/BaseL= ib/X64/ReadMm1.nasm index 7b27393490..bec3c71207 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm1.nasm +++ b/MdePkg/Library/BaseLib/X64/ReadMm1.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -27,9 +27,6 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(AsmReadMm1)=0D ASM_PFX(AsmReadMm1):=0D - ;=0D - ; 64-bit MASM doesn't support MMX instructions, so use opcode here=0D - ;=0D - DB 0x48, 0xf, 0x7e, 0xc8=0D + movq rax, mm1=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/ReadMm2.nasm b/MdePkg/Library/BaseL= ib/X64/ReadMm2.nasm index c654b91a7a..4c880697cb 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm2.nasm +++ b/MdePkg/Library/BaseLib/X64/ReadMm2.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -27,9 +27,6 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(AsmReadMm2)=0D ASM_PFX(AsmReadMm2):=0D - ;=0D - ; 64-bit MASM doesn't support MMX instructions, so use opcode here=0D - ;=0D - DB 0x48, 0xf, 0x7e, 0xd0=0D + movq rax, mm2=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/ReadMm3.nasm b/MdePkg/Library/BaseL= ib/X64/ReadMm3.nasm index 88d51c0781..cf81e5a7ab 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm3.nasm +++ b/MdePkg/Library/BaseLib/X64/ReadMm3.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -27,9 +27,6 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(AsmReadMm3)=0D ASM_PFX(AsmReadMm3):=0D - ;=0D - ; 64-bit MASM doesn't support MMX instructions, so use opcode here=0D - ;=0D - DB 0x48, 0xf, 0x7e, 0xd8=0D + movq rax, mm3=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/ReadMm4.nasm b/MdePkg/Library/BaseL= ib/X64/ReadMm4.nasm index 4252d20bb1..17ba364e32 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm4.nasm +++ b/MdePkg/Library/BaseLib/X64/ReadMm4.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -27,9 +27,6 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(AsmReadMm4)=0D ASM_PFX(AsmReadMm4):=0D - ;=0D - ; 64-bit MASM doesn't support MMX instructions, so use opcode here=0D - ;=0D - DB 0x48, 0xf, 0x7e, 0xe0=0D + movq rax, mm4=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/ReadMm5.nasm b/MdePkg/Library/BaseL= ib/X64/ReadMm5.nasm index d8f530dec8..f1354dd68c 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm5.nasm +++ b/MdePkg/Library/BaseLib/X64/ReadMm5.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -27,9 +27,6 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(AsmReadMm5)=0D ASM_PFX(AsmReadMm5):=0D - ;=0D - ; 64-bit MASM doesn't support MMX instructions, so use opcode here=0D - ;=0D - DB 0x48, 0xf, 0x7e, 0xe8=0D + movq rax, mm5=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/ReadMm6.nasm b/MdePkg/Library/BaseL= ib/X64/ReadMm6.nasm index 6f6883c2b6..9d5a287218 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm6.nasm +++ b/MdePkg/Library/BaseLib/X64/ReadMm6.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -27,9 +27,6 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(AsmReadMm6)=0D ASM_PFX(AsmReadMm6):=0D - ;=0D - ; 64-bit MASM doesn't support MMX instructions, so use opcode here=0D - ;=0D - DB 0x48, 0xf, 0x7e, 0xf0=0D + movq rax, mm6=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/ReadMm7.nasm b/MdePkg/Library/BaseL= ib/X64/ReadMm7.nasm index 573f15dfc8..ae15f24d8b 100644 --- a/MdePkg/Library/BaseLib/X64/ReadMm7.nasm +++ b/MdePkg/Library/BaseLib/X64/ReadMm7.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -27,9 +27,6 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(AsmReadMm7)=0D ASM_PFX(AsmReadMm7):=0D - ;=0D - ; 64-bit MASM doesn't support MMX instructions, so use opcode here=0D - ;=0D - DB 0x48, 0xf, 0x7e, 0xf8=0D + movq rax, mm7=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/SetJump.nasm b/MdePkg/Library/BaseL= ib/X64/SetJump.nasm index 5a68396eec..5943a5ebe5 100644 --- a/MdePkg/Library/BaseLib/X64/SetJump.nasm +++ b/MdePkg/Library/BaseLib/X64/SetJump.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006 - 2019, 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 ; Module Name:=0D @@ -48,8 +48,8 @@ ASM_PFX(SetJump): jnc CetDone=0D =0D mov rax, 1=0D - INCSSP_RAX ; to read original SSP=0D - READSSP_RAX=0D + incsspq rax ; to read original SSP=0D + rdsspq rax=0D mov [rcx + 0xF8], rax ; save SSP=0D =0D CetDone:=0D diff --git a/MdePkg/Library/BaseLib/X64/WriteDr4.nasm b/MdePkg/Library/Base= Lib/X64/WriteDr4.nasm index c4b12c9e92..5e4d96015e 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr4.nasm +++ b/MdePkg/Library/BaseLib/X64/WriteDr4.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -31,7 +31,7 @@ ASM_PFX(AsmWriteDr4): ; There's no obvious reason to access this register, since it's aliase= d to=0D ; DR6 when DE=3D0 or an exception generated when DE=3D1=0D ;=0D - DB 0xf, 0x23, 0xe1=0D + mov dr4, rcx=0D mov rax, rcx=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/WriteDr5.nasm b/MdePkg/Library/Base= Lib/X64/WriteDr5.nasm index 986a4a95d9..d5d4e2f324 100644 --- a/MdePkg/Library/BaseLib/X64/WriteDr5.nasm +++ b/MdePkg/Library/BaseLib/X64/WriteDr5.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006 - 2008, 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 ; Module Name:=0D @@ -31,7 +31,7 @@ ASM_PFX(AsmWriteDr5): ; There's no obvious reason to access this register, since it's aliase= d to=0D ; DR7 when DE=3D0 or an exception generated when DE=3D1=0D ;=0D - DB 0xf, 0x23, 0xe9=0D + mov dr5, rcx=0D mov rax, rcx=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/WriteMm0.nasm b/MdePkg/Library/Base= Lib/X64/WriteMm0.nasm index 3f03529edf..e6b5a0fc33 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm0.nasm +++ b/MdePkg/Library/BaseLib/X64/WriteMm0.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -27,9 +27,6 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(AsmWriteMm0)=0D ASM_PFX(AsmWriteMm0):=0D - ;=0D - ; 64-bit MASM doesn't support MMX instructions, so use opcode here=0D - ;=0D - DB 0x48, 0xf, 0x6e, 0xc1=0D + movq mm0, rcx=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/WriteMm1.nasm b/MdePkg/Library/Base= Lib/X64/WriteMm1.nasm index f552d40716..414c6af6da 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm1.nasm +++ b/MdePkg/Library/BaseLib/X64/WriteMm1.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -27,9 +27,6 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(AsmWriteMm1)=0D ASM_PFX(AsmWriteMm1):=0D - ;=0D - ; 64-bit MASM doesn't support MMX instructions, so use opcode here=0D - ;=0D - DB 0x48, 0xf, 0x6e, 0xc9=0D + movq mm1, rcx=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/WriteMm2.nasm b/MdePkg/Library/Base= Lib/X64/WriteMm2.nasm index 1bd176ced9..525740342a 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm2.nasm +++ b/MdePkg/Library/BaseLib/X64/WriteMm2.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -27,9 +27,6 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(AsmWriteMm2)=0D ASM_PFX(AsmWriteMm2):=0D - ;=0D - ; 64-bit MASM doesn't support MMX instructions, so use opcode here=0D - ;=0D - DB 0x48, 0xf, 0x6e, 0xd1=0D + movq mm2, rcx=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/WriteMm3.nasm b/MdePkg/Library/Base= Lib/X64/WriteMm3.nasm index 403f140736..abf11bfb17 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm3.nasm +++ b/MdePkg/Library/BaseLib/X64/WriteMm3.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -27,9 +27,6 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(AsmWriteMm3)=0D ASM_PFX(AsmWriteMm3):=0D - ;=0D - ; 64-bit MASM doesn't support MMX instructions, so use opcode here=0D - ;=0D - DB 0x48, 0xf, 0x6e, 0xd9=0D + movq mm3, rcx=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/WriteMm4.nasm b/MdePkg/Library/Base= Lib/X64/WriteMm4.nasm index d99709d495..7cbd25e70a 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm4.nasm +++ b/MdePkg/Library/BaseLib/X64/WriteMm4.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -27,9 +27,6 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(AsmWriteMm4)=0D ASM_PFX(AsmWriteMm4):=0D - ;=0D - ; 64-bit MASM doesn't support MMX instructions, so use opcode here=0D - ;=0D - DB 0x48, 0xf, 0x6e, 0xe1=0D + movq mm4, rcx=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/WriteMm5.nasm b/MdePkg/Library/Base= Lib/X64/WriteMm5.nasm index 0467ac4220..9edfd0db83 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm5.nasm +++ b/MdePkg/Library/BaseLib/X64/WriteMm5.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -27,9 +27,6 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(AsmWriteMm5)=0D ASM_PFX(AsmWriteMm5):=0D - ;=0D - ; 64-bit MASM doesn't support MMX instructions, so use opcode here=0D - ;=0D - DB 0x48, 0xf, 0x6e, 0xe9=0D + movq mm5, rcx=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/WriteMm6.nasm b/MdePkg/Library/Base= Lib/X64/WriteMm6.nasm index 6d2e5eb8fb..4555563a55 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm6.nasm +++ b/MdePkg/Library/BaseLib/X64/WriteMm6.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -27,9 +27,6 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(AsmWriteMm6)=0D ASM_PFX(AsmWriteMm6):=0D - ;=0D - ; 64-bit MASM doesn't support MMX instructions, so use opcode here=0D - ;=0D - DB 0x48, 0xf, 0x6e, 0xf1=0D + movq mm6, rcx=0D ret=0D =0D diff --git a/MdePkg/Library/BaseLib/X64/WriteMm7.nasm b/MdePkg/Library/Base= Lib/X64/WriteMm7.nasm index de72adf685..4ef0eb5271 100644 --- a/MdePkg/Library/BaseLib/X64/WriteMm7.nasm +++ b/MdePkg/Library/BaseLib/X64/WriteMm7.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -27,9 +27,6 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(AsmWriteMm7)=0D ASM_PFX(AsmWriteMm7):=0D - ;=0D - ; 64-bit MASM doesn't support MMX instructions, so use opcode here=0D - ;=0D - DB 0x48, 0xf, 0x6e, 0xf9=0D + movq mm7, rcx=0D ret=0D =0D diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.nasm b/MdePkg/Libr= ary/BaseMemoryLibMmx/X64/CopyMem.nasm index 5769c00bf9..3b336c6bdf 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.nasm +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -44,15 +44,15 @@ ASM_PFX(InternalMemCopyMem): and r8, 7=0D shr rcx, 3 ; rcx <- # of Qwords to copy=0D jz @CopyBytes=0D - DB 0x49, 0xf, 0x7e, 0xc2 ; movd r10, mm0 (Save mm0 in r10= )=0D + movq r10, mm0=0D .1:=0D - DB 0xf, 0x6f, 0x6 ; movd mm0, [rsi]=0D - DB 0xf, 0xe7, 0x7 ; movntq [rdi], mm0=0D + movq mm0, [rsi]=0D + movntq [rdi], mm0=0D add rsi, 8=0D add rdi, 8=0D loop .1=0D mfence=0D - DB 0x49, 0xf, 0x6e, 0xc2 ; movd mm0, r10 (Restore mm0)=0D + movq mm0, r10=0D jmp @CopyBytes=0D @CopyBackward:=0D mov rsi, r9 ; rsi <- End of Source=0D diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.nasm b/MdePkg/Libra= ry/BaseMemoryLibMmx/X64/SetMem.nasm index 450113ba84..af584e3d34 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.nasm +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -32,16 +32,16 @@ ASM_PFX(InternalMemSetMem): push rdi=0D mov rax, r8=0D mov ah, al=0D - DB 0x48, 0xf, 0x6e, 0xc0 ; movd mm0, rax=0D + movq mm0, rax=0D mov r8, rcx=0D mov rdi, r8 ; rdi <- Buffer=0D mov rcx, rdx=0D and edx, 7=0D shr rcx, 3=0D jz @SetBytes=0D - DB 0xf, 0x70, 0xC0, 0x0 ; pshufw mm0, mm0, 0h=0D + pshufw mm0, mm0, 0=0D .0:=0D - DB 0xf, 0xe7, 0x7 ; movntq [rdi], mm0=0D + movntq [rdi], mm0=0D add rdi, 8=0D loop .0=0D mfence=0D diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.nasm b/MdePkg/Lib= rary/BaseMemoryLibMmx/X64/SetMem16.nasm index 4e1f4be2b4..7a63a1c50b 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.nasm +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -31,16 +31,16 @@ global ASM_PFX(InternalMemSetMem16) ASM_PFX(InternalMemSetMem16):=0D push rdi=0D mov rax, r8=0D - DB 0x48, 0xf, 0x6e, 0xc0 ; movd mm0, rax=0D + movq mm0, rax=0D mov r8, rcx=0D mov rdi, r8=0D mov rcx, rdx=0D and edx, 3=0D shr rcx, 2=0D jz @SetWords=0D - DB 0xf, 0x70, 0xC0, 0x0 ; pshufw mm0, mm0, 0h=0D + pshufw mm0, mm0, 0=0D .0:=0D - DB 0xf, 0xe7, 0x7 ; movntq [rdi], mm0=0D + movntq [rdi], mm0=0D add rdi, 8=0D loop .0=0D mfence=0D diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.nasm b/MdePkg/Lib= rary/BaseMemoryLibMmx/X64/SetMem32.nasm index b3a7385897..ab5f954826 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.nasm +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -28,20 +28,20 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(InternalMemSetMem32)=0D ASM_PFX(InternalMemSetMem32):=0D - DB 0x49, 0xf, 0x6e, 0xc0 ; movd mm0, r8 (Value)=0D + movq mm0, r8=0D mov rax, rcx ; rax <- Buffer=0D xchg rcx, rdx ; rcx <- Count rdx <- Buffer=0D shr rcx, 1 ; rcx <- # of qwords to set=0D jz @SetDwords=0D - DB 0xf, 0x70, 0xC0, 0x44 ; pshufw mm0, mm0, 44h=0D + pshufw mm0, mm0, 44h=0D .0:=0D - DB 0xf, 0xe7, 0x2 ; movntq [rdx], mm0=0D + movntq [rdx], mm0=0D lea rdx, [rdx + 8] ; use "lea" to avoid flag changes= =0D loop .0=0D mfence=0D @SetDwords:=0D jnc .1=0D - DB 0xf, 0x7e, 0x2 ; movd [rdx], mm0=0D + movd [rdx], mm0=0D .1:=0D ret=0D =0D diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.nasm b/MdePkg/Lib= rary/BaseMemoryLibMmx/X64/SetMem64.nasm index f517e1d23a..fcc44294a8 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.nasm +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -28,11 +28,11 @@ ;-------------------------------------------------------------------------= -----=0D global ASM_PFX(InternalMemSetMem64)=0D ASM_PFX(InternalMemSetMem64):=0D - DB 0x49, 0xf, 0x6e, 0xc0 ; movd mm0, r8 (Value)=0D + movq mm0, r8=0D mov rax, rcx ; rax <- Buffer=0D xchg rcx, rdx ; rcx <- Count=0D .0:=0D - DB 0xf, 0xe7, 0x2 ; movntq [rdx], mm0=0D + movntq [rdx], mm0=0D add rdx, 8=0D loop .0=0D mfence=0D diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.nasm b/MdePkg/Libr= ary/BaseMemoryLibMmx/X64/ZeroMem.nasm index 2a85f15b55..8b02eeb732 100644 --- a/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.nasm +++ b/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.nasm @@ -1,6 +1,6 @@ ;-------------------------------------------------------------------------= -----=0D ;=0D -; Copyright (c) 2006, 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 ; Module Name:=0D @@ -34,12 +34,12 @@ ASM_PFX(InternalMemZeroMem): and edx, 7=0D shr rcx, 3=0D jz @ZeroBytes=0D - DB 0xf, 0xef, 0xc0 ; pxor mm0, mm0=0D + pxor mm0, mm0=0D .0:=0D - DB 0xf, 0xe7, 7 ; movntq [rdi], mm0=0D + movntq [rdi], mm0=0D add rdi, 8=0D loop .0=0D - DB 0xf, 0xae, 0xf0 ; mfence=0D + mfence=0D @ZeroBytes:=0D xor eax, eax=0D mov ecx, edx=0D --=20 2.28.0.windows.1