MdePkg: Replace Opcode with the corresponding instructions.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3790

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 <yun.lou@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
This commit is contained in:
Jason
2022-01-10 21:46:27 +08:00
committed by mergify[bot]
parent 84338c0d49
commit d3febfd9ad
42 changed files with 116 additions and 175 deletions

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -44,16 +44,12 @@ ASM_PFX(InternalX86EnablePaging64):
mov cr0, eax ; enable paging mov cr0, eax ; enable paging
retf ; topmost 2 dwords hold the address retf ; topmost 2 dwords hold the address
.0: .0:
DB 0x67, 0x48 ; 32-bit address size, 64-bit operand size BITS 64
mov ebx, [esp] ; mov rbx, [esp] mov rbx, [esp]
DB 0x67, 0x48 mov rcx, [esp + 8]
mov ecx, [esp + 8] ; mov rcx, [esp + 8] mov rdx, [esp + 0x10]
DB 0x67, 0x48 mov rsp, [esp + 0x18]
mov edx, [esp + 0x10] ; mov rdx, [esp + 10h] add rsp, -0x20
DB 0x67, 0x48 call rbx
mov esp, [esp + 0x18] ; mov rsp, [esp + 18h]
DB 0x48
add esp, -0x20 ; add rsp, -20h
call ebx ; call rbx
hlt ; no one should get here hlt ; no one should get here

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -39,12 +39,12 @@ ASM_PFX(InternalLongJump):
mov edx, [esp + 4] ; edx = JumpBuffer mov edx, [esp + 4] ; edx = JumpBuffer
mov edx, [edx + 24] ; edx = target SSP mov edx, [edx + 24] ; edx = target SSP
READSSP_EAX rdsspd eax
sub edx, eax ; edx = delta sub edx, eax ; edx = delta
mov eax, edx ; eax = delta mov eax, edx ; eax = delta
shr eax, 2 ; eax = delta/sizeof(UINT32) shr eax, 2 ; eax = delta/sizeof(UINT32)
INCSSP_EAX incsspd eax
CetDone: CetDone:

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -31,6 +31,6 @@ ASM_PFX(AsmMonitor):
mov eax, [esp + 4] mov eax, [esp + 4]
mov ecx, [esp + 8] mov ecx, [esp + 8]
mov edx, [esp + 12] mov edx, [esp + 12]
DB 0xf, 1, 0xc8 ; monitor monitor
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -29,6 +29,6 @@ global ASM_PFX(AsmMwait)
ASM_PFX(AsmMwait): ASM_PFX(AsmMwait):
mov eax, [esp + 4] mov eax, [esp + 4]
mov ecx, [esp + 8] mov ecx, [esp + 8]
DB 0xf, 1, 0xc9 ; mwait mwait
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2015 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -25,9 +25,8 @@ SECTION .text
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(InternalX86RdRand16) global ASM_PFX(InternalX86RdRand16)
ASM_PFX(InternalX86RdRand16): ASM_PFX(InternalX86RdRand16):
; rdrand ax ; generate a 16 bit RN into ax rdrand eax ; generate a 16 bit RN into ax
; CF=1 if RN generated ok, otherwise CF=0 ; CF=1 if RN generated ok, otherwise CF=0
db 0xf, 0xc7, 0xf0 ; rdrand r16: "0f c7 /6 ModRM:r/m(w)"
jc rn16_ok ; jmp if CF=1 jc rn16_ok ; jmp if CF=1
xor eax, eax ; reg=0 if CF=0 xor eax, eax ; reg=0 if CF=0
ret ; return with failure status ret ; return with failure status
@ -45,9 +44,8 @@ rn16_ok:
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(InternalX86RdRand32) global ASM_PFX(InternalX86RdRand32)
ASM_PFX(InternalX86RdRand32): ASM_PFX(InternalX86RdRand32):
; rdrand eax ; generate a 32 bit RN into eax rdrand eax ; generate a 32 bit RN into eax
; CF=1 if RN generated ok, otherwise CF=0 ; CF=1 if RN generated ok, otherwise CF=0
db 0xf, 0xc7, 0xf0 ; rdrand r32: "0f c7 /6 ModRM:r/m(w)"
jc rn32_ok ; jmp if CF=1 jc rn32_ok ; jmp if CF=1
xor eax, eax ; reg=0 if CF=0 xor eax, eax ; reg=0 if CF=0
ret ; return with failure status ret ; return with failure status
@ -65,14 +63,13 @@ rn32_ok:
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(InternalX86RdRand64) global ASM_PFX(InternalX86RdRand64)
ASM_PFX(InternalX86RdRand64): ASM_PFX(InternalX86RdRand64):
; rdrand eax ; generate a 32 bit RN into eax rdrand eax ; generate a 32 bit RN into eax
; CF=1 if RN generated ok, otherwise CF=0 ; CF=1 if RN generated ok, otherwise CF=0
db 0xf, 0xc7, 0xf0 ; rdrand r32: "0f c7 /6 ModRM:r/m(w)"
jnc rn64_ret ; jmp if CF=0 jnc rn64_ret ; jmp if CF=0
mov edx, dword [esp + 4] mov edx, dword [esp + 4]
mov [edx], eax mov [edx], eax
db 0xf, 0xc7, 0xf0 ; generate another 32 bit RN rdrand eax ; generate another 32 bit RN
jnc rn64_ret ; jmp if CF=0 jnc rn64_ret ; jmp if CF=0
mov [edx + 4], eax mov [edx + 4], eax

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -31,8 +31,8 @@ ASM_PFX(AsmReadDr4):
; this register will cause a #UD exception. ; this register will cause a #UD exception.
; ;
; MS assembler doesn't support this instruction since no one would use it ; MS assembler doesn't support this instruction since no one would use it
; under normal circustances. Here opcode is used. ; under normal circustances.
; ;
DB 0xf, 0x21, 0xe0 mov eax, dr4
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -31,8 +31,8 @@ ASM_PFX(AsmReadDr5):
; this register will cause a #UD exception. ; this register will cause a #UD exception.
; ;
; MS assembler doesn't support this instruction since no one would use it ; MS assembler doesn't support this instruction since no one would use it
; under normal circustances. Here opcode is used. ; under normal circustances.
; ;
DB 0xf, 0x21, 0xe8 mov eax, dr5
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -46,8 +46,8 @@ ASM_PFX(SetJump):
jnc CetDone jnc CetDone
mov eax, 1 mov eax, 1
INCSSP_EAX ; to read original SSP incsspd eax ; to read original SSP
READSSP_EAX rdsspd eax
mov [edx + 0x24], eax ; save SSP mov [edx + 0x24], eax ; save SSP
CetDone: CetDone:

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -32,8 +32,8 @@ ASM_PFX(AsmWriteDr4):
; this register will cause a #UD exception. ; this register will cause a #UD exception.
; ;
; MS assembler doesn't support this instruction since no one would use it ; MS assembler doesn't support this instruction since no one would use it
; under normal circustances. Here opcode is used. ; under normal circustances.
; ;
DB 0xf, 0x23, 0xe0 mov dr4, eax
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -32,8 +32,8 @@ ASM_PFX(AsmWriteDr5):
; this register will cause a #UD exception. ; this register will cause a #UD exception.
; ;
; MS assembler doesn't support this instruction since no one would use it ; MS assembler doesn't support this instruction since no one would use it
; under normal circustances. Here opcode is used. ; under normal circustances.
; ;
DB 0xf, 0x23, 0xe8 mov dr5, eax
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -51,8 +51,7 @@ ASM_PFX(InternalX86DisablePaging64):
sub eax, 4 ; eax <- One slot below transition code on the stack sub eax, 4 ; eax <- One slot below transition code on the stack
push rcx ; push Cs to stack push rcx ; push Cs to stack
push r10 ; push address of tansition code on stack push r10 ; push address of tansition code on stack
DB 0x48 ; prefix to composite "retq" with next "retf" retfq
retf ; Use far return to load CS register from stack
; Start of transition code ; Start of transition code
.0: .0:

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -41,12 +41,12 @@ ASM_PFX(InternalLongJump):
push rdx ; save rdx push rdx ; save rdx
mov rdx, [rcx + 0xF8] ; rdx = target SSP mov rdx, [rcx + 0xF8] ; rdx = target SSP
READSSP_RAX rdsspq rax
sub rdx, rax ; rdx = delta sub rdx, rax ; rdx = delta
mov rax, rdx ; rax = delta mov rax, rdx ; rax = delta
shr rax, 3 ; rax = delta/sizeof(UINT64) shr rax, 3 ; rax = delta/sizeof(UINT64)
INCSSP_RAX incsspq rax
pop rdx ; restore rdx pop rdx ; restore rdx
CetDone: CetDone:

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -32,6 +32,6 @@ ASM_PFX(AsmMonitor):
mov eax, ecx mov eax, ecx
mov ecx, edx mov ecx, edx
mov edx, r8d mov edx, r8d
DB 0xf, 1, 0xc8 ; monitor monitor
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -30,6 +30,6 @@ global ASM_PFX(AsmMwait)
ASM_PFX(AsmMwait): ASM_PFX(AsmMwait):
mov eax, ecx mov eax, ecx
mov ecx, edx mov ecx, edx
DB 0xf, 1, 0xc9 ; mwait mwait
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2015 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -26,9 +26,8 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(InternalX86RdRand16) global ASM_PFX(InternalX86RdRand16)
ASM_PFX(InternalX86RdRand16): ASM_PFX(InternalX86RdRand16):
; rdrand ax ; generate a 16 bit RN into eax, rdrand eax ; generate a 16 bit RN into eax,
; CF=1 if RN generated ok, otherwise CF=0 ; CF=1 if RN generated ok, otherwise CF=0
db 0xf, 0xc7, 0xf0 ; rdrand r16: "0f c7 /6 ModRM:r/m(w)"
jc rn16_ok ; jmp if CF=1 jc rn16_ok ; jmp if CF=1
xor rax, rax ; reg=0 if CF=0 xor rax, rax ; reg=0 if CF=0
ret ; return with failure status ret ; return with failure status
@ -45,9 +44,8 @@ rn16_ok:
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(InternalX86RdRand32) global ASM_PFX(InternalX86RdRand32)
ASM_PFX(InternalX86RdRand32): ASM_PFX(InternalX86RdRand32):
; rdrand eax ; generate a 32 bit RN into eax, rdrand eax ; generate a 32 bit RN into eax,
; CF=1 if RN generated ok, otherwise CF=0 ; CF=1 if RN generated ok, otherwise CF=0
db 0xf, 0xc7, 0xf0 ; rdrand r32: "0f c7 /6 ModRM:r/m(w)"
jc rn32_ok ; jmp if CF=1 jc rn32_ok ; jmp if CF=1
xor rax, rax ; reg=0 if CF=0 xor rax, rax ; reg=0 if CF=0
ret ; return with failure status ret ; return with failure status
@ -64,9 +62,8 @@ rn32_ok:
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(InternalX86RdRand64) global ASM_PFX(InternalX86RdRand64)
ASM_PFX(InternalX86RdRand64): ASM_PFX(InternalX86RdRand64):
; rdrand rax ; generate a 64 bit RN into rax, rdrand rax ; generate a 64 bit RN into rax,
; CF=1 if RN generated ok, otherwise CF=0 ; CF=1 if RN generated ok, otherwise CF=0
db 0x48, 0xf, 0xc7, 0xf0 ; rdrand r64: "REX.W + 0f c7 /6 ModRM:r/m(w)"
jc rn64_ok ; jmp if CF=1 jc rn64_ok ; jmp if CF=1
xor rax, rax ; reg=0 if CF=0 xor rax, rax ; reg=0 if CF=0
ret ; return with failure status ret ; return with failure status

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -31,6 +31,6 @@ ASM_PFX(AsmReadDr4):
; There's no obvious reason to access this register, since it's aliased to ; There's no obvious reason to access this register, since it's aliased to
; DR7 when DE=0 or an exception generated when DE=1 ; DR7 when DE=0 or an exception generated when DE=1
; ;
DB 0xf, 0x21, 0xe0 mov rax, dr4
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -31,6 +31,6 @@ ASM_PFX(AsmReadDr5):
; There's no obvious reason to access this register, since it's aliased to ; There's no obvious reason to access this register, since it's aliased to
; DR7 when DE=0 or an exception generated when DE=1 ; DR7 when DE=0 or an exception generated when DE=1
; ;
DB 0xf, 0x21, 0xe8 mov rax, dr5
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -27,9 +27,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(AsmReadMm0) global ASM_PFX(AsmReadMm0)
ASM_PFX(AsmReadMm0): ASM_PFX(AsmReadMm0):
; movq rax, mm0
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 0x48, 0xf, 0x7e, 0xc0
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -27,9 +27,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(AsmReadMm1) global ASM_PFX(AsmReadMm1)
ASM_PFX(AsmReadMm1): ASM_PFX(AsmReadMm1):
; movq rax, mm1
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 0x48, 0xf, 0x7e, 0xc8
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -27,9 +27,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(AsmReadMm2) global ASM_PFX(AsmReadMm2)
ASM_PFX(AsmReadMm2): ASM_PFX(AsmReadMm2):
; movq rax, mm2
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 0x48, 0xf, 0x7e, 0xd0
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -27,9 +27,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(AsmReadMm3) global ASM_PFX(AsmReadMm3)
ASM_PFX(AsmReadMm3): ASM_PFX(AsmReadMm3):
; movq rax, mm3
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 0x48, 0xf, 0x7e, 0xd8
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -27,9 +27,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(AsmReadMm4) global ASM_PFX(AsmReadMm4)
ASM_PFX(AsmReadMm4): ASM_PFX(AsmReadMm4):
; movq rax, mm4
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 0x48, 0xf, 0x7e, 0xe0
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -27,9 +27,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(AsmReadMm5) global ASM_PFX(AsmReadMm5)
ASM_PFX(AsmReadMm5): ASM_PFX(AsmReadMm5):
; movq rax, mm5
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 0x48, 0xf, 0x7e, 0xe8
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -27,9 +27,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(AsmReadMm6) global ASM_PFX(AsmReadMm6)
ASM_PFX(AsmReadMm6): ASM_PFX(AsmReadMm6):
; movq rax, mm6
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 0x48, 0xf, 0x7e, 0xf0
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -27,9 +27,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(AsmReadMm7) global ASM_PFX(AsmReadMm7)
ASM_PFX(AsmReadMm7): ASM_PFX(AsmReadMm7):
; movq rax, mm7
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 0x48, 0xf, 0x7e, 0xf8
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -48,8 +48,8 @@ ASM_PFX(SetJump):
jnc CetDone jnc CetDone
mov rax, 1 mov rax, 1
INCSSP_RAX ; to read original SSP incsspq rax ; to read original SSP
READSSP_RAX rdsspq rax
mov [rcx + 0xF8], rax ; save SSP mov [rcx + 0xF8], rax ; save SSP
CetDone: CetDone:

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -31,7 +31,7 @@ ASM_PFX(AsmWriteDr4):
; There's no obvious reason to access this register, since it's aliased to ; There's no obvious reason to access this register, since it's aliased to
; DR6 when DE=0 or an exception generated when DE=1 ; DR6 when DE=0 or an exception generated when DE=1
; ;
DB 0xf, 0x23, 0xe1 mov dr4, rcx
mov rax, rcx mov rax, rcx
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -31,7 +31,7 @@ ASM_PFX(AsmWriteDr5):
; There's no obvious reason to access this register, since it's aliased to ; There's no obvious reason to access this register, since it's aliased to
; DR7 when DE=0 or an exception generated when DE=1 ; DR7 when DE=0 or an exception generated when DE=1
; ;
DB 0xf, 0x23, 0xe9 mov dr5, rcx
mov rax, rcx mov rax, rcx
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -27,9 +27,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(AsmWriteMm0) global ASM_PFX(AsmWriteMm0)
ASM_PFX(AsmWriteMm0): ASM_PFX(AsmWriteMm0):
; movq mm0, rcx
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 0x48, 0xf, 0x6e, 0xc1
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -27,9 +27,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(AsmWriteMm1) global ASM_PFX(AsmWriteMm1)
ASM_PFX(AsmWriteMm1): ASM_PFX(AsmWriteMm1):
; movq mm1, rcx
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 0x48, 0xf, 0x6e, 0xc9
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -27,9 +27,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(AsmWriteMm2) global ASM_PFX(AsmWriteMm2)
ASM_PFX(AsmWriteMm2): ASM_PFX(AsmWriteMm2):
; movq mm2, rcx
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 0x48, 0xf, 0x6e, 0xd1
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -27,9 +27,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(AsmWriteMm3) global ASM_PFX(AsmWriteMm3)
ASM_PFX(AsmWriteMm3): ASM_PFX(AsmWriteMm3):
; movq mm3, rcx
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 0x48, 0xf, 0x6e, 0xd9
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -27,9 +27,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(AsmWriteMm4) global ASM_PFX(AsmWriteMm4)
ASM_PFX(AsmWriteMm4): ASM_PFX(AsmWriteMm4):
; movq mm4, rcx
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 0x48, 0xf, 0x6e, 0xe1
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -27,9 +27,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(AsmWriteMm5) global ASM_PFX(AsmWriteMm5)
ASM_PFX(AsmWriteMm5): ASM_PFX(AsmWriteMm5):
; movq mm5, rcx
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 0x48, 0xf, 0x6e, 0xe9
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -27,9 +27,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(AsmWriteMm6) global ASM_PFX(AsmWriteMm6)
ASM_PFX(AsmWriteMm6): ASM_PFX(AsmWriteMm6):
; movq mm6, rcx
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 0x48, 0xf, 0x6e, 0xf1
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -27,9 +27,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(AsmWriteMm7) global ASM_PFX(AsmWriteMm7)
ASM_PFX(AsmWriteMm7): ASM_PFX(AsmWriteMm7):
; movq mm7, rcx
; 64-bit MASM doesn't support MMX instructions, so use opcode here
;
DB 0x48, 0xf, 0x6e, 0xf9
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -44,15 +44,15 @@ ASM_PFX(InternalMemCopyMem):
and r8, 7 and r8, 7
shr rcx, 3 ; rcx <- # of Qwords to copy shr rcx, 3 ; rcx <- # of Qwords to copy
jz @CopyBytes jz @CopyBytes
DB 0x49, 0xf, 0x7e, 0xc2 ; movd r10, mm0 (Save mm0 in r10) movq r10, mm0
.1: .1:
DB 0xf, 0x6f, 0x6 ; movd mm0, [rsi] movq mm0, [rsi]
DB 0xf, 0xe7, 0x7 ; movntq [rdi], mm0 movntq [rdi], mm0
add rsi, 8 add rsi, 8
add rdi, 8 add rdi, 8
loop .1 loop .1
mfence mfence
DB 0x49, 0xf, 0x6e, 0xc2 ; movd mm0, r10 (Restore mm0) movq mm0, r10
jmp @CopyBytes jmp @CopyBytes
@CopyBackward: @CopyBackward:
mov rsi, r9 ; rsi <- End of Source mov rsi, r9 ; rsi <- End of Source

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -32,16 +32,16 @@ ASM_PFX(InternalMemSetMem):
push rdi push rdi
mov rax, r8 mov rax, r8
mov ah, al mov ah, al
DB 0x48, 0xf, 0x6e, 0xc0 ; movd mm0, rax movq mm0, rax
mov r8, rcx mov r8, rcx
mov rdi, r8 ; rdi <- Buffer mov rdi, r8 ; rdi <- Buffer
mov rcx, rdx mov rcx, rdx
and edx, 7 and edx, 7
shr rcx, 3 shr rcx, 3
jz @SetBytes jz @SetBytes
DB 0xf, 0x70, 0xC0, 0x0 ; pshufw mm0, mm0, 0h pshufw mm0, mm0, 0
.0: .0:
DB 0xf, 0xe7, 0x7 ; movntq [rdi], mm0 movntq [rdi], mm0
add rdi, 8 add rdi, 8
loop .0 loop .0
mfence mfence

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -31,16 +31,16 @@ global ASM_PFX(InternalMemSetMem16)
ASM_PFX(InternalMemSetMem16): ASM_PFX(InternalMemSetMem16):
push rdi push rdi
mov rax, r8 mov rax, r8
DB 0x48, 0xf, 0x6e, 0xc0 ; movd mm0, rax movq mm0, rax
mov r8, rcx mov r8, rcx
mov rdi, r8 mov rdi, r8
mov rcx, rdx mov rcx, rdx
and edx, 3 and edx, 3
shr rcx, 2 shr rcx, 2
jz @SetWords jz @SetWords
DB 0xf, 0x70, 0xC0, 0x0 ; pshufw mm0, mm0, 0h pshufw mm0, mm0, 0
.0: .0:
DB 0xf, 0xe7, 0x7 ; movntq [rdi], mm0 movntq [rdi], mm0
add rdi, 8 add rdi, 8
loop .0 loop .0
mfence mfence

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -28,20 +28,20 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(InternalMemSetMem32) global ASM_PFX(InternalMemSetMem32)
ASM_PFX(InternalMemSetMem32): ASM_PFX(InternalMemSetMem32):
DB 0x49, 0xf, 0x6e, 0xc0 ; movd mm0, r8 (Value) movq mm0, r8
mov rax, rcx ; rax <- Buffer mov rax, rcx ; rax <- Buffer
xchg rcx, rdx ; rcx <- Count rdx <- Buffer xchg rcx, rdx ; rcx <- Count rdx <- Buffer
shr rcx, 1 ; rcx <- # of qwords to set shr rcx, 1 ; rcx <- # of qwords to set
jz @SetDwords jz @SetDwords
DB 0xf, 0x70, 0xC0, 0x44 ; pshufw mm0, mm0, 44h pshufw mm0, mm0, 44h
.0: .0:
DB 0xf, 0xe7, 0x2 ; movntq [rdx], mm0 movntq [rdx], mm0
lea rdx, [rdx + 8] ; use "lea" to avoid flag changes lea rdx, [rdx + 8] ; use "lea" to avoid flag changes
loop .0 loop .0
mfence mfence
@SetDwords: @SetDwords:
jnc .1 jnc .1
DB 0xf, 0x7e, 0x2 ; movd [rdx], mm0 movd [rdx], mm0
.1: .1:
ret ret

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -28,11 +28,11 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
global ASM_PFX(InternalMemSetMem64) global ASM_PFX(InternalMemSetMem64)
ASM_PFX(InternalMemSetMem64): ASM_PFX(InternalMemSetMem64):
DB 0x49, 0xf, 0x6e, 0xc0 ; movd mm0, r8 (Value) movq mm0, r8
mov rax, rcx ; rax <- Buffer mov rax, rcx ; rax <- Buffer
xchg rcx, rdx ; rcx <- Count xchg rcx, rdx ; rcx <- Count
.0: .0:
DB 0xf, 0xe7, 0x2 ; movntq [rdx], mm0 movntq [rdx], mm0
add rdx, 8 add rdx, 8
loop .0 loop .0
mfence mfence

View File

@ -1,6 +1,6 @@
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ;
; Copyright (c) 2006, Intel Corporation. All rights reserved.<BR> ; Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent ; SPDX-License-Identifier: BSD-2-Clause-Patent
; ;
; Module Name: ; Module Name:
@ -34,12 +34,12 @@ ASM_PFX(InternalMemZeroMem):
and edx, 7 and edx, 7
shr rcx, 3 shr rcx, 3
jz @ZeroBytes jz @ZeroBytes
DB 0xf, 0xef, 0xc0 ; pxor mm0, mm0 pxor mm0, mm0
.0: .0:
DB 0xf, 0xe7, 7 ; movntq [rdi], mm0 movntq [rdi], mm0
add rdi, 8 add rdi, 8
loop .0 loop .0
DB 0xf, 0xae, 0xf0 ; mfence mfence
@ZeroBytes: @ZeroBytes:
xor eax, eax xor eax, eax
mov ecx, edx mov ecx, edx