* [PATCH v3 01/14] UefiCpuPkg/SmmCpuFeaturesLib: Remove .S files for IA32 and X64 arch
2019-04-01 8:29 [PATCH v4 00/14] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg Shenglei Zhang
@ 2019-04-01 8:29 ` Shenglei Zhang
2019-04-01 8:29 ` [PATCH v3 02/14] UefiCpuPkg/BaseUefiCpuLib: " Shenglei Zhang
` (12 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Shenglei Zhang @ 2019-04-01 8:29 UTC (permalink / raw)
To: edk2-devel; +Cc: Michael D Kinney, Liming Gao
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
---
.../Library/SmmCpuFeaturesLib/Ia32/SmiEntry.S | 278 -----------------
.../SmmCpuFeaturesLib/Ia32/SmiException.S | 174 -----------
.../SmmCpuFeaturesLibStm.inf | 6 -
.../Library/SmmCpuFeaturesLib/X64/SmiEntry.S | 282 ------------------
.../SmmCpuFeaturesLib/X64/SmiException.S | 178 -----------
5 files changed, 918 deletions(-)
delete mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.S
delete mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiException.S
delete mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiEntry.S
delete mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.S
diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.S b/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.S
deleted file mode 100644
index 4c0f8c8933..0000000000
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.S
+++ /dev/null
@@ -1,278 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SmiEntry.S
-#
-# Abstract:
-#
-# Code template of the SMI handler for a particular processor
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(gcStmSmiHandlerTemplate)
-ASM_GLOBAL ASM_PFX(gcStmSmiHandlerSize)
-ASM_GLOBAL ASM_PFX(gcStmSmiHandlerOffset)
-ASM_GLOBAL ASM_PFX(gStmSmiCr3)
-ASM_GLOBAL ASM_PFX(gStmSmiStack)
-ASM_GLOBAL ASM_PFX(gStmSmbase)
-ASM_GLOBAL ASM_PFX(gStmXdSupported)
-ASM_GLOBAL ASM_PFX(FeaturePcdGet (PcdCpuSmmStackGuard))
-ASM_GLOBAL ASM_PFX(gStmSmiHandlerIdtr)
-
-.equ MSR_IA32_MISC_ENABLE, 0x1A0
-.equ MSR_EFER, 0xc0000080
-.equ MSR_EFER_XD, 0x800
-
-#
-# Constants relating to TXT_PROCESSOR_SMM_DESCRIPTOR
-#
-.equ DSC_OFFSET, 0xfb00
-.equ DSC_GDTPTR, 0x48
-.equ DSC_GDTSIZ, 0x50
-.equ DSC_CS, 0x14
-.equ DSC_DS, 0x16
-.equ DSC_SS, 0x18
-.equ DSC_OTHERSEG, 0x1A
-
-.equ PROTECT_MODE_CS, 0x08
-.equ PROTECT_MODE_DS, 0x20
-.equ TSS_SEGMENT, 0x40
-
- .text
-ASM_PFX(gcStmSmiHandlerTemplate):
-
-_StmSmiEntryPoint:
- .byte 0xbb # mov bx, imm16
- .word _StmGdtDesc - _StmSmiEntryPoint + 0x8000
- .byte 0x2e,0xa1 # mov ax, cs:[offset16]
- .word DSC_OFFSET + DSC_GDTSIZ
- decl %eax
- movl %eax, %cs:(%edi) # mov cs:[bx], ax
- .byte 0x66,0x2e,0xa1 # mov eax, cs:[offset16]
- .word DSC_OFFSET + DSC_GDTPTR
- movw %ax, %cs:2(%edi)
- movw %ax, %bp # ebp = GDT base
- .byte 0x66
- lgdt %cs:(%edi)
-# Patch ProtectedMode Segment
- .byte 0xb8 # mov ax, imm16
- .word PROTECT_MODE_CS # set AX for segment directly
- movl %eax, %cs:-2(%edi) # mov cs:[bx - 2], ax
-# Patch ProtectedMode entry
- .byte 0x66, 0xbf # mov edi, SMBASE
-ASM_PFX(gStmSmbase): .space 4
- .byte 0x67
- lea ((Start32bit - _StmSmiEntryPoint) + 0x8000)(%edi), %ax
- movw %ax, %cs:-6(%edi)
- movl %cr0, %ebx
- .byte 0x66
- andl $0x9ffafff3, %ebx
- .byte 0x66
- orl $0x23, %ebx
- movl %ebx, %cr0
- .byte 0x66,0xea
- .space 4
- .space 2
-_StmGdtDesc: .space 4
- .space 2
-
-Start32bit:
- movw $PROTECT_MODE_DS, %ax
- movl %eax,%ds
- movl %eax,%es
- movl %eax,%fs
- movl %eax,%gs
- movl %eax,%ss
- .byte 0xbc # mov esp, imm32
-ASM_PFX(gStmSmiStack): .space 4
- movl $ASM_PFX(gStmSmiHandlerIdtr), %eax
- lidt (%eax)
- jmp ProtFlatMode
-
-ProtFlatMode:
- .byte 0xb8 # mov eax, imm32
-ASM_PFX(gStmSmiCr3): .space 4
- movl %eax, %cr3
-#
-# Need to test for CR4 specific bit support
-#
- movl $1, %eax
- cpuid # use CPUID to determine if specific CR4 bits are supported
- xorl %eax, %eax # Clear EAX
- testl $BIT2, %edx # Check for DE capabilities
- jz L8
- orl $BIT3, %eax
-L8:
- testl $BIT6, %edx # Check for PAE capabilities
- jz L9
- orl $BIT5, %eax
-L9:
- testl $BIT7, %edx # Check for MCE capabilities
- jz L10
- orl $BIT6, %eax
-L10:
- testl $BIT24, %edx # Check for FXSR capabilities
- jz L11
- orl $BIT9, %eax
-L11:
- testl $BIT25, %edx # Check for SSE capabilities
- jz L12
- orl $BIT10, %eax
-L12: # as cr4.PGE is not set here, refresh cr3
- movl %eax, %cr4 # in PreModifyMtrrs() to flush TLB.
-
- cmpb $0, ASM_PFX(FeaturePcdGet (PcdCpuSmmStackGuard))
- jz L5
-# Load TSS
- movb $0x89, (TSS_SEGMENT + 5)(%ebp) # clear busy flag
- movl $TSS_SEGMENT, %eax
- ltrw %ax
-L5:
-
-# enable NXE if supported
- .byte 0xb0 # mov al, imm8
-ASM_PFX(gStmXdSupported): .byte 1
- cmpb $0, %al
- jz SkipXd
-#
-# Check XD disable bit
-#
- movl $MSR_IA32_MISC_ENABLE, %ecx
- rdmsr
- pushl %edx # save MSR_IA32_MISC_ENABLE[63-32]
- testl $BIT2, %edx # MSR_IA32_MISC_ENABLE[34]
- jz L13
- andw $0x0FFFB, %dx # clear XD Disable bit if it is set
- wrmsr
-L13:
- movl $MSR_EFER, %ecx
- rdmsr
- orw $MSR_EFER_XD,%ax # enable NXE
- wrmsr
- jmp XdDone
-SkipXd:
- subl $4, %esp
-XdDone:
-
- movl %cr0, %ebx
- orl $0x080010023, %ebx # enable paging + WP + NE + MP + PE
- movl %ebx, %cr0
- leal DSC_OFFSET(%edi),%ebx
- movw DSC_DS(%ebx),%ax
- movl %eax, %ds
- movw DSC_OTHERSEG(%ebx),%ax
- movl %eax, %es
- movl %eax, %fs
- movl %eax, %gs
- movw DSC_SS(%ebx),%ax
- movl %eax, %ss
-
-CommonHandler:
- movl 4(%esp), %ebx
-
- pushl %ebx
- movl $ASM_PFX(CpuSmmDebugEntry), %eax
- call *%eax
- addl $4, %esp
-
- pushl %ebx
- movl $ASM_PFX(SmiRendezvous), %eax
- call *%eax
- addl $4, %esp
-
- pushl %ebx
- movl $ASM_PFX(CpuSmmDebugExit), %eax
- call *%eax
- addl $4, %esp
-
- movl $ASM_PFX(gStmXdSupported), %eax
- movb (%eax), %al
- cmpb $0, %al
- jz L16
- popl %edx # get saved MSR_IA32_MISC_ENABLE[63-32]
- testl $BIT2, %edx
- jz L16
- movl $MSR_IA32_MISC_ENABLE, %ecx
- rdmsr
- orw $BIT2, %dx # set XD Disable bit if it was set before entering into SMM
- wrmsr
-
-L16:
- rsm
-
-_StmSmiHandler:
-#
-# Check XD disable bit
-#
- xorl %esi, %esi
- movl $ASM_PFX(gStmXdSupported), %eax
- movb (%eax), %al
- cmpb $0, %al
- jz StmXdDone
- movl $MSR_IA32_MISC_ENABLE, %ecx
- rdmsr
- movl %edx, %esi # save MSR_IA32_MISC_ENABLE[63-32]
- testl $BIT2, %edx # MSR_IA32_MISC_ENABLE[34]
- jz L14
- andw $0x0FFFB, %dx # clear XD Disable bit if it is set
- wrmsr
-L14:
- movl $MSR_EFER, %ecx
- rdmsr
- orw $MSR_EFER_XD,%ax # enable NXE
- wrmsr
-StmXdDone:
- push %esi
-
- # below step is needed, because STM does not run above code.
- # we have to run below code to set IDT/CR0/CR4
- movl $ASM_PFX(gStmSmiHandlerIdtr), %eax
- lidt (%eax)
-
- movl %cr0, %eax
- orl $0x80010023, %eax # enable paging + WP + NE + MP + PE
- movl %eax, %cr0
-#
-# Need to test for CR4 specific bit support
-#
- movl $1, %eax
- cpuid # use CPUID to determine if specific CR4 bits are supported
- movl %cr4, %eax # init EAX
- testl $BIT2, %edx # Check for DE capabilities
- jz L28
- orl $BIT3, %eax
-L28:
- testl $BIT6, %edx # Check for PAE capabilities
- jz L29
- orl $BIT5, %eax
-L29:
- testl $BIT7, %edx # Check for MCE capabilities
- jz L30
- orl $BIT6, %eax
-L30:
- testl $BIT24, %edx # Check for FXSR capabilities
- jz L31
- orl $BIT9, %eax
-L31:
- testl $BIT25, %edx # Check for SSE capabilities
- jz L32
- orl $BIT10, %eax
-L32: # as cr4.PGE is not set here, refresh cr3
- movl %eax, %cr4 # in PreModifyMtrrs() to flush TLB.
- # STM init finish
- jmp CommonHandler
-
-
-ASM_PFX(gcStmSmiHandlerSize) : .word . - _StmSmiEntryPoint
-ASM_PFX(gcStmSmiHandlerOffset): .word _StmSmiHandler - _StmSmiEntryPoint
-
diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiException.S b/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiException.S
deleted file mode 100644
index 7d0057af80..0000000000
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiException.S
+++ /dev/null
@@ -1,174 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SmiException.S
-#
-# Abstract:
-#
-# Exception handlers used in SM mode
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(gcStmPsd)
-
-ASM_GLOBAL ASM_PFX(SmmStmExceptionHandler)
-ASM_GLOBAL ASM_PFX(SmmStmSetup)
-ASM_GLOBAL ASM_PFX(SmmStmTeardown)
-
-.equ MSR_IA32_MISC_ENABLE, 0x1A0
-.equ MSR_EFER, 0xc0000080
-.equ MSR_EFER_XD, 0x800
-
-.equ CODE_SEL, 0x08
-.equ DATA_SEL, 0x20
-.equ TSS_SEL, 0x40
-
- .data
-
-ASM_PFX(gcStmPsd):
- .ascii "TXTPSSIG"
- .word PSD_SIZE
- .word 1 # Version
- .long 0 # LocalApicId
- .byte 0x5 # Cr4Pse;Cr4Pae;Intel64Mode;ExecutionDisableOutsideSmrr
- .byte 0 # BIOS to STM
- .byte 0 # STM to BIOS
- .byte 0
- .word CODE_SEL
- .word DATA_SEL
- .word DATA_SEL
- .word DATA_SEL
- .word TSS_SEL
- .word 0
- .quad 0 # SmmCr3
- .long ASM_PFX(_OnStmSetup)
- .long 0
- .long ASM_PFX(_OnStmTeardown)
- .long 0
- .quad 0 # SmmSmiHandlerRip - SMM guest entrypoint
- .quad 0 # SmmSmiHandlerRsp
- .quad 0
- .long 0
- .long 0x80010100 # RequiredStmSmmRevId
- .long ASM_PFX(_OnException)
- .long 0
- .quad 0 # ExceptionStack
- .word DATA_SEL
- .word 0x1F # ExceptionFilter
- .long 0
- .quad 0
- .quad 0 # BiosHwResourceRequirementsPtr
- .quad 0 # AcpiRsdp
- .byte 0 # PhysicalAddressBits
-.equ PSD_SIZE, . - ASM_PFX(gcStmPsd)
-
- .text
-
-#------------------------------------------------------------------------------
-# SMM Exception handlers
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(_OnException)
-ASM_PFX(_OnException):
- movl %esp, %ecx
- pushl %ecx
- call ASM_PFX(SmmStmExceptionHandler)
- addl $4, %esp
-
- movl %eax, %ebx
- movl $4, %eax
- .byte 0xf, 0x1, 0xc1 # VMCALL
- jmp .
-
-ASM_GLOBAL ASM_PFX(_OnStmSetup)
-ASM_PFX(_OnStmSetup):
-#
-# Check XD disable bit
-#
- xorl %esi, %esi
- movl $ASM_PFX(gStmXdSupported), %eax
- movb (%eax), %al
- cmpb $0, %al
- jz StmXdDone1
- movl $MSR_IA32_MISC_ENABLE, %ecx
- rdmsr
- movl %edx, %esi # save MSR_IA32_MISC_ENABLE[63-32]
- testl $BIT2, %edx # MSR_IA32_MISC_ENABLE[34]
- jz L13
- andw $0x0FFFB, %dx # clear XD Disable bit if it is set
- wrmsr
-L13:
- movl $MSR_EFER, %ecx
- rdmsr
- orw $MSR_EFER_XD,%ax # enable NXE
- wrmsr
-StmXdDone1:
- push %esi
-
- call ASM_PFX(SmmStmSetup)
-
- movl $ASM_PFX(gStmXdSupported), %eax
- movb (%eax), %al
- cmpb $0, %al
- jz L14
- popl %edx # get saved MSR_IA32_MISC_ENABLE[63-32]
- testl $BIT2, %edx
- jz L14
- movl $MSR_IA32_MISC_ENABLE, %ecx
- rdmsr
- orw $BIT2, %dx # set XD Disable bit if it was set before entering into SMM
- wrmsr
-L14:
-
- rsm
-
-ASM_GLOBAL ASM_PFX(_OnStmTeardown)
-ASM_PFX(_OnStmTeardown):
-#
-# Check XD disable bit
-#
- xorl %esi, %esi
- movl $ASM_PFX(gStmXdSupported), %eax
- movb (%eax), %al
- cmpb $0, %al
- jz StmXdDone2
- movl $MSR_IA32_MISC_ENABLE, %ecx
- rdmsr
- movl %edx, %esi # save MSR_IA32_MISC_ENABLE[63-32]
- testl $BIT2, %edx # MSR_IA32_MISC_ENABLE[34]
- jz L15
- andw $0x0FFFB, %dx # clear XD Disable bit if it is set
- wrmsr
-L15:
- movl $MSR_EFER, %ecx
- rdmsr
- orw $MSR_EFER_XD,%ax # enable NXE
- wrmsr
-StmXdDone2:
- push %esi
-
- call ASM_PFX(SmmStmTeardown)
-
- movl $ASM_PFX(gStmXdSupported), %eax
- movb (%eax), %al
- cmpb $0, %al
- jz L16
- popl %edx # get saved MSR_IA32_MISC_ENABLE[63-32]
- testl $BIT2, %edx
- jz L16
- movl $MSR_IA32_MISC_ENABLE, %ecx
- rdmsr
- orw $BIT2, %dx # set XD Disable bit if it was set before entering into SMM
- wrmsr
-L16:
-
- rsm
diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
index c700644427..7fd0cc5d04 100644
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
+++ b/UefiCpuPkg/Library/SmmCpuFeaturesLib/SmmCpuFeaturesLibStm.inf
@@ -35,9 +35,6 @@
Ia32/SmiEntry.nasm
Ia32/SmiException.nasm
- Ia32/SmiEntry.S
- Ia32/SmiException.S
-
[Sources.X64]
X64/SmmStmSupport.c
@@ -45,9 +42,6 @@
X64/SmiEntry.nasm
X64/SmiException.nasm
- X64/SmiEntry.S
- X64/SmiException.S
-
[Packages]
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiEntry.S b/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiEntry.S
deleted file mode 100644
index 1f9f91ce10..0000000000
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiEntry.S
+++ /dev/null
@@ -1,282 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SmiEntry.S
-#
-# Abstract:
-#
-# Code template of the SMI handler for a particular processor
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(gcStmSmiHandlerTemplate)
-ASM_GLOBAL ASM_PFX(gcStmSmiHandlerSize)
-ASM_GLOBAL ASM_PFX(gcStmSmiHandlerOffset)
-ASM_GLOBAL ASM_PFX(gStmSmiCr3)
-ASM_GLOBAL ASM_PFX(gStmSmiStack)
-ASM_GLOBAL ASM_PFX(gStmSmbase)
-ASM_GLOBAL ASM_PFX(gStmXdSupported)
-ASM_GLOBAL ASM_PFX(gStmSmiHandlerIdtr)
-
-.equ MSR_IA32_MISC_ENABLE, 0x1A0
-.equ MSR_EFER, 0xc0000080
-.equ MSR_EFER_XD, 0x800
-
-#
-# Constants relating to TXT_PROCESSOR_SMM_DESCRIPTOR
-#
-.equ DSC_OFFSET, 0xfb00
-.equ DSC_GDTPTR, 0x48
-.equ DSC_GDTSIZ, 0x50
-.equ DSC_CS, 0x14
-.equ DSC_DS, 0x16
-.equ DSC_SS, 0x18
-.equ DSC_OTHERSEG, 0x1a
-#
-# Constants relating to CPU State Save Area
-#
-.equ SSM_DR6, 0xffd0
-.equ SSM_DR7, 0xffc8
-
-.equ PROTECT_MODE_CS, 0x08
-.equ PROTECT_MODE_DS, 0x20
-.equ LONG_MODE_CS, 0x38
-.equ TSS_SEGMENT, 0x40
-.equ GDT_SIZE, 0x50
-
- .text
-
-ASM_PFX(gcStmSmiHandlerTemplate):
-
-_StmSmiEntryPoint:
- #
- # The encoding of BX in 16-bit addressing mode is the same as of RDI in 64-
- # bit addressing mode. And that coincidence has been used in the following
- # "64-bit like" 16-bit code. Be aware that once RDI is referenced as a
- # base address register, it is actually BX that is referenced.
- #
- .byte 0xbb # mov bx, imm16
- .word _StmGdtDesc - _StmSmiEntryPoint + 0x8000
- #
- # fix GDT descriptor
- #
- .byte 0x2e,0xa1 # mov ax, cs:[offset16]
- .word DSC_OFFSET + DSC_GDTSIZ
- .byte 0x48 # dec ax
- .byte 0x2e
- movl %eax, (%rdi) # mov cs:[bx], ax
- .byte 0x66,0x2e,0xa1 # mov eax, cs:[offset16]
- .word DSC_OFFSET + DSC_GDTPTR
- .byte 0x2e
- movw %ax, 2(%rdi)
- .byte 0x66,0x2e
- lgdt (%rdi)
- #
- # Patch ProtectedMode Segment
- #
- .byte 0xb8
- .word PROTECT_MODE_CS
- .byte 0x2e
- movl %eax, -2(%rdi)
- #
- # Patch ProtectedMode entry
- #
- .byte 0x66, 0xbf # mov edi, SMBASE
-ASM_PFX(gStmSmbase): .space 4
- lea ((ProtectedMode - _StmSmiEntryPoint) + 0x8000)(%edi), %ax
- .byte 0x2e
- movw %ax, -6(%rdi)
- #
- # Switch into ProtectedMode
- #
- movq %cr0, %rbx
- .byte 0x66
- andl $0x9ffafff3, %ebx
- .byte 0x66
- orl $0x00000023, %ebx
-
- movq %rbx, %cr0
- .byte 0x66, 0xea
- .space 6
-
-_StmGdtDesc: .space 6
-
-ProtectedMode:
- movw $PROTECT_MODE_DS, %ax
- movl %eax, %ds
- movl %eax, %es
- movl %eax, %fs
- movl %eax, %gs
- movl %eax, %ss
- .byte 0xbc # mov esp, imm32
-ASM_PFX(gStmSmiStack): .space 4
- jmp ProtFlatMode
-
-ProtFlatMode:
- .byte 0xb8
-ASM_PFX(gStmSmiCr3): .space 4
- movq %rax, %cr3
- movl $0x668,%eax # as cr4.PGE is not set here, refresh cr3
- movq %rax, %cr4 # in PreModifyMtrrs() to flush TLB.
-# Load TSS
- subl $8, %esp # reserve room in stack
- sgdt (%rsp)
- movl 2(%rsp), %eax # eax = GDT base
- addl $8, %esp
- movb $0x89, %dl
- movb %dl, (TSS_SEGMENT + 5)(%rax) # clear busy flag
- movl $TSS_SEGMENT, %eax
- ltr %ax
-
-# enable NXE if supported
- .byte 0xb0 # mov al, imm8
-ASM_PFX(gStmXdSupported): .byte 1
- cmpb $0, %al
- jz SkipXd
-#
-# Check XD disable bit
-#
- movl $MSR_IA32_MISC_ENABLE, %ecx
- rdmsr
- subl $4, %esp
- pushq %rdx # save MSR_IA32_MISC_ENABLE[63-32]
- testl $BIT2, %edx # MSR_IA32_MISC_ENABLE[34]
- jz L13
- andw $0x0FFFB, %dx # clear XD Disable bit if it is set
- wrmsr
-L13:
- movl $MSR_EFER, %ecx
- rdmsr
- orw $MSR_EFER_XD,%ax # enable NXE
- wrmsr
- jmp XdDone
-SkipXd:
- subl $8, %esp
-XdDone:
-
- #
- # Switch to LongMode
- #
- pushq $LONG_MODE_CS # push cs hardcore here
- call Base # push return address for retf later
-Base:
- addl $(LongMode - Base), (%rsp) # offset for far retf, seg is the 1st arg
-
- movl $MSR_EFER, %ecx
- rdmsr
- orb $1,%ah # enable LME
- wrmsr
- movq %cr0, %rbx
- orl $0x080010023, %ebx # enable paging + WP + NE + MP + PE
- movq %rbx, %cr0
- retf
-LongMode: # long mode (64-bit code) starts here
- movabsq $ASM_PFX(gStmSmiHandlerIdtr), %rax
- lidt (%rax)
- lea (DSC_OFFSET)(%rdi), %ebx
- movw DSC_DS(%rbx), %ax
- movl %eax,%ds
- movw DSC_OTHERSEG(%rbx), %ax
- movl %eax,%es
- movl %eax,%fs
- movl %eax,%gs
- movw DSC_SS(%rbx), %ax
- movl %eax,%ss
-
-CommonHandler:
- movq 8(%rsp), %rbx
- # Save FP registers
-
- subq $0x200, %rsp
- .byte 0x48 # FXSAVE64
- fxsave (%rsp)
-
- addq $-0x20, %rsp
-
- movq %rbx, %rcx
- movabsq $ASM_PFX(CpuSmmDebugEntry), %rax
- call *%rax
-
- movq %rbx, %rcx
- movabsq $ASM_PFX(SmiRendezvous), %rax
- call *%rax
-
- movq %rbx, %rcx
- movabsq $ASM_PFX(CpuSmmDebugExit), %rax
- call *%rax
-
- addq $0x20, %rsp
-
- #
- # Restore FP registers
- #
- .byte 0x48 # FXRSTOR64
- fxrstor (%rsp)
-
- addq $0x200, %rsp
-
- movabsq $ASM_PFX(gStmXdSupported), %rax
- movb (%rax), %al
- cmpb $0, %al
- jz L16
- popq %rdx # get saved MSR_IA32_MISC_ENABLE[63-32]
- testl $BIT2, %edx
- jz L16
- movl $MSR_IA32_MISC_ENABLE, %ecx
- rdmsr
- orw $BIT2, %dx # set XD Disable bit if it was set before entering into SMM
- wrmsr
-
-L16:
- rsm
-
-_StmSmiHandler:
-#
-# Check XD disable bit
-#
- xorq %r8, %r8
- movabsq $ASM_PFX(gStmXdSupported), %rax
- movb (%rax), %al
- cmpb $0, %al
- jz StmXdDone
- movl $MSR_IA32_MISC_ENABLE, %ecx
- rdmsr
- movq %rdx, %r8 # save MSR_IA32_MISC_ENABLE[63-32]
- testl $BIT2, %edx # MSR_IA32_MISC_ENABLE[34]
- jz L14
- andw $0x0FFFB, %dx # clear XD Disable bit if it is set
- wrmsr
-L14:
- movl $MSR_EFER, %ecx
- rdmsr
- orw $MSR_EFER_XD,%ax # enable NXE
- wrmsr
-StmXdDone:
- pushq %r8
-
- # below step is needed, because STM does not run above code.
- # we have to run below code to set IDT/CR0/CR4
- movabsq $ASM_PFX(gStmSmiHandlerIdtr), %rax
- lidt (%rax)
-
- movq %cr0, %rax
- orl $0x80010023, %eax
- movq %rax, %cr0
- movq %cr4, %rax
- movl $0x668, %eax # as cr4.PGE is not set here, refresh cr3
- movq %rax, %cr4 # in PreModifyMtrrs() to flush TLB.
- # STM init finish
- jmp CommonHandler
-
-ASM_PFX(gcStmSmiHandlerSize) : .word . - _StmSmiEntryPoint
-ASM_PFX(gcStmSmiHandlerOffset): .word _StmSmiHandler - _StmSmiEntryPoint
diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.S b/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.S
deleted file mode 100644
index 4d0cd9ac6f..0000000000
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.S
+++ /dev/null
@@ -1,178 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SmiException.S
-#
-# Abstract:
-#
-# Exception handlers used in SM mode
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(gcStmPsd)
-
-ASM_GLOBAL ASM_PFX(SmmStmExceptionHandler)
-ASM_GLOBAL ASM_PFX(SmmStmSetup)
-ASM_GLOBAL ASM_PFX(SmmStmTeardown)
-
-.equ CODE_SEL, 0x38
-.equ DATA_SEL, 0x20
-.equ TR_SEL, 0x40
-
-.equ MSR_IA32_MISC_ENABLE, 0x1A0
-.equ MSR_EFER, 0x0c0000080
-.equ MSR_EFER_XD, 0x0800
-
- .data
-
-#
-# This structure serves as a template for all processors.
-#
-ASM_PFX(gcStmPsd):
- .ascii "TXTPSSIG"
- .word PSD_SIZE
- .word 1 # Version
- .long 0 # LocalApicId
- .byte 0xF # Cr4Pse;Cr4Pae;Intel64Mode;ExecutionDisableOutsideSmrr
- .byte 0 # BIOS to STM
- .byte 0 # STM to BIOS
- .byte 0
- .word CODE_SEL
- .word DATA_SEL
- .word DATA_SEL
- .word DATA_SEL
- .word TR_SEL
- .word 0
- .quad 0 # SmmCr3
- .quad ASM_PFX(_OnStmSetup)
- .quad ASM_PFX(_OnStmTeardown)
- .quad 0 # SmmSmiHandlerRip - SMM guest entrypoint
- .quad 0 # SmmSmiHandlerRsp
- .quad 0
- .long 0
- .long 0x80010100 # RequiredStmSmmRevId
- .quad ASM_PFX(_OnException)
- .quad 0 # ExceptionStack
- .word DATA_SEL
- .word 0x1F # ExceptionFilter
- .long 0
- .quad 0
- .quad 0 # BiosHwResourceRequirementsPtr
- .quad 0 # AcpiRsdp
- .byte 0 # PhysicalAddressBits
-.equ PSD_SIZE, . - ASM_PFX(gcStmPsd)
-
- .text
-#------------------------------------------------------------------------------
-# SMM Exception handlers
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(_OnException)
-ASM_PFX(_OnException):
- movq %rsp, %rcx
- subq $0x28, %rsp
- call ASM_PFX(SmmStmExceptionHandler)
- addq $0x28, %rsp
- movl %eax, %ebx
- movl $4, %eax
- .byte 0xf, 0x1, 0xc1 # VMCALL
- jmp .
-
-ASM_GLOBAL ASM_PFX(_OnStmSetup)
-ASM_PFX(_OnStmSetup):
-#
-# Check XD disable bit
-#
- xorq %r8, %r8
- movabsq $ASM_PFX(gStmXdSupported), %rax
- movb (%rax), %al
- cmpb $0, %al
- jz StmXdDone1
- movl $MSR_IA32_MISC_ENABLE, %ecx
- rdmsr
- movq %rdx, %r8 # save MSR_IA32_MISC_ENABLE[63-32]
- testl $BIT2, %edx # MSR_IA32_MISC_ENABLE[34]
- jz L13
- andw $0x0FFFB, %dx # clear XD Disable bit if it is set
- wrmsr
-L13:
- movl $MSR_EFER, %ecx
- rdmsr
- orw $MSR_EFER_XD,%ax # enable NXE
- wrmsr
-StmXdDone1:
- pushq %r8
-
- subq $0x20, %rsp
- call ASM_PFX(SmmStmSetup)
- addq 0x20, %rsp
-
- movabsq $ASM_PFX(gStmXdSupported), %rax
- movb (%rax), %al
- cmpb $0, %al
- jz L14
- popq %rdx # get saved MSR_IA32_MISC_ENABLE[63-32]
- testl $BIT2, %edx
- jz L14
- movl $MSR_IA32_MISC_ENABLE, %ecx
- rdmsr
- orw $BIT2, %dx # set XD Disable bit if it was set before entering into SMM
- wrmsr
-L14:
-
- rsm
-
-ASM_GLOBAL ASM_PFX(_OnStmTeardown)
-ASM_PFX(_OnStmTeardown):
-#
-# Check XD disable bit
-#
- xorq %r8, %r8
- movabsq $ASM_PFX(gStmXdSupported), %rax
- movb (%rax), %al
- cmpb $0, %al
- jz StmXdDone2
- movl $MSR_IA32_MISC_ENABLE, %ecx
- rdmsr
- movq %rdx, %r8 # save MSR_IA32_MISC_ENABLE[63-32]
- testl $BIT2, %edx # MSR_IA32_MISC_ENABLE[34]
- jz L15
- andw $0x0FFFB, %dx # clear XD Disable bit if it is set
- wrmsr
-L15:
- movl $MSR_EFER, %ecx
- rdmsr
- orw $MSR_EFER_XD,%ax # enable NXE
- wrmsr
-StmXdDone2:
- pushq %r8
-
- subq $0x20, %rsp
- call ASM_PFX(SmmStmTeardown)
- addq $0x20, %rsp
-
- movabsq $ASM_PFX(gStmXdSupported), %rax
- movb (%rax), %al
- cmpb $0, %al
- jz L16
- popq %rdx # get saved MSR_IA32_MISC_ENABLE[63-32]
- testl $BIT2, %edx
- jz L16
- movl $MSR_IA32_MISC_ENABLE, %ecx
- rdmsr
- orw $BIT2, %dx # set XD Disable bit if it was set before entering into SMM
- wrmsr
-L16:
-
- rsm
-
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 02/14] UefiCpuPkg/BaseUefiCpuLib: Remove .S files for IA32 and X64 arch
2019-04-01 8:29 [PATCH v4 00/14] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg Shenglei Zhang
2019-04-01 8:29 ` [PATCH v3 01/14] UefiCpuPkg/SmmCpuFeaturesLib: Remove .S files for IA32 and X64 arch Shenglei Zhang
@ 2019-04-01 8:29 ` Shenglei Zhang
2019-04-01 8:29 ` [PATCH v3 03/14] UefiCpuPkg/CpuExceptionHandlerLib:Remove.S " Shenglei Zhang
` (11 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Shenglei Zhang @ 2019-04-01 8:29 UTC (permalink / raw)
To: edk2-devel; +Cc: Michael D Kinney, Liming Gao
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
---
.../Library/BaseUefiCpuLib/BaseUefiCpuLib.inf | 2 -
.../BaseUefiCpuLib/Ia32/InitializeFpu.S | 73 -------------------
.../BaseUefiCpuLib/X64/InitializeFpu.S | 57 ---------------
3 files changed, 132 deletions(-)
delete mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.S
delete mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.S
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
index 5614452a88..2e9756e50e 100644
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
+++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
@@ -31,11 +31,9 @@
[Sources.IA32]
Ia32/InitializeFpu.nasm
- Ia32/InitializeFpu.S
[Sources.X64]
X64/InitializeFpu.nasm
- X64/InitializeFpu.S
[Packages]
MdePkg/MdePkg.dec
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.S b/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.S
deleted file mode 100644
index 0a1a9198f6..0000000000
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.S
+++ /dev/null
@@ -1,73 +0,0 @@
-#------------------------------------------------------------------------------
-#*
-#* Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
-#* This program and the accompanying materials
-#* are licensed and made available under the terms and conditions of the BSD License
-#* which accompanies this distribution. The full text of the license may be found at
-#* http://opensource.org/licenses/bsd-license.php
-#*
-#* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-#* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#*
-#*
-#------------------------------------------------------------------------------
-
-#
-# Float control word initial value:
-# all exceptions masked, double-precision, round-to-nearest
-#
-ASM_PFX(mFpuControlWord): .word 0x027F
-#
-# Multimedia-extensions control word:
-# all exceptions masked, round-to-nearest, flush to zero for masked underflow
-#
-ASM_PFX(mMmxControlWord): .long 0x01F80
-
-#
-# Initializes floating point units for requirement of UEFI specification.
-#
-# This function initializes floating-point control word to 0x027F (all exceptions
-# masked,double-precision, round-to-nearest) and multimedia-extensions control word
-# (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to zero
-# for masked underflow).
-#
-ASM_GLOBAL ASM_PFX(InitializeFloatingPointUnits)
-ASM_PFX(InitializeFloatingPointUnits):
-
- pushl %ebx
-
- #
- # Initialize floating point units
- #
- finit
- fldcw ASM_PFX(mFpuControlWord)
-
- #
- # Use CpuId instructuion (CPUID.01H:EDX.SSE[bit 25] = 1) to test
- # whether the processor supports SSE instruction.
- #
- movl $1, %eax
- cpuid
- btl $25, %edx
- jnc Done
-
- #
- # Set OSFXSR bit 9 in CR4
- #
- movl %cr4, %eax
- or $0x200, %eax
- movl %eax, %cr4
-
- #
- # The processor should support SSE instruction and we can use
- # ldmxcsr instruction
- #
- ldmxcsr ASM_PFX(mMmxControlWord)
-
-Done:
- popl %ebx
-
- ret
-
-#END
-
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.S b/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.S
deleted file mode 100644
index f0b0d3e264..0000000000
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.S
+++ /dev/null
@@ -1,57 +0,0 @@
-#------------------------------------------------------------------------------
-#*
-#* Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
-#* This program and the accompanying materials
-#* are licensed and made available under the terms and conditions of the BSD License
-#* which accompanies this distribution. The full text of the license may be found at
-#* http://opensource.org/licenses/bsd-license.php
-#*
-#* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-#* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#*
-#*
-#------------------------------------------------------------------------------
-
-#
-# Initializes floating point units for requirement of UEFI specification.
-#
-# This function initializes floating-point control word to 0x037F (all exceptions
-# masked,double-extended-precision, round-to-nearest) and multimedia-extensions control word
-# (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to zero
-# for masked underflow).
-#
-ASM_GLOBAL ASM_PFX(InitializeFloatingPointUnits)
-ASM_PFX(InitializeFloatingPointUnits):
-
- #
- # Initialize floating point units
- #
- finit
-
- #
- # Float control word initial value:
- # all exceptions masked, double-precision, round-to-nearest
- #
- pushq $0x037F
- lea (%rsp), %rax
- fldcw (%rax)
- popq %rax
-
- #
- # Set OSFXSR bit 9 in CR4
- #
- movq %cr4, %rax
- or $0x200, %rax
- movq %rax, %cr4
-
- #
- # Multimedia-extensions control word:
- # all exceptions masked, round-to-nearest, flush to zero for masked underflow
- #
- pushq $0x01F80
- lea (%rsp), %rax
- ldmxcsr (%rax)
- popq %rax
-
- ret
-
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 03/14] UefiCpuPkg/CpuExceptionHandlerLib:Remove.S files for IA32 and X64 arch
2019-04-01 8:29 [PATCH v4 00/14] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg Shenglei Zhang
2019-04-01 8:29 ` [PATCH v3 01/14] UefiCpuPkg/SmmCpuFeaturesLib: Remove .S files for IA32 and X64 arch Shenglei Zhang
2019-04-01 8:29 ` [PATCH v3 02/14] UefiCpuPkg/BaseUefiCpuLib: " Shenglei Zhang
@ 2019-04-01 8:29 ` Shenglei Zhang
2019-04-01 8:29 ` [PATCH v3 04/14] MdePkg/BaseCpuLib: Remove .S " Shenglei Zhang
` (10 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Shenglei Zhang @ 2019-04-01 8:29 UTC (permalink / raw)
To: edk2-devel; +Cc: Michael D Kinney, Liming Gao
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
---
.../DxeCpuExceptionHandlerLib.inf | 2 -
.../Ia32/ExceptionHandlerAsm.S | 667 ------------------
.../PeiCpuExceptionHandlerLib.inf | 2 -
.../SecPeiCpuExceptionHandlerLib.inf | 2 -
.../SmmCpuExceptionHandlerLib.inf | 2 -
.../X64/ExceptionHandlerAsm.S | 434 ------------
6 files changed, 1109 deletions(-)
delete mode 100644 UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.S
delete mode 100644 UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
index a480890165..391e49f077 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
@@ -30,13 +30,11 @@
[Sources.Ia32]
Ia32/ExceptionHandlerAsm.nasm
Ia32/ExceptionTssEntryAsm.nasm
- Ia32/ExceptionHandlerAsm.S
Ia32/ArchExceptionHandler.c
Ia32/ArchInterruptDefs.h
[Sources.X64]
X64/ExceptionHandlerAsm.nasm
- X64/ExceptionHandlerAsm.S
X64/ArchExceptionHandler.c
X64/ArchInterruptDefs.h
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.S b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.S
deleted file mode 100644
index c134257d9d..0000000000
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.S
+++ /dev/null
@@ -1,667 +0,0 @@
-#------------------------------------------------------------------------------
-#*
-#* Copyright (c) 2012 - 2015, Intel Corporation. All rights reserved.<BR>
-#* This program and the accompanying materials
-#* are licensed and made available under the terms and conditions of the BSD License
-#* which accompanies this distribution. The full text of the license may be found at
-#* http://opensource.org/licenses/bsd-license.php
-#*
-#* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-#* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#*
-#* ExceptionHandlerAsm.S
-#*
-#* Abstract:
-#*
-#* IA32 CPU Exception Handler
-#
-#------------------------------------------------------------------------------
-
-
-#.MMX
-#.XMM
-
-ASM_GLOBAL ASM_PFX(CommonExceptionHandler)
-ASM_GLOBAL ASM_PFX(CommonInterruptEntry)
-ASM_GLOBAL ASM_PFX(HookAfterStubHeaderEnd)
-
-#EXTRN ASM_PFX(mErrorCodeFlag):DWORD # Error code flags for exceptions
-#EXTRN ASM_PFX(mDoFarReturnFlag):DWORD # Do far return flag
-
-.text
-
-#
-# exception handler stub table
-#
-Exception0Handle:
- .byte 0x6a # push #VectorNum
- .byte 0
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception1Handle:
- .byte 0x6a # push #VectorNum
- .byte 1
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception2Handle:
- .byte 0x6a # push #VectorNum
- .byte 2
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception3Handle:
- .byte 0x6a # push #VectorNum
- .byte 3
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception4Handle:
- .byte 0x6a # push #VectorNum
- .byte 4
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception5Handle:
- .byte 0x6a # push #VectorNum
- .byte 5
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception6Handle:
- .byte 0x6a # push #VectorNum
- .byte 6
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception7Handle:
- .byte 0x6a # push #VectorNum
- .byte 7
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception8Handle:
- .byte 0x6a # push #VectorNum
- .byte 8
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception9Handle:
- .byte 0x6a # push #VectorNum
- .byte 9
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception10Handle:
- .byte 0x6a # push #VectorNum
- .byte 10
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception11Handle:
- .byte 0x6a # push #VectorNum
- .byte 11
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception12Handle:
- .byte 0x6a # push #VectorNum
- .byte 12
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception13Handle:
- .byte 0x6a # push #VectorNum
- .byte 13
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception14Handle:
- .byte 0x6a # push #VectorNum
- .byte 14
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception15Handle:
- .byte 0x6a # push #VectorNum
- .byte 15
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception16Handle:
- .byte 0x6a # push #VectorNum
- .byte 16
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception17Handle:
- .byte 0x6a # push #VectorNum
- .byte 17
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception18Handle:
- .byte 0x6a # push #VectorNum
- .byte 18
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception19Handle:
- .byte 0x6a # push #VectorNum
- .byte 19
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception20Handle:
- .byte 0x6a # push #VectorNum
- .byte 20
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception21Handle:
- .byte 0x6a # push #VectorNum
- .byte 21
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception22Handle:
- .byte 0x6a # push #VectorNum
- .byte 22
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception23Handle:
- .byte 0x6a # push #VectorNum
- .byte 23
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception24Handle:
- .byte 0x6a # push #VectorNum
- .byte 24
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception25Handle:
- .byte 0x6a # push #VectorNum
- .byte 25
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception26Handle:
- .byte 0x6a # push #VectorNum
- .byte 26
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception27Handle:
- .byte 0x6a # push #VectorNum
- .byte 27
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception28Handle:
- .byte 0x6a # push #VectorNum
- .byte 28
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception29Handle:
- .byte 0x6a # push #VectorNum
- .byte 29
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception30Handle:
- .byte 0x6a # push #VectorNum
- .byte 30
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-Exception31Handle:
- .byte 0x6a # push #VectorNum
- .byte 31
- pushl %eax
- .byte 0xB8
- .long ASM_PFX(CommonInterruptEntry)
- jmp *%eax
-
-HookAfterStubBegin:
- .byte 0x6a # push
-VectorNum:
- .byte 0 # 0 will be fixed
- pushl %eax
- .byte 0xB8 # movl ASM_PFX(HookAfterStubHeaderEnd), %eax
- .long ASM_PFX(HookAfterStubHeaderEnd)
- jmp *%eax
-ASM_GLOBAL ASM_PFX(HookAfterStubHeaderEnd)
-ASM_PFX(HookAfterStubHeaderEnd):
- popl %eax
- subl $8, %esp # reserve room for filling exception data later
- pushl 8(%esp)
- xchgl (%esp), %ecx # get vector number
- bt %ecx, ASM_PFX(mErrorCodeFlag)
- jnc NoErrorData
- pushl (%esp) # addition push if exception data needed
-NoErrorData:
- xchg (%esp), %ecx # restore ecx
- pushl %eax
-
-#---------------------------------------;
-# CommonInterruptEntry ;
-#---------------------------------------;
-# The follow algorithm is used for the common interrupt routine.
-
-ASM_GLOBAL ASM_PFX(CommonInterruptEntry)
-ASM_PFX(CommonInterruptEntry):
- cli
- popl %eax
- #
- # All interrupt handlers are invoked through interrupt gates, so
- # IF flag automatically cleared at the entry point
- #
-
- #
- # Get vector number from top of stack
- #
- xchgl (%esp), %ecx
- andl $0x0FF, %ecx # Vector number should be less than 256
- cmpl $32, %ecx # Intel reserved vector for exceptions?
- jae NoErrorCode
- bt %ecx, ASM_PFX(mErrorCodeFlag)
- jc HasErrorCode
-
-NoErrorCode:
-
- #
- # Stack:
- # +---------------------+
- # + EFlags +
- # +---------------------+
- # + CS +
- # +---------------------+
- # + EIP +
- # +---------------------+
- # + ECX +
- # +---------------------+ <-- ESP
- #
- # Registers:
- # ECX - Vector Number
- #
-
- #
- # Put Vector Number on stack
- #
- pushl %ecx
-
- #
- # Put 0 (dummy) error code on stack, and restore ECX
- #
- xorl %ecx, %ecx # ECX = 0
- xchgl 4(%esp), %ecx
-
- jmp ErrorCodeAndVectorOnStack
-
-HasErrorCode:
-
- #
- # Stack:
- # +---------------------+
- # + EFlags +
- # +---------------------+
- # + CS +
- # +---------------------+
- # + EIP +
- # +---------------------+
- # + Error Code +
- # +---------------------+
- # + ECX +
- # +---------------------+ <-- ESP
- #
- # Registers:
- # ECX - Vector Number
- #
-
- #
- # Put Vector Number on stack and restore ECX
- #
- xchgl (%esp), %ecx
-
-ErrorCodeAndVectorOnStack:
- pushl %ebp
- movl %esp, %ebp
-
- #
- # Stack:
- # +---------------------+
- # + EFlags +
- # +---------------------+
- # + CS +
- # +---------------------+
- # + EIP +
- # +---------------------+
- # + Error Code +
- # +---------------------+
- # + Vector Number +
- # +---------------------+
- # + EBP +
- # +---------------------+ <-- EBP
- #
-
- #
- # Align stack to make sure that EFI_FX_SAVE_STATE_IA32 of EFI_SYSTEM_CONTEXT_IA32
- # is 16-byte aligned
- #
- andl $0x0fffffff0, %esp
- subl $12, %esp
-
- subl $8, %esp
- pushl $0 # check EXCEPTION_HANDLER_CONTEXT.OldIdtHandler
- pushl $0 # check EXCEPTION_HANDLER_CONTEXT.ExceptionDataFlag
-
-#; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
- pushl %eax
- pushl %ecx
- pushl %edx
- pushl %ebx
- leal 24(%ebp), %ecx
- pushl %ecx # ESP
- pushl (%ebp) # EBP
- pushl %esi
- pushl %edi
-
-#; UINT32 Gs, Fs, Es, Ds, Cs, Ss;
- movl %ss, %eax
- pushl %eax
- movzwl 16(%ebp), %eax
- pushl %eax
- movl %ds, %eax
- pushl %eax
- movl %es, %eax
- pushl %eax
- movl %fs, %eax
- pushl %eax
- movl %gs, %eax
- pushl %eax
-
-#; UINT32 Eip;
- movl 12(%ebp), %eax
- pushl %eax
-
-#; UINT32 Gdtr[2], Idtr[2];
- subl $8, %esp
- sidt (%esp)
- movl 2(%esp), %eax
- xchgl (%esp), %eax
- andl $0x0FFFF, %eax
- movl %eax, 4(%esp)
-
- subl $8, %esp
- sgdt (%esp)
- movl 2(%esp), %eax
- xchgl (%esp), %eax
- andl $0x0FFFF, %eax
- movl %eax, 4(%esp)
-
-#; UINT32 Ldtr, Tr;
- xorl %eax, %eax
- str %ax
- pushl %eax
- sldt %ax
- pushl %eax
-
-#; UINT32 EFlags;
- movl 20(%ebp), %eax
- pushl %eax
-
-#; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
-## insure FXSAVE/FXRSTOR is enabled in CR4...
-## ... while we're at it, make sure DE is also enabled...
- mov $1, %eax
- pushl %ebx # temporarily save value of ebx on stack
- cpuid # use CPUID to determine if FXSAVE/FXRESTOR
- # and DE are supported
- popl %ebx # retore value of ebx that was overwritten
- # by CPUID
- movl %cr4, %eax
- pushl %eax # push cr4 firstly
- testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support
- jz L1
- orl $BIT9, %eax # Set CR4.OSFXSR
-L1:
- testl $BIT2, %edx # Test for Debugging Extensions support
- jz L2
- orl $BIT3, %eax # Set CR4.DE
-L2:
- movl %eax, %cr4
- movl %cr3, %eax
- pushl %eax
- movl %cr2, %eax
- pushl %eax
- xorl %eax, %eax
- pushl %eax
- movl %cr0, %eax
- pushl %eax
-
-#; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
- movl %dr7, %eax
- pushl %eax
- movl %dr6, %eax
- pushl %eax
- movl %dr3, %eax
- pushl %eax
- movl %dr2, %eax
- pushl %eax
- movl %dr1, %eax
- pushl %eax
- movl %dr0, %eax
- pushl %eax
-
-#; FX_SAVE_STATE_IA32 FxSaveState;
- subl $512, %esp
- movl %esp, %edi
- testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support.
- # edx still contains result from CPUID above
- jz L3
- .byte 0x0f, 0x0ae, 0x07 #fxsave [edi]
-L3:
-
-#; UEFI calling convention for IA32 requires that Direction flag in EFLAGs is clear
- cld
-
-#; UINT32 ExceptionData;
- pushl 8(%ebp)
-
-#; Prepare parameter and call
- movl %esp, %edx
- pushl %edx
- movl 4(%ebp), %edx
- pushl %edx
-
- #
- # Call External Exception Handler
- #
- call ASM_PFX(CommonExceptionHandler)
- addl $8, %esp
-
- cli
-#; UINT32 ExceptionData;
- addl $4, %esp
-
-#; FX_SAVE_STATE_IA32 FxSaveState;
- movl %esp, %esi
- movl $1, %eax
- cpuid # use CPUID to determine if FXSAVE/FXRESTOR
- # are supported
- testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support
- jz L4
- .byte 0x0f, 0x0ae, 0x0e # fxrstor [esi]
-L4:
- addl $512, %esp
-
-#; UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
-#; Skip restoration of DRx registers to support in-circuit emualators
-#; or debuggers set breakpoint in interrupt/exception context
- addl $24, %esp
-
-#; UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
- popl %eax
- movl %eax, %cr0
- addl $4, %esp # not for Cr1
- popl %eax
- movl %eax, %cr2
- popl %eax
- movl %eax, %cr3
- popl %eax
- movl %eax, %cr4
-
-#; UINT32 EFlags;
- popl 20(%ebp)
-
-#; UINT32 Ldtr, Tr;
-#; UINT32 Gdtr[2], Idtr[2];
-#; Best not let anyone mess with these particular registers...
- addl $24, %esp
-
-#; UINT32 Eip;
- popl 12(%ebp)
-
-#; UINT32 Gs, Fs, Es, Ds, Cs, Ss;
-#; NOTE - modified segment registers could hang the debugger... We
-#; could attempt to insulate ourselves against this possibility,
-#; but that poses risks as well.
-#;
- popl %gs
- popl %fs
- popl %es
- popl %ds
- popl 16(%ebp)
- popl %ss
-
-#; UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
- popl %edi
- popl %esi
- addl $4, %esp # not for ebp
- addl $4, %esp # not for esp
- popl %ebx
- popl %edx
- popl %ecx
- popl %eax
-
- popl -8(%ebp)
- popl -4(%ebp)
- movl %ebp, %esp
- popl %ebp
- addl $8, %esp
- cmpl $0, -16(%esp) # check EXCEPTION_HANDLER_CONTEXT.OldIdtHandler
- jz DoReturn
- cmpl $1, -20(%esp) # check EXCEPTION_HANDLER_CONTEXT.ExceptionDataFlag
- jz ErrorCode
- jmp *-16(%esp)
-ErrorCode:
- subl $4, %esp
- jmp *-12(%esp)
-
-DoReturn:
- cmpl $0, ASM_PFX(mDoFarReturnFlag)
- jz DoIret
- pushl 8(%esp) # save EFLAGS
- addl $16, %esp
- pushl -8(%esp) # save CS in new location
- pushl -8(%esp) # save EIP in new location
- pushl -8(%esp) # save EFLAGS in new location
- popfl # restore EFLAGS
- lret # far return
-
-DoIret:
- iretl
-
-
-#---------------------------------------;
-# _AsmGetTemplateAddressMap ;
-#---------------------------------------;
-#
-# Protocol prototype
-# AsmGetTemplateAddressMap (
-# EXCEPTION_HANDLER_TEMPLATE_MAP *AddressMap
-# );
-#
-# Routine Description:
-#
-# Return address map of interrupt handler template so that C code can generate
-# interrupt table.
-#
-# Arguments:
-#
-#
-# Returns:
-#
-# Nothing
-#
-#
-# Input: [ebp][0] = Original ebp
-# [ebp][4] = Return address
-#
-# Output: Nothing
-#
-# Destroys: Nothing
-#-----------------------------------------------------------------------------;
-#-------------------------------------------------------------------------------------
-# AsmGetAddressMap (&AddressMap);
-#-------------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(AsmGetTemplateAddressMap)
-ASM_PFX(AsmGetTemplateAddressMap):
-
- pushl %ebp
- movl %esp,%ebp
- pushal
-
- movl 0x8(%ebp), %ebx
- movl $Exception0Handle, (%ebx)
- movl $(Exception1Handle - Exception0Handle), 0x4(%ebx)
- movl $(HookAfterStubBegin), 0x8(%ebx)
-
- popal
- popl %ebp
- ret
-#-------------------------------------------------------------------------------------
-# AsmVectorNumFixup (*NewVectorAddr, VectorNum, *OldVectorAddr);
-#-------------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(AsmVectorNumFixup)
-ASM_PFX(AsmVectorNumFixup):
- movl 8(%esp), %eax
- movl 4(%esp), %ecx
- movb %al, (VectorNum - HookAfterStubBegin)(%ecx)
- ret
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
index e192641db2..f0ad1050d5 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/PeiCpuExceptionHandlerLib.inf
@@ -30,13 +30,11 @@
[Sources.Ia32]
Ia32/ExceptionHandlerAsm.nasm
Ia32/ExceptionTssEntryAsm.nasm
- Ia32/ExceptionHandlerAsm.S
Ia32/ArchExceptionHandler.c
Ia32/ArchInterruptDefs.h
[Sources.X64]
X64/ExceptionHandlerAsm.nasm
- X64/ExceptionHandlerAsm.S
X64/ArchExceptionHandler.c
X64/ArchInterruptDefs.h
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
index 76b8fe8222..1caaf92da4 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib.inf
@@ -30,13 +30,11 @@
[Sources.Ia32]
Ia32/ExceptionHandlerAsm.nasm
Ia32/ExceptionTssEntryAsm.nasm
- Ia32/ExceptionHandlerAsm.S
Ia32/ArchExceptionHandler.c
Ia32/ArchInterruptDefs.h
[Sources.X64]
X64/ExceptionHandlerAsm.nasm
- X64/ExceptionHandlerAsm.S
X64/ArchExceptionHandler.c
X64/ArchInterruptDefs.h
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
index 6f90302204..feeefcfd8b 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/SmmCpuExceptionHandlerLib.inf
@@ -30,13 +30,11 @@
[Sources.Ia32]
Ia32/ExceptionHandlerAsm.nasm
Ia32/ExceptionTssEntryAsm.nasm
- Ia32/ExceptionHandlerAsm.S
Ia32/ArchExceptionHandler.c
Ia32/ArchInterruptDefs.h
[Sources.X64]
X64/ExceptionHandlerAsm.nasm
- X64/ExceptionHandlerAsm.S
X64/ArchExceptionHandler.c
X64/ArchInterruptDefs.h
diff --git a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S b/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S
deleted file mode 100644
index edd363cdaa..0000000000
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S
+++ /dev/null
@@ -1,434 +0,0 @@
-#------------------------------------------------------------------------------ ;
-# Copyright (c) 2012 - 2017, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ExceptionHandlerAsm.S
-#
-# Abstract:
-#
-# x64 CPU Exception Handler
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-
-ASM_GLOBAL ASM_PFX(CommonExceptionHandler)
-
-#EXTRN ASM_PFX(mErrorCodeFlag):DWORD # Error code flags for exceptions
-#EXTRN ASM_PFX(mDoFarReturnFlag):QWORD # Do far return flag
-.text
-
-#ifdef __APPLE__
-# macros are different between GNU and Xcode as.
-.macro IDT_MACRO
- push $0
-#else
-.macro IDT_MACRO arg
- push \arg
-#endif
- .byte 0xe9 # jmp ASM_PFX(CommonInterruptEntry)
- .long ASM_PFX(CommonInterruptEntry) - . - 4
-.endm
-
-AsmIdtVectorBegin:
- IDT_MACRO $0
- IDT_MACRO $1
- IDT_MACRO $2
- IDT_MACRO $3
- IDT_MACRO $4
- IDT_MACRO $5
- IDT_MACRO $6
- IDT_MACRO $7
- IDT_MACRO $8
- IDT_MACRO $9
- IDT_MACRO $10
- IDT_MACRO $11
- IDT_MACRO $12
- IDT_MACRO $13
- IDT_MACRO $14
- IDT_MACRO $15
- IDT_MACRO $16
- IDT_MACRO $17
- IDT_MACRO $18
- IDT_MACRO $19
- IDT_MACRO $20
- IDT_MACRO $21
- IDT_MACRO $22
- IDT_MACRO $23
- IDT_MACRO $24
- IDT_MACRO $25
- IDT_MACRO $26
- IDT_MACRO $27
- IDT_MACRO $28
- IDT_MACRO $29
- IDT_MACRO $30
- IDT_MACRO $31
-AsmIdtVectorEnd:
-
-HookAfterStubHeaderBegin:
- .byte 0x6a # push
-PatchVectorNum:
- .byte 0 # 0 will be fixed
- .byte 0xe9 # jmp ASM_PFX(HookAfterStubHeaderEnd)
-PatchFuncAddress:
- .set HOOK_ADDRESS, ASM_PFX(HookAfterStubHeaderEnd) - . - 4
- .long HOOK_ADDRESS # will be fixed
-ASM_GLOBAL ASM_PFX(HookAfterStubHeaderEnd)
-ASM_PFX(HookAfterStubHeaderEnd):
- pushq %rax
- movq %rsp, %rax
- andl $0x0fffffff0, %esp # make sure 16-byte aligned for exception context
- subq $0x18, %rsp # reserve room for filling exception data later
- pushq %rcx
- movq 8(%rax), %rcx
- bt %ecx, ASM_PFX(mErrorCodeFlag)(%rip)
- jnc NoErrorData
- pushq (%rsp) # push additional rcx to make stack alignment
-NoErrorData:
- xchgq (%rsp), %rcx # restore rcx, save Exception Number in stack
- movq (%rax), %rax # restore rax
-
-#---------------------------------------;
-# CommonInterruptEntry ;
-#---------------------------------------;
-# The follow algorithm is used for the common interrupt routine.
-
-ASM_GLOBAL ASM_PFX(CommonInterruptEntry)
-ASM_PFX(CommonInterruptEntry):
- cli
- #
- # All interrupt handlers are invoked through interrupt gates, so
- # IF flag automatically cleared at the entry point
- #
- #
- # Calculate vector number
- #
- xchgq (%rsp), %rcx # get the return address of call, actually, it is the address of vector number.
- andq $0x0FF, %rcx
- cmp $32, %ecx # Intel reserved vector for exceptions?
- jae NoErrorCode
- pushq %rax
- movl ASM_PFX(mErrorCodeFlag)(%rip), %eax
- bt %ecx, %eax
- popq %rax
- jc CommonInterruptEntry_al_0000
-
-NoErrorCode:
-
- #
- # Push a dummy error code on the stack
- # to maintain coherent stack map
- #
- pushq (%rsp)
- movq $0, 8(%rsp)
-CommonInterruptEntry_al_0000:
- pushq %rbp
- movq %rsp, %rbp
- pushq $0 # check EXCEPTION_HANDLER_CONTEXT.OldIdtHandler
- pushq $0 # check EXCEPTION_HANDLER_CONTEXT.ExceptionDataFlag
-
- #
- # Stack:
- # +---------------------+ <-- 16-byte aligned ensured by processor
- # + Old SS +
- # +---------------------+
- # + Old RSP +
- # +---------------------+
- # + RFlags +
- # +---------------------+
- # + CS +
- # +---------------------+
- # + RIP +
- # +---------------------+
- # + Error Code +
- # +---------------------+
- # + RCX / Vector Number +
- # +---------------------+
- # + RBP +
- # +---------------------+ <-- RBP, 16-byte aligned
- #
-
-
- #
- # Since here the stack pointer is 16-byte aligned, so
- # EFI_FX_SAVE_STATE_X64 of EFI_SYSTEM_CONTEXT_x64
- # is 16-byte aligned
- #
-
-#; UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;
-#; UINT64 R8, R9, R10, R11, R12, R13, R14, R15;
- pushq %r15
- pushq %r14
- pushq %r13
- pushq %r12
- pushq %r11
- pushq %r10
- pushq %r9
- pushq %r8
- pushq %rax
- pushq 8(%rbp) # RCX
- pushq %rdx
- pushq %rbx
- pushq 48(%rbp) # RSP
- pushq (%rbp) # RBP
- pushq %rsi
- pushq %rdi
-
-#; UINT64 Gs, Fs, Es, Ds, Cs, Ss; insure high 16 bits of each is zero
- movzwq 56(%rbp), %rax
- pushq %rax # for ss
- movzwq 32(%rbp), %rax
- pushq %rax # for cs
- mov %ds, %rax
- pushq %rax
- mov %es, %rax
- pushq %rax
- mov %fs, %rax
- pushq %rax
- mov %gs, %rax
- pushq %rax
-
- movq %rcx, 8(%rbp) # save vector number
-
-#; UINT64 Rip;
- pushq 24(%rbp)
-
-#; UINT64 Gdtr[2], Idtr[2];
- xorq %rax, %rax
- pushq %rax
- pushq %rax
- sidt (%rsp)
- xchgq 2(%rsp), %rax
- xchgq (%rsp), %rax
- xchgq 8(%rsp), %rax
-
- xorq %rax, %rax
- pushq %rax
- pushq %rax
- sgdt (%rsp)
- xchgq 2(%rsp), %rax
- xchgq (%rsp), %rax
- xchgq 8(%rsp), %rax
-
-#; UINT64 Ldtr, Tr;
- xorq %rax, %rax
- str %ax
- pushq %rax
- sldt %ax
- pushq %rax
-
-#; UINT64 RFlags;
- pushq 40(%rbp)
-
-#; UINT64 Cr0, Cr1, Cr2, Cr3, Cr4, Cr8;
- movq %cr8, %rax
- pushq %rax
- movq %cr4, %rax
- orq $0x208, %rax
- movq %rax, %cr4
- pushq %rax
- mov %cr3, %rax
- pushq %rax
- mov %cr2, %rax
- pushq %rax
- xorq %rax, %rax
- pushq %rax
- mov %cr0, %rax
- pushq %rax
-
-#; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
- movq %dr7, %rax
- pushq %rax
- movq %dr6, %rax
- pushq %rax
- movq %dr3, %rax
- pushq %rax
- movq %dr2, %rax
- pushq %rax
- movq %dr1, %rax
- pushq %rax
- movq %dr0, %rax
- pushq %rax
-
-#; FX_SAVE_STATE_X64 FxSaveState;
- subq $512, %rsp
- movq %rsp, %rdi
- .byte 0x0f, 0x0ae, 0x07 #fxsave [rdi]
-
-#; UEFI calling convention for x64 requires that Direction flag in EFLAGs is clear
- cld
-
-#; UINT32 ExceptionData;
- pushq 16(%rbp)
-
-#; Prepare parameter and call
- mov 8(%rbp), %rcx
- mov %rsp, %rdx
- #
- # Per X64 calling convention, allocate maximum parameter stack space
- # and make sure RSP is 16-byte aligned
- #
- subq $40, %rsp
- call ASM_PFX(CommonExceptionHandler)
- addq $40, %rsp
-
- cli
-#; UINT64 ExceptionData;
- addq $8, %rsp
-
-#; FX_SAVE_STATE_X64 FxSaveState;
-
- movq %rsp, %rsi
- .byte 0x0f, 0x0ae, 0x0E # fxrstor [rsi]
- addq $512, %rsp
-
-#; UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
-#; Skip restoration of DRx registers to support in-circuit emualators
-#; or debuggers set breakpoint in interrupt/exception context
- addq $48, %rsp
-
-#; UINT64 Cr0, Cr1, Cr2, Cr3, Cr4, Cr8;
- popq %rax
- movq %rax, %cr0
- addq $8, %rsp # not for Cr1
- popq %rax
- movq %rax, %cr2
- popq %rax
- movq %rax, %cr3
- popq %rax
- movq %rax, %cr4
- popq %rax
- movq %rax, %cr8
-
-#; UINT64 RFlags;
- popq 40(%rbp)
-
-#; UINT64 Ldtr, Tr;
-#; UINT64 Gdtr[2], Idtr[2];
-#; Best not let anyone mess with these particular registers...
- addq $48, %rsp
-
-#; UINT64 Rip;
- popq 24(%rbp)
-
-#; UINT64 Gs, Fs, Es, Ds, Cs, Ss;
- popq %rax
- # mov %rax, %gs ; not for gs
- popq %rax
- # mov %rax, %fs ; not for fs
- # (X64 will not use fs and gs, so we do not restore it)
- popq %rax
- mov %rax, %es
- popq %rax
- mov %rax, %ds
- popq 32(%rbp) # for cs
- popq 56(%rbp) # for ss
-
-#; UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;
-#; UINT64 R8, R9, R10, R11, R12, R13, R14, R15;
- popq %rdi
- popq %rsi
- addq $8, %rsp # not for rbp
- popq 48(%rbp) # for rsp
- popq %rbx
- popq %rdx
- popq %rcx
- popq %rax
- popq %r8
- popq %r9
- popq %r10
- popq %r11
- popq %r12
- popq %r13
- popq %r14
- popq %r15
-
- movq %rbp, %rsp
- popq %rbp
- addq $16, %rsp
- cmpq $0, -32(%rsp) # check EXCEPTION_HANDLER_CONTEXT.OldIdtHandler
- jz DoReturn # check EXCEPTION_HANDLER_CONTEXT.ExceptionDataFlag
- cmpb $1, -40(%rsp)
- jz ErrorCode
- jmp *-32(%rsp)
-ErrorCode:
- subq $8, %rsp
- jmp *-24(%rsp)
-
-DoReturn:
- pushq %rax
- movq ASM_PFX(mDoFarReturnFlag)(%rip), %rax
- cmpq $0, %rax # Check if need to do far return instead of IRET
- popq %rax
- jz DoIret
- pushq %rax
- movq %rsp, %rax # save old RSP to rax
- movq 0x20(%rsp), %rsp
- pushq 0x10(%rax) # save CS in new location
- pushq 0x8(%rax) # save EIP in new location
- pushq 0x18(%rax) # save EFLAGS in new location
- movq (%rax), %rax # restore rax
- popfq # restore EFLAGS
- lretq # far return
-DoIret:
- iretq
-
-
-#-------------------------------------------------------------------------------------
-# AsmGetTemplateAddressMap (&AddressMap);
-#-------------------------------------------------------------------------------------
-# comments here for definition of address map
-ASM_GLOBAL ASM_PFX(AsmGetTemplateAddressMap)
-ASM_PFX(AsmGetTemplateAddressMap):
- pushq %rbp
- movq %rsp, %rbp
-
- leaq AsmIdtVectorBegin(%rip), %rax
- movq %rax, (%rcx)
- .set ENTRY_SIZE, ASM_PFX(HookAfterStubHeaderEnd) - HookAfterStubHeaderBegin
- movq $(ENTRY_SIZE), 0x08(%rcx)
- leaq HookAfterStubHeaderBegin(%rip), %rax
- movq %rax, 0x10(%rcx)
-
- popq %rbp
- ret
-
-#-------------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# AsmVectorNumFixup (
-# IN VOID *NewVectorAddr, // RCX
-# IN UINT8 VectorNum // RDX
-# IN VOID *OldVectorAddr, // R8
-# );
-#-------------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(AsmVectorNumFixup)
-ASM_PFX(AsmVectorNumFixup):
- pushq %rbp
- movq %rsp, %rbp
-
-# Patch vector #
- movb %dl, (PatchVectorNum - HookAfterStubHeaderBegin)(%rcx)
-
-# Patch Function address
- subq %rcx, %r8 # Calculate the offset value
- movl (PatchFuncAddress - HookAfterStubHeaderBegin)(%rcx), %eax
- addq %r8, %rax
- movl %eax, (PatchFuncAddress - HookAfterStubHeaderBegin)(%rcx)
-
- popq %rbp
- ret
-
-#END
-
-
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 04/14] MdePkg/BaseCpuLib: Remove .S files for IA32 and X64 arch
2019-04-01 8:29 [PATCH v4 00/14] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg Shenglei Zhang
` (2 preceding siblings ...)
2019-04-01 8:29 ` [PATCH v3 03/14] UefiCpuPkg/CpuExceptionHandlerLib:Remove.S " Shenglei Zhang
@ 2019-04-01 8:29 ` Shenglei Zhang
2019-04-01 8:29 ` [PATCH v3 05/14] MdePkg/BaseLib: " Shenglei Zhang
` (9 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Shenglei Zhang @ 2019-04-01 8:29 UTC (permalink / raw)
To: edk2-devel; +Cc: Michael D Kinney, Liming Gao
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594
v2: Remove CpuSleep.nasm| GCC and CpuFlushTlb.nasm| GCC in X64 arch
in BaseCpuLib.inf.
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
---
MdePkg/Library/BaseCpuLib/BaseCpuLib.inf | 4 ---
MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S | 35 ---------------------
MdePkg/Library/BaseCpuLib/X64/CpuSleep.S | 34 --------------------
3 files changed, 73 deletions(-)
delete mode 100644 MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S
delete mode 100644 MdePkg/Library/BaseCpuLib/X64/CpuSleep.S
diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
index af2f09617a..a734cac377 100644
--- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
@@ -46,10 +46,6 @@
X64/CpuFlushTlb.nasm
X64/CpuSleep.nasm
- X64/CpuSleep.nasm| GCC
- X64/CpuSleep.S | GCC
- X64/CpuFlushTlb.nasm| GCC
- X64/CpuFlushTlb.S | GCC
[Sources.EBC]
Ebc/CpuSleepFlushTlb.c
diff --git a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S b/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S
deleted file mode 100644
index 05d916a589..0000000000
--- a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S
+++ /dev/null
@@ -1,35 +0,0 @@
-#------------------------------------------------------------------------------
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CpuFlushTlb.Asm
-#
-# Abstract:
-#
-# CpuFlushTlb function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(CpuFlushTlb)
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# CpuFlushTlb (
-# VOID
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(CpuFlushTlb):
- mov %cr3, %rax
- mov %rax, %cr3
- ret
diff --git a/MdePkg/Library/BaseCpuLib/X64/CpuSleep.S b/MdePkg/Library/BaseCpuLib/X64/CpuSleep.S
deleted file mode 100644
index cf763689d7..0000000000
--- a/MdePkg/Library/BaseCpuLib/X64/CpuSleep.S
+++ /dev/null
@@ -1,34 +0,0 @@
-#------------------------------------------------------------------------------ ;
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CpuSleep.S
-#
-# Abstract:
-#
-# CpuSleep function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# CpuSleep (
-# VOID
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(CpuSleep)
-ASM_PFX(CpuSleep):
- hlt
- ret
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 05/14] MdePkg/BaseLib: Remove .S files for IA32 and X64 arch
2019-04-01 8:29 [PATCH v4 00/14] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg Shenglei Zhang
` (3 preceding siblings ...)
2019-04-01 8:29 ` [PATCH v3 04/14] MdePkg/BaseCpuLib: Remove .S " Shenglei Zhang
@ 2019-04-01 8:29 ` Shenglei Zhang
2019-04-01 8:29 ` [PATCH v3 06/14] MdePkg/BaseMemoryLibMmx: " Shenglei Zhang
` (8 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Shenglei Zhang @ 2019-04-01 8:29 UTC (permalink / raw)
To: edk2-devel; +Cc: Michael D Kinney, Liming Gao
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
---
MdePkg/Library/BaseLib/BaseLib.inf | 38 --
MdePkg/Library/BaseLib/Ia32/ARShiftU64.S | 43 ---
MdePkg/Library/BaseLib/Ia32/CpuId.S | 63 ----
MdePkg/Library/BaseLib/Ia32/CpuIdEx.S | 67 ----
MdePkg/Library/BaseLib/Ia32/DisableCache.S | 39 --
MdePkg/Library/BaseLib/Ia32/DisablePaging32.S | 52 ---
MdePkg/Library/BaseLib/Ia32/DivU64x32.S | 41 ---
.../Library/BaseLib/Ia32/DivU64x32Remainder.S | 46 ---
.../Library/BaseLib/Ia32/DivU64x64Remainder.S | 89 -----
MdePkg/Library/BaseLib/Ia32/EnableCache.S | 39 --
.../BaseLib/Ia32/EnableDisableInterrupts.S | 36 --
MdePkg/Library/BaseLib/Ia32/EnablePaging32.S | 52 ---
MdePkg/Library/BaseLib/Ia32/EnablePaging64.S | 63 ----
.../BaseLib/Ia32/InternalSwitchStack.S | 48 ---
MdePkg/Library/BaseLib/Ia32/LRotU64.S | 48 ---
MdePkg/Library/BaseLib/Ia32/LShiftU64.S | 43 ---
MdePkg/Library/BaseLib/Ia32/LongJump.S | 41 ---
MdePkg/Library/BaseLib/Ia32/ModU64x32.S | 40 ---
MdePkg/Library/BaseLib/Ia32/Monitor.S | 40 ---
MdePkg/Library/BaseLib/Ia32/MultU64x32.S | 41 ---
MdePkg/Library/BaseLib/Ia32/MultU64x64.S | 44 ---
MdePkg/Library/BaseLib/Ia32/Mwait.S | 38 --
MdePkg/Library/BaseLib/Ia32/RRotU64.S | 48 ---
MdePkg/Library/BaseLib/Ia32/RShiftU64.S | 46 ---
MdePkg/Library/BaseLib/Ia32/RdRand.S | 80 -----
MdePkg/Library/BaseLib/Ia32/SetJump.S | 44 ---
MdePkg/Library/BaseLib/Ia32/SwapBytes64.S | 38 --
MdePkg/Library/BaseLib/Ia32/Thunk16.S | 222 ------------
MdePkg/Library/BaseLib/X64/CpuId.S | 60 ----
MdePkg/Library/BaseLib/X64/CpuIdEx.S | 62 ----
MdePkg/Library/BaseLib/X64/DisableCache.S | 39 --
MdePkg/Library/BaseLib/X64/DisablePaging64.S | 82 -----
MdePkg/Library/BaseLib/X64/EnableCache.S | 39 --
.../BaseLib/X64/EnableDisableInterrupts.S | 36 --
MdePkg/Library/BaseLib/X64/LongJump.S | 54 ---
MdePkg/Library/BaseLib/X64/RdRand.S | 72 ----
MdePkg/Library/BaseLib/X64/SetJump.S | 53 ---
MdePkg/Library/BaseLib/X64/SwitchStack.S | 52 ---
MdePkg/Library/BaseLib/X64/Thunk16.S | 334 ------------------
39 files changed, 2412 deletions(-)
delete mode 100644 MdePkg/Library/BaseLib/Ia32/ARShiftU64.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/CpuId.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/CpuIdEx.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/DisableCache.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/DisablePaging32.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/DivU64x32.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/EnableCache.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/EnablePaging32.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/EnablePaging64.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/LRotU64.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/LShiftU64.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/LongJump.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/ModU64x32.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/Monitor.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/MultU64x32.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/MultU64x64.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/Mwait.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/RRotU64.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/RShiftU64.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/RdRand.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/SetJump.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/SwapBytes64.S
delete mode 100644 MdePkg/Library/BaseLib/Ia32/Thunk16.S
delete mode 100644 MdePkg/Library/BaseLib/X64/CpuId.S
delete mode 100644 MdePkg/Library/BaseLib/X64/CpuIdEx.S
delete mode 100644 MdePkg/Library/BaseLib/X64/DisableCache.S
delete mode 100644 MdePkg/Library/BaseLib/X64/DisablePaging64.S
delete mode 100644 MdePkg/Library/BaseLib/X64/EnableCache.S
delete mode 100644 MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S
delete mode 100644 MdePkg/Library/BaseLib/X64/LongJump.S
delete mode 100644 MdePkg/Library/BaseLib/X64/RdRand.S
delete mode 100644 MdePkg/Library/BaseLib/X64/SetJump.S
delete mode 100644 MdePkg/Library/BaseLib/X64/SwitchStack.S
delete mode 100644 MdePkg/Library/BaseLib/X64/Thunk16.S
diff --git a/MdePkg/Library/BaseLib/BaseLib.inf b/MdePkg/Library/BaseLib/BaseLib.inf
index a0d6c372f9..16829deeb4 100644
--- a/MdePkg/Library/BaseLib/BaseLib.inf
+++ b/MdePkg/Library/BaseLib/BaseLib.inf
@@ -260,62 +260,35 @@
Ia32/GccInline.c | GCC
Ia32/Thunk16.nasm | GCC
- Ia32/Thunk16.S | XCODE
Ia32/EnableDisableInterrupts.nasm| GCC
- Ia32/EnableDisableInterrupts.S | GCC
Ia32/EnablePaging64.nasm| GCC
- Ia32/EnablePaging64.S | GCC
Ia32/DisablePaging32.nasm| GCC
- Ia32/DisablePaging32.S | GCC
Ia32/EnablePaging32.nasm| GCC
- Ia32/EnablePaging32.S | GCC
Ia32/Mwait.nasm| GCC
- Ia32/Mwait.S | GCC
Ia32/Monitor.nasm| GCC
- Ia32/Monitor.S | GCC
Ia32/CpuIdEx.nasm| GCC
- Ia32/CpuIdEx.S | GCC
Ia32/CpuId.nasm| GCC
- Ia32/CpuId.S | GCC
Ia32/LongJump.nasm| GCC
- Ia32/LongJump.S | GCC
Ia32/SetJump.nasm| GCC
- Ia32/SetJump.S | GCC
Ia32/SwapBytes64.nasm| GCC
- Ia32/SwapBytes64.S | GCC
Ia32/DivU64x64Remainder.nasm| GCC
- Ia32/DivU64x64Remainder.S | GCC
Ia32/DivU64x32Remainder.nasm| GCC
- Ia32/DivU64x32Remainder.S | GCC
Ia32/ModU64x32.nasm| GCC
- Ia32/ModU64x32.S | GCC
Ia32/DivU64x32.nasm| GCC
- Ia32/DivU64x32.S | GCC
Ia32/MultU64x64.nasm| GCC
- Ia32/MultU64x64.S | GCC
Ia32/MultU64x32.nasm| GCC
- Ia32/MultU64x32.S | GCC
Ia32/RRotU64.nasm| GCC
- Ia32/RRotU64.S | GCC
Ia32/LRotU64.nasm| GCC
- Ia32/LRotU64.S | GCC
Ia32/ARShiftU64.nasm| GCC
- Ia32/ARShiftU64.S | GCC
Ia32/RShiftU64.nasm| GCC
- Ia32/RShiftU64.S | GCC
Ia32/LShiftU64.nasm| GCC
- Ia32/LShiftU64.S | GCC
Ia32/EnableCache.nasm| GCC
- Ia32/EnableCache.S | GCC
Ia32/DisableCache.nasm| GCC
- Ia32/DisableCache.S | GCC
Ia32/RdRand.nasm| GCC
- Ia32/RdRand.S | GCC
Ia32/DivS64x64Remainder.c
Ia32/InternalSwitchStack.c | MSFT
Ia32/InternalSwitchStack.c | INTEL
- Ia32/InternalSwitchStack.S | GCC
Ia32/InternalSwitchStack.nasm | GCC
Ia32/Non-existing.c
Unaligned.c
@@ -518,27 +491,16 @@
X86PatchInstruction.c
X86SpeculationBarrier.c
X64/GccInline.c | GCC
- X64/Thunk16.S | XCODE
X64/SwitchStack.nasm| GCC
- X64/SwitchStack.S | GCC
X64/SetJump.nasm| GCC
- X64/SetJump.S | GCC
X64/LongJump.nasm| GCC
- X64/LongJump.S | GCC
X64/EnableDisableInterrupts.nasm| GCC
- X64/EnableDisableInterrupts.S | GCC
X64/DisablePaging64.nasm| GCC
- X64/DisablePaging64.S | GCC
X64/CpuId.nasm| GCC
- X64/CpuId.S | GCC
X64/CpuIdEx.nasm| GCC
- X64/CpuIdEx.S | GCC
X64/EnableCache.nasm| GCC
- X64/EnableCache.S | GCC
X64/DisableCache.nasm| GCC
- X64/DisableCache.S | GCC
X64/RdRand.nasm| GCC
- X64/RdRand.S | GCC
ChkStkGcc.c | GCC
[Sources.EBC]
diff --git a/MdePkg/Library/BaseLib/Ia32/ARShiftU64.S b/MdePkg/Library/BaseLib/Ia32/ARShiftU64.S
deleted file mode 100644
index 5e993e44b5..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/ARShiftU64.S
+++ /dev/null
@@ -1,43 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ARShiftU64.S
-#
-# Abstract:
-#
-# 64-bit arithmetic right shift function for IA-32
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMathARShiftU64)
-
-#------------------------------------------------------------------------------
-# UINT64
-# EFIAPI
-# InternalMathARShiftU64 (
-# IN UINT64 Operand,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMathARShiftU64):
- movb 12(%esp), %cl
- movl 8(%esp), %eax
- cltd
- testb $32, %cl
- jnz L0
- movl %eax, %edx
- movl 4(%esp), %eax
-L0:
- shrdl %cl, %edx, %eax
- sar %cl, %edx
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuId.S b/MdePkg/Library/BaseLib/Ia32/CpuId.S
deleted file mode 100644
index b3b71a3d20..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/CpuId.S
+++ /dev/null
@@ -1,63 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CpuId.S
-#
-# Abstract:
-#
-# AsmCpuid function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(AsmCpuid)
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# AsmCpuid (
-# IN UINT32 RegisterInEax,
-# OUT UINT32 *RegisterOutEax OPTIONAL,
-# OUT UINT32 *RegisterOutEbx OPTIONAL,
-# OUT UINT32 *RegisterOutEcx OPTIONAL,
-# OUT UINT32 *RegisterOutEdx OPTIONAL
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(AsmCpuid):
- push %ebx
- push %ebp
- movl %esp, %ebp
- movl 12(%ebp), %eax
- cpuid
- push %ecx
- movl 16(%ebp), %ecx
- jecxz L1
- movl %eax, (%ecx)
-L1:
- movl 20(%ebp), %ecx
- jecxz L2
- movl %ebx, (%ecx)
-L2:
- movl 24(%ebp), %ecx
- jecxz L3
- popl (%ecx)
-L3:
- movl 28(%ebp), %ecx
- jecxz L4
- movl %edx, (%ecx)
-L4:
- movl 12(%ebp), %eax
- leave
- pop %ebx
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S b/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S
deleted file mode 100644
index 0d34c56162..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/CpuIdEx.S
+++ /dev/null
@@ -1,67 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CpuIdEx.S
-#
-# Abstract:
-#
-# AsmCpuidEx function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
- .code:
-
-#------------------------------------------------------------------------------
-# UINT32
-# EFIAPI
-# AsmCpuidEx (
-# IN UINT32 RegisterInEax,
-# IN UINT32 RegisterInEcx,
-# OUT UINT32 *RegisterOutEax OPTIONAL,
-# OUT UINT32 *RegisterOutEbx OPTIONAL,
-# OUT UINT32 *RegisterOutEcx OPTIONAL,
-# OUT UINT32 *RegisterOutEdx OPTIONAL
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(AsmCpuidEx)
-ASM_PFX(AsmCpuidEx):
- push %ebx
- push %ebp
- movl %esp, %ebp
- movl 12(%ebp), %eax
- movl 16(%ebp), %ecx
- cpuid
- push %ecx
- movl 20(%ebp), %ecx
- jecxz L1
- movl %eax, (%ecx)
-L1:
- movl 24(%ebp), %ecx
- jecxz L2
- movl %ebx, (%ecx)
-L2:
- movl 32(%ebp), %ecx
- jecxz L3
- movl %edx, (%ecx)
-L3:
- movl 28(%ebp), %ecx
- jecxz L4
- popl (%ecx)
-L4:
- movl 12(%ebp), %eax
- leave
- pop %ebx
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/DisableCache.S b/MdePkg/Library/BaseLib/Ia32/DisableCache.S
deleted file mode 100644
index 5f86da4494..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/DisableCache.S
+++ /dev/null
@@ -1,39 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# DisableCache.S
-#
-# Abstract:
-#
-# Set the CD bit of CR0 to 1, clear the NW bit of CR0 to 0, and flush all caches with a
-# WBINVD instruction.
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# AsmDisableCache (
-# VOID
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(AsmDisableCache)
-ASM_PFX(AsmDisableCache):
- movl %cr0, %eax
- btsl $30, %eax
- btrl $29, %eax
- movl %eax, %cr0
- wbinvd
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/DisablePaging32.S b/MdePkg/Library/BaseLib/Ia32/DisablePaging32.S
deleted file mode 100644
index c6daf6ac87..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/DisablePaging32.S
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# DisablePaging32.S
-#
-# Abstract:
-#
-# InternalX86DisablePaging32 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalX86DisablePaging32)
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# InternalX86DisablePaging32 (
-# IN SWITCH_STACK_ENTRY_POINT EntryPoint,
-# IN VOID *Context1, OPTIONAL
-# IN VOID *Context2, OPTIONAL
-# IN VOID *NewStack
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalX86DisablePaging32):
- movl 4(%esp), %ebx
- movl 8(%esp), %ecx
- movl 12(%esp), %edx
- pushfl
- pop %edi # save EFLAGS to edi
- cli
- movl %cr0, %eax
- btrl $31, %eax
- movl 16(%esp), %esp
- movl %eax, %cr0
- push %edi
- popfl # restore EFLAGS from edi
- push %edx
- push %ecx
- call *%ebx
- jmp . # EntryPoint() should not return
diff --git a/MdePkg/Library/BaseLib/Ia32/DivU64x32.S b/MdePkg/Library/BaseLib/Ia32/DivU64x32.S
deleted file mode 100644
index 5d3f452945..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/DivU64x32.S
+++ /dev/null
@@ -1,41 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# DivU64x32.S
-#
-# Abstract:
-#
-# Calculate the quotient of a 64-bit integer by a 32-bit integer
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMathDivU64x32)
-
-#------------------------------------------------------------------------------
-# UINT64
-# EFIAPI
-# InternalMathDivU64x32 (
-# IN UINT64 Dividend,
-# IN UINT32 Divisor
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMathDivU64x32):
- movl 8(%esp), %eax
- movl 12(%esp), %ecx
- xorl %edx, %edx
- divl %ecx
- push %eax # save quotient on stack
- movl 8(%esp), %eax
- divl %ecx
- pop %edx # restore high-order dword of the quotient
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.S b/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.S
deleted file mode 100644
index d9eb8e9e11..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.S
+++ /dev/null
@@ -1,46 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# DivError.S
-#
-# Abstract:
-#
-# Set error flag for all division functions
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMathDivRemU64x32)
-
-#------------------------------------------------------------------------------
-# UINT64
-# EFIAPI
-# InternalMathDivRemU64x32 (
-# IN UINT64 Dividend,
-# IN UINT32 Divisor,
-# OUT UINT32 *Remainder
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMathDivRemU64x32):
- movl 12(%esp), %ecx # ecx <- divisor
- movl 8(%esp), %eax # eax <- dividend[32..63]
- xorl %edx, %edx
- divl %ecx # eax <- quotient[32..63], edx <- remainder
- push %eax
- movl 8(%esp), %eax # eax <- dividend[0..31]
- divl %ecx # eax <- quotient[0..31]
- movl 20(%esp), %ecx # ecx <- Remainder
- jecxz L1 # abandon remainder if Remainder == NULL
- movl %edx, (%ecx)
-L1:
- pop %edx # edx <- quotient[32..63]
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S b/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S
deleted file mode 100644
index 9ec61b134b..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S
+++ /dev/null
@@ -1,89 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# DivU64x64Remainder.S
-#
-# Abstract:
-#
-# Calculate the quotient of a 64-bit integer by a 64-bit integer and returns
-# both the quotient and the remainder
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMathDivRemU64x32), ASM_PFX(InternalMathDivRemU64x64)
-
-#------------------------------------------------------------------------------
-# UINT64
-# EFIAPI
-# InternalMathDivRemU64x64 (
-# IN UINT64 Dividend,
-# IN UINT64 Divisor,
-# OUT UINT64 *Remainder OPTIONAL
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMathDivRemU64x64):
- movl 16(%esp), %ecx # ecx <- divisor[32..63]
- testl %ecx, %ecx
- jnz Hard # call _@DivRemU64x64 if Divisor > 2^32
- movl 20(%esp), %ecx
- jecxz L1
- andl $0, 4(%ecx) # zero high dword of remainder
- movl %ecx, 16(%esp) # set up stack frame to match DivRemU64x32
-L1:
- jmp ASM_PFX(InternalMathDivRemU64x32)
-Hard:
- push %ebx
- push %esi
- push %edi
- mov 20(%esp), %edx
- mov 16(%esp), %eax # edx:eax <- dividend
- movl %edx, %edi
- movl %eax, %esi # edi:esi <- dividend
- mov 24(%esp), %ebx # ecx:ebx <- divisor
-L2:
- shrl %edx
- rcrl $1, %eax
- shrdl $1, %ecx, %ebx
- shrl %ecx
- jnz L2
- divl %ebx
- movl %eax, %ebx # ebx <- quotient
- movl 28(%esp), %ecx # ecx <- high dword of divisor
- mull 24(%esp) # edx:eax <- quotient * divisor[0..31]
- imull %ebx, %ecx # ecx <- quotient * divisor[32..63]
- addl %ecx, %edx # edx <- (quotient * divisor)[32..63]
- mov 32(%esp), %ecx # ecx <- addr for Remainder
- jc TooLarge # product > 2^64
- cmpl %edx, %edi # compare high 32 bits
- ja Correct
- jb TooLarge # product > dividend
- cmpl %eax, %esi
- jae Correct # product <= dividend
-TooLarge:
- decl %ebx # adjust quotient by -1
- jecxz Return # return if Remainder == NULL
- sub 24(%esp), %eax
- sbb 28(%esp), %edx # edx:eax <- (quotient - 1) * divisor
-Correct:
- jecxz Return
- subl %eax, %esi
- sbbl %edx, %edi # edi:esi <- remainder
- movl %esi, (%ecx)
- movl %edi, 4(%ecx)
-Return:
- movl %ebx, %eax # eax <- quotient
- xorl %edx, %edx # quotient is 32 bits long
- pop %edi
- pop %esi
- pop %ebx
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/EnableCache.S b/MdePkg/Library/BaseLib/Ia32/EnableCache.S
deleted file mode 100644
index b41dd0d22a..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/EnableCache.S
+++ /dev/null
@@ -1,39 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# EnableCache.S
-#
-# Abstract:
-#
-# Flush all caches with a WBINVD instruction, clear the CD bit of CR0 to 0, and clear
-# the NW bit of CR0 to 0
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# AsmEnableCache (
-# VOID
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(AsmEnableCache)
-ASM_PFX(AsmEnableCache):
- wbinvd
- movl %cr0, %eax
- btrl $30, %eax
- btrl $29, %eax
- movl %eax, %cr0
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.S b/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.S
deleted file mode 100644
index bc89c258b7..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.S
+++ /dev/null
@@ -1,36 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# EnableDisableInterrupts.S
-#
-# Abstract:
-#
-# EnableDisableInterrupts function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(EnableDisableInterrupts)
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# EnableDisableInterrupts (
-# VOID
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(EnableDisableInterrupts):
- sti
- cli
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/EnablePaging32.S b/MdePkg/Library/BaseLib/Ia32/EnablePaging32.S
deleted file mode 100644
index 1a168c9cd9..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/EnablePaging32.S
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# EnablePaging32.S
-#
-# Abstract:
-#
-# InternalX86EnablePaging32 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalX86EnablePaging32)
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# InternalX86EnablePaging32 (
-# IN SWITCH_STACK_ENTRY_POINT EntryPoint,
-# IN VOID *Context1, OPTIONAL
-# IN VOID *Context2, OPTIONAL
-# IN VOID *NewStack
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalX86EnablePaging32):
- movl 4(%esp), %ebx
- movl 8(%esp), %ecx
- movl 12(%esp), %edx
- pushfl
- pop %edi # save flags in edi
- cli
- movl %cr0, %eax
- btsl $31, %eax
- movl 16(%esp), %esp
- movl %eax, %cr0
- push %edi
- popfl # restore flags
- push %edx
- push %ecx
- call *%ebx
- jmp .
diff --git a/MdePkg/Library/BaseLib/Ia32/EnablePaging64.S b/MdePkg/Library/BaseLib/Ia32/EnablePaging64.S
deleted file mode 100644
index 08950ce0e2..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/EnablePaging64.S
+++ /dev/null
@@ -1,63 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# EnablePaging64.S
-#
-# Abstract:
-#
-# InternalX86EnablePaging64 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalX86EnablePaging64)
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# InternalX86EnablePaging64 (
-# IN UINT16 CodeSelector,
-# IN UINT64 EntryPoint,
-# IN UINT64 Context1, OPTIONAL
-# IN UINT64 Context2, OPTIONAL
-# IN UINT64 NewStack
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalX86EnablePaging64):
- cli
- movl $LongStart, (%esp) # offset for far retf, seg is the 1st arg
- movl %cr4, %eax
- orb $0x20, %al
- movl %eax, %cr4 # enable PAE
- movl $0xc0000080, %ecx
- rdmsr
- orb $1, %ah # set LME
- wrmsr
- movl %cr0, %eax
- btsl $31, %eax # set PG
- movl %eax, %cr0 # enable paging
- lret # topmost 2 dwords hold the address
-LongStart: # long mode starts here
- .byte 0x67, 0x48 # 32-bit address size, 64-bit operand size
- movl (%esp), %ebx # mov rbx, [esp]
- .byte 0x67, 0x48
- movl 8(%esp), %ecx # mov rcx, [esp + 8]
- .byte 0x67, 0x48
- movl 0x10(%esp), %edx # mov rdx, [esp + 10h]
- .byte 0x67, 0x48
- movl 0x18(%esp), %esp # mov rsp, [esp + 18h]
- .byte 0x48
- addl $-0x20, %esp # add rsp, -20h
- call *%ebx # call rbx
- jmp . # no one should get here
diff --git a/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.S b/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.S
deleted file mode 100644
index 027379efd7..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.S
+++ /dev/null
@@ -1,48 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# Portions copyright (c) 2011, Apple Inc. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# InternalSwitchStack.S
-#
-# Abstract:
-#
-# Implementation of a stack switch on IA-32.
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalSwitchStack)
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# InternalSwitchStack (
-# IN SWITCH_STACK_ENTRY_POINT EntryPoint,
-# IN VOID *Context1, OPTIONAL
-# IN VOID *Context2, OPTIONAL
-# IN VOID *NewStack
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalSwitchStack):
- pushl %ebp
- movl %esp, %ebp
-
- movl 20(%ebp), %esp # switch stack
- subl $8, %esp
-
- movl 16(%ebp), %eax
- movl %eax, 4(%esp)
- movl 12(%ebp), %eax
- movl %eax, (%esp)
- pushl $0 # keeps gdb from unwinding stack
- jmp *8(%ebp) # call and never return
-
diff --git a/MdePkg/Library/BaseLib/Ia32/LRotU64.S b/MdePkg/Library/BaseLib/Ia32/LRotU64.S
deleted file mode 100644
index accac8b89d..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/LRotU64.S
+++ /dev/null
@@ -1,48 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# LRotU64.S
-#
-# Abstract:
-#
-# 64-bit left rotation for Ia32
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMathLRotU64)
-
-#------------------------------------------------------------------------------
-# UINT64
-# EFIAPI
-# InternalMathLRotU64 (
-# IN UINT64 Operand,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMathLRotU64):
- push %ebx
- movb 16(%esp), %cl
- movl 12(%esp), %edx
- movl 8(%esp), %eax
- shldl %cl, %edx, %ebx
- shldl %cl, %eax, %edx
- rorl %cl, %ebx
- shldl %cl, %ebx, %eax
- testb $32, %cl # Count >= 32?
- jz L0
- movl %eax, %ecx
- movl %edx, %eax
- movl %ecx, %edx
-L0:
- pop %ebx
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/LShiftU64.S b/MdePkg/Library/BaseLib/Ia32/LShiftU64.S
deleted file mode 100644
index 90baed001c..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/LShiftU64.S
+++ /dev/null
@@ -1,43 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# LShiftU64.S
-#
-# Abstract:
-#
-# 64-bit left shift function for IA-32
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMathLShiftU64)
-
-#------------------------------------------------------------------------------
-# UINT64
-# EFIAPI
-# InternalMathLShiftU64 (
-# IN UINT64 Operand,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMathLShiftU64):
- movb 12(%esp), %cl
- xorl %eax, %eax
- movl 4(%esp), %edx
- testb $32, %cl # Count >= 32?
- jnz L0
- movl %edx, %eax
- movl 0x8(%esp), %edx
-L0:
- shld %cl, %eax, %edx
- shl %cl, %eax
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/LongJump.S b/MdePkg/Library/BaseLib/Ia32/LongJump.S
deleted file mode 100644
index 4514cd3bf1..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/LongJump.S
+++ /dev/null
@@ -1,41 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# LongJump.S
-#
-# Abstract:
-#
-# Implementation of _LongJump() on IA-32.
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalLongJump)
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# InternalLongJump (
-# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
-# IN UINTN Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalLongJump):
- pop %eax # skip return address
- pop %edx # edx <- JumpBuffer
- pop %eax # eax <- Value
- movl (%edx), %ebx
- movl 4(%edx), %esi
- movl 8(%edx), %edi
- movl 12(%edx), %ebp
- movl 16(%edx), %esp
- jmp *20(%edx) # restore "eip"
diff --git a/MdePkg/Library/BaseLib/Ia32/ModU64x32.S b/MdePkg/Library/BaseLib/Ia32/ModU64x32.S
deleted file mode 100644
index beb2217734..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/ModU64x32.S
+++ /dev/null
@@ -1,40 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# DivU64x32.S
-#
-# Abstract:
-#
-# Calculate the remainder of a 64-bit integer by a 32-bit integer
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMathModU64x32)
-
-#------------------------------------------------------------------------------
-# UINT32
-# EFIAPI
-# InternalMathModU64x32 (
-# IN UINT64 Dividend,
-# IN UINT32 Divisor
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMathModU64x32):
- movl 8(%esp), %eax
- movl 12(%esp), %ecx
- xorl %edx, %edx
- divl %ecx
- movl 4(%esp), %eax
- divl %ecx
- movl %edx, %eax
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/Monitor.S b/MdePkg/Library/BaseLib/Ia32/Monitor.S
deleted file mode 100644
index 1e5f40e770..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/Monitor.S
+++ /dev/null
@@ -1,40 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# Monitor.S
-#
-# Abstract:
-#
-# AsmMonitor function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(AsmMonitor)
-
-#------------------------------------------------------------------------------
-# UINT64
-# EFIAPI
-# AsmMonitor (
-# IN UINTN Eax,
-# IN UINTN Ecx,
-# IN UINTN Edx
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(AsmMonitor):
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- movl 12(%esp), %edx
- monitor %eax, %ecx, %edx # monitor
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/MultU64x32.S b/MdePkg/Library/BaseLib/Ia32/MultU64x32.S
deleted file mode 100644
index 8e3f6f5560..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/MultU64x32.S
+++ /dev/null
@@ -1,41 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# MultU64x32.S
-#
-# Abstract:
-#
-# Calculate the product of a 64-bit integer and a 32-bit integer
-#
-#------------------------------------------------------------------------------
-
-
- .code:
-
-ASM_GLOBAL ASM_PFX(InternalMathMultU64x32)
-
-#------------------------------------------------------------------------------
-# UINT64
-# EFIAPI
-# InternalMathMultU64x32 (
-# IN UINT64 Multiplicand,
-# IN UINT32 Multiplier
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMathMultU64x32):
- movl 12(%esp), %ecx
- movl %ecx, %eax
- imull 8(%esp), %ecx # overflow not detectable
- mull 0x4(%esp)
- addl %ecx, %edx
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/MultU64x64.S b/MdePkg/Library/BaseLib/Ia32/MultU64x64.S
deleted file mode 100644
index 4e4fe710a7..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/MultU64x64.S
+++ /dev/null
@@ -1,44 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# MultU64x64.S
-#
-# Abstract:
-#
-# Calculate the product of a 64-bit integer and another 64-bit integer
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMathMultU64x64)
-
-#------------------------------------------------------------------------------
-# UINT64
-# EFIAPI
-# InternalMathMultU64x64 (
-# IN UINT64 Multiplicand,
-# IN UINT64 Multiplier
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMathMultU64x64):
- push %ebx
- movl 8(%esp), %ebx # ebx <- M1[0..31]
- movl 16(%esp), %edx # edx <- M2[0..31]
- movl %ebx, %ecx
- movl %edx, %eax
- imull 20(%esp), %ebx # ebx <- M1[0..31] * M2[32..63]
- imull 12(%esp), %edx # edx <- M1[32..63] * M2[0..31]
- addl %edx, %ebx # carries are abandoned
- mull %ecx # edx:eax <- M1[0..31] * M2[0..31]
- addl %ebx, %edx # carries are abandoned
- pop %ebx
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/Mwait.S b/MdePkg/Library/BaseLib/Ia32/Mwait.S
deleted file mode 100644
index 22b3ffd0a4..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/Mwait.S
+++ /dev/null
@@ -1,38 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# Mwait.S
-#
-# Abstract:
-#
-# AsmMwait function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(AsmMwait)
-
-#------------------------------------------------------------------------------
-# UINT64
-# EFIAPI
-# AsmMwait (
-# IN UINTN Eax,
-# IN UINTN Ecx
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(AsmMwait):
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- mwait
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/RRotU64.S b/MdePkg/Library/BaseLib/Ia32/RRotU64.S
deleted file mode 100644
index 426fcd6de3..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/RRotU64.S
+++ /dev/null
@@ -1,48 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# RRotU64.S
-#
-# Abstract:
-#
-# 64-bit right rotation for Ia32
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMathRRotU64)
-
-#------------------------------------------------------------------------------
-# UINT64
-# EFIAPI
-# InternalMathRRotU64 (
-# IN UINT64 Operand,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMathRRotU64):
- push %ebx
- movb 16(%esp), %cl
- movl 8(%esp), %eax
- movl 12(%esp), %edx
- shrdl %cl, %eax, %ebx
- shrdl %cl, %edx, %eax
- roll %cl, %ebx
- shrdl %cl, %ebx, %edx
- testb $32, %cl # Count >= 32?
- jz L0
- movl %eax, %ecx # switch eax & edx if Count >= 32
- movl %edx, %eax
- movl %ecx, %edx
-L0:
- pop %ebx
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/RShiftU64.S b/MdePkg/Library/BaseLib/Ia32/RShiftU64.S
deleted file mode 100644
index 28102303f2..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/RShiftU64.S
+++ /dev/null
@@ -1,46 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# RShiftU64.S
-#
-# Abstract:
-#
-# 64-bit logical right shift function for IA-32
-#
-#------------------------------------------------------------------------------
-
-
- .code:
-
-ASM_GLOBAL ASM_PFX(InternalMathRShiftU64)
-
-#------------------------------------------------------------------------------
-# UINT64
-# EFIAPI
-# InternalMathRShiftU64 (
-# IN UINT64 Operand,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMathRShiftU64):
- movb 12(%esp), %cl # cl <- Count
- xorl %edx, %edx
- movl 8(%esp), %eax
- testb $32, %cl # Count >= 32?
- jnz L0
- movl %eax, %edx
- movl 0x4(%esp), %eax
-L0:
- shrdl %cl, %edx, %eax
- shr %cl, %edx
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/RdRand.S b/MdePkg/Library/BaseLib/Ia32/RdRand.S
deleted file mode 100644
index d00075afe7..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/RdRand.S
+++ /dev/null
@@ -1,80 +0,0 @@
-#------------------------------------------------------------------------------ ;
-# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# RdRand.S
-#
-# Abstract:
-#
-# Generates random number through CPU RdRand instruction under 32-bit platform.
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-// Generates a 16 bit random number through RDRAND instruction.
-// Return TRUE if Rand generated successfully, or FALSE if not.
-//
-// BOOLEAN EFIAPI InternalX86RdRand16 (UINT16 *Rand);
-//------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalX86RdRand16)
-ASM_PFX(InternalX86RdRand16):
- .byte 0x0f, 0xc7, 0xf0 // rdrand r16: "0f c7 /6 ModRM:r/m(w)"
- jc rn16_ok // jmp if CF=1
- xor %eax, %eax // reg=0 if CF=0
- ret // return with failure status
-rn16_ok:
- mov 0x4(%esp), %edx
- mov %ax, (%edx)
- mov $0x1, %eax
- ret
-
-//------------------------------------------------------------------------------
-// Generates a 32 bit random number through RDRAND instruction.
-// Return TRUE if Rand generated successfully, or FALSE if not.
-//
-// BOOLEAN EFIAPI InternalX86RdRand32 (UINT32 *Rand);
-//------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalX86RdRand32)
-ASM_PFX(InternalX86RdRand32):
- .byte 0x0f, 0xc7, 0xf0 // rdrand r32: "0f c7 /6 ModRM:r/m(w)"
- jc rn32_ok // jmp if CF=1
- xor %eax, %eax // reg=0 if CF=0
- ret // return with failure status
-rn32_ok:
- mov 0x4(%esp), %edx
- mov %eax, (%edx)
- mov $0x1, %eax
- ret
-
-//------------------------------------------------------------------------------
-// Generates a 64 bit random number through RDRAND instruction.
-// Return TRUE if Rand generated successfully, or FALSE if not.
-//
-// BOOLEAN EFIAPI InternalX86RdRand64 (UINT64 *Rand);
-//------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalX86RdRand64)
-ASM_PFX(InternalX86RdRand64):
- .byte 0x0f, 0xc7, 0xf0 // rdrand r32: "0f c7 /6 ModRM:r/m(w)"
- jnc rn64_ret // jmp if CF=0
- mov 0x4(%esp), %edx
- mov %eax, (%edx)
-
- .byte 0x0f, 0xc7, 0xf0 // generate another 32 bit RN
- jnc rn64_ret // jmp if CF=0
- mov %eax, 0x4(%edx)
-
- mov $0x1, %eax
- ret
-rn64_ret:
- xor %eax, %eax
- ret // return with failure status
diff --git a/MdePkg/Library/BaseLib/Ia32/SetJump.S b/MdePkg/Library/BaseLib/Ia32/SetJump.S
deleted file mode 100644
index 459224e6c8..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/SetJump.S
+++ /dev/null
@@ -1,44 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetJump.S
-#
-# Abstract:
-#
-# Implementation of SetJump() on IA-32.
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(SetJump), ASM_PFX(InternalAssertJumpBuffer)
-
-#------------------------------------------------------------------------------
-# UINTN
-# EFIAPI
-# SetJump (
-# OUT BASE_LIBRARY_JUMP_BUFFER *JumpBuffer
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(SetJump):
- pushl 0x4(%esp)
- call ASM_PFX(InternalAssertJumpBuffer) # To validate JumpBuffer
- pop %ecx
- pop %ecx # ecx <- return address
- movl (%esp), %edx
- movl %ebx, (%edx)
- movl %esi, 4(%edx)
- movl %edi, 8(%edx)
- movl %ebp, 12(%edx)
- movl %esp, 16(%edx)
- movl %ecx, 20(%edx) # eip value to restore in LongJump
- xorl %eax, %eax
- jmp *%ecx
diff --git a/MdePkg/Library/BaseLib/Ia32/SwapBytes64.S b/MdePkg/Library/BaseLib/Ia32/SwapBytes64.S
deleted file mode 100644
index ce4ebc8110..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/SwapBytes64.S
+++ /dev/null
@@ -1,38 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CpuId.S
-#
-# Abstract:
-#
-# AsmCpuid function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# UINT64
-# EFIAPI
-# InternalMathSwapBytes64 (
-# IN UINT64 Operand
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMathSwapBytes64)
-ASM_PFX(InternalMathSwapBytes64):
- movl 8(%esp), %eax # eax <- upper 32 bits
- movl 4(%esp), %edx # edx <- lower 32 bits
- bswapl %eax
- bswapl %edx
- ret
diff --git a/MdePkg/Library/BaseLib/Ia32/Thunk16.S b/MdePkg/Library/BaseLib/Ia32/Thunk16.S
deleted file mode 100644
index 185655eecb..0000000000
--- a/MdePkg/Library/BaseLib/Ia32/Thunk16.S
+++ /dev/null
@@ -1,222 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# Thunk16.S
-#
-# Abstract:
-#
-# Real mode thunk
-#
-#------------------------------------------------------------------------------
-
-#include <Library/BaseLib.h>
-
-ASM_GLOBAL ASM_PFX(m16Start), ASM_PFX(m16Size), ASM_PFX(mThunk16Attr), ASM_PFX(m16Gdt), ASM_PFX(m16GdtrBase), ASM_PFX(mTransition)
-ASM_GLOBAL ASM_PFX(InternalAsmThunk16)
-
-# define the structure of IA32_REGS
-.set _EDI, 0 #size 4
-.set _ESI, 4 #size 4
-.set _EBP, 8 #size 4
-.set _ESP, 12 #size 4
-.set _EBX, 16 #size 4
-.set _EDX, 20 #size 4
-.set _ECX, 24 #size 4
-.set _EAX, 28 #size 4
-.set _DS, 32 #size 2
-.set _ES, 34 #size 2
-.set _FS, 36 #size 2
-.set _GS, 38 #size 2
-.set _EFLAGS, 40 #size 4
-.set _EIP, 44 #size 4
-.set _CS, 48 #size 2
-.set _SS, 50 #size 2
-.set IA32_REGS_SIZE, 52
-
- .text
- .code16
-
-ASM_PFX(m16Start):
-
-SavedGdt: .space 6
-
-ASM_PFX(BackFromUserCode):
- push %ss
- push %cs
-
- calll L_Base1 # push eip
-L_Base1:
- pushfl
- cli # disable interrupts
- push %gs
- push %fs
- push %es
- push %ds
- pushal
- .byte 0x66, 0xba # mov edx, imm32
-ASM_PFX(ThunkAttr): .space 4
- testb $THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15, %dl
- jz 1f
- movw $0x2401, %ax
- int $0x15
- cli # disable interrupts
- jnc 2f
-1:
- testb $THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL, %dl
- jz 2f
- inb $0x92, %al
- orb $2, %al
- outb %al, $0x92 # deactivate A20M#
-2:
- xorl %eax, %eax
- movw %ss, %ax
- leal IA32_REGS_SIZE(%esp), %ebp
- mov %ebp, (_ESP - IA32_REGS_SIZE)(%bp)
- mov (_EIP - IA32_REGS_SIZE)(%bp), %bx
- shll $4, %eax
- addl %eax, %ebp
- .byte 0x66, 0xb8 # mov eax, imm32
-SavedCr4: .space 4
- movl %eax, %cr4
- lgdtl %cs:(SavedGdt - L_Base1)(%bx)
- .byte 0x66, 0xb8 # mov eax, imm32
-SavedCr0: .space 4
- movl %eax, %cr0
- .byte 0xb8 # mov ax, imm16
-SavedSs: .space 2
- movl %eax, %ss
- .byte 0x66, 0xbc # mov esp, imm32
-SavedEsp: .space 4
- lretl # return to protected mode
-
-_EntryPoint: .long ASM_PFX(ToUserCode) - ASM_PFX(m16Start)
- .word 0x8
-_16Idtr: .word 0x3ff
- .long 0
-_16Gdtr: .word GdtEnd - _NullSegDesc - 1
-_16GdtrBase: .long _NullSegDesc
-
-ASM_PFX(ToUserCode):
- movw %ss, %dx
- movw %cx, %ss # set new segment selectors
- movw %cx, %ds
- movw %cx, %es
- movw %cx, %fs
- movw %cx, %gs
- movl %eax, %cr0 # real mode starts at next instruction
- # which (per SDM) *must* be a far JMP.
- ljmpw $0,$0 # will be filled in by InternalAsmThunk16
-L_Base: # to point here.
- movl %ebp, %cr4
- movw %si, %ss # set up 16-bit stack segment
- xchgl %ebx, %esp # set up 16-bit stack pointer
-
- movw IA32_REGS_SIZE(%esp), %bp # get BackToUserCode address from stack
- mov %dx, %cs:(SavedSs - ASM_PFX(BackFromUserCode))(%bp)
- mov %ebx, %cs:(SavedEsp - ASM_PFX(BackFromUserCode))(%bp)
- lidtl %cs:(_16Idtr - ASM_PFX(BackFromUserCode))(%bp)
- popal
- pop %ds
- pop %es
- pop %fs
- pop %gs
- popfl
- lretl # transfer control to user code
-
-_NullSegDesc: .quad 0
-_16CsDesc:
- .word -1
- .word 0
- .byte 0
- .byte 0x9b
- .byte 0x8f # 16-bit segment, 4GB limit
- .byte 0
-_16DsDesc:
- .word -1
- .word 0
- .byte 0
- .byte 0x93
- .byte 0x8f # 16-bit segment, 4GB limit
- .byte 0
-GdtEnd:
-
- .code32
-#
-# @param RegSet The pointer to a IA32_DWORD_REGS structure
-# @param Transition The pointer to the transition code
-# @return The address of the 16-bit stack after returning from user code
-#
-ASM_PFX(InternalAsmThunk16):
- push %ebp
- push %ebx
- push %esi
- push %edi
- push %ds
- push %es
- push %fs
- push %gs
- movl 36(%esp), %esi # esi <- RegSet
- movzwl _SS(%esi), %edx
- mov _ESP(%esi), %edi
- add $(-(IA32_REGS_SIZE + 4)), %edi
- movl %edi, %ebx # ebx <- stack offset
- imul $0x10, %edx, %eax
- push $(IA32_REGS_SIZE / 4)
- addl %eax, %edi # edi <- linear address of 16-bit stack
- pop %ecx
- rep
- movsl # copy RegSet
- movl 40(%esp), %eax # eax <- address of transition code
- movl %edx, %esi # esi <- 16-bit stack segment
- lea (SavedCr0 - ASM_PFX(m16Start))(%eax), %edx
- movl %eax, %ecx
- andl $0xf, %ecx
- shll $12, %eax
- lea (ASM_PFX(BackFromUserCode) - ASM_PFX(m16Start))(%ecx), %ecx
- movw %cx, %ax
- stosl # [edi] <- return address of user code
- addl $(L_Base - ASM_PFX(BackFromUserCode)), %eax
- movl %eax, (L_Base - SavedCr0 - 4)(%edx)
- sgdtl (SavedGdt - SavedCr0)(%edx)
- sidtl 0x24(%esp)
- movl %cr0, %eax
- movl %eax, (%edx) # save CR0 in SavedCr0
- andl $0x7ffffffe, %eax # clear PE, PG bits
- movl %cr4, %ebp
- mov %ebp, (SavedCr4 - SavedCr0)(%edx)
- andl $0xffffffcf, %ebp # clear PAE, PSE bits
- pushl $0x10
- pop %ecx # ecx <- selector for data segments
- lgdtl (_16Gdtr - SavedCr0)(%edx)
- pushfl
- lcall *(_EntryPoint - SavedCr0)(%edx)
- popfl
- lidtl 0x24(%esp)
- lea -IA32_REGS_SIZE(%ebp), %eax
- pop %gs
- pop %fs
- pop %es
- pop %ds
- pop %edi
- pop %esi
- pop %ebx
- pop %ebp
- ret
-
- .const:
-
-ASM_PFX(m16Size): .word ASM_PFX(InternalAsmThunk16) - ASM_PFX(m16Start)
-ASM_PFX(mThunk16Attr): .word ASM_PFX(ThunkAttr) - ASM_PFX(m16Start)
-ASM_PFX(m16Gdt): .word _NullSegDesc - ASM_PFX(m16Start)
-ASM_PFX(m16GdtrBase): .word _16GdtrBase - ASM_PFX(m16Start)
-ASM_PFX(mTransition): .word _EntryPoint - ASM_PFX(m16Start)
diff --git a/MdePkg/Library/BaseLib/X64/CpuId.S b/MdePkg/Library/BaseLib/X64/CpuId.S
deleted file mode 100644
index c3d2597205..0000000000
--- a/MdePkg/Library/BaseLib/X64/CpuId.S
+++ /dev/null
@@ -1,60 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CpuId.S
-#
-# Abstract:
-#
-# AsmCpuid function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# AsmCpuid (
-# IN UINT32 RegisterInEax,
-# OUT UINT32 *RegisterOutEax OPTIONAL,
-# OUT UINT32 *RegisterOutEbx OPTIONAL,
-# OUT UINT32 *RegisterOutEcx OPTIONAL,
-# OUT UINT32 *RegisterOutEdx OPTIONAL
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(AsmCpuid)
-ASM_PFX(AsmCpuid):
- push %rbx
- mov %ecx, %eax
- push %rax # save Index on stack
- push %rdx
- cpuid
- test %r9, %r9
- jz L1
- mov %ecx, (%r9)
-L1:
- pop %rcx
- jrcxz L2
- mov %eax, (%rcx)
-L2:
- mov %r8, %rcx
- jrcxz L3
- mov %ebx, (%rcx)
-L3:
- mov 0x38(%rsp), %rcx
- jrcxz L4
- mov %edx, (%rcx)
-L4:
- pop %rax # restore Index to rax as return value
- pop %rbx
- ret
diff --git a/MdePkg/Library/BaseLib/X64/CpuIdEx.S b/MdePkg/Library/BaseLib/X64/CpuIdEx.S
deleted file mode 100644
index 0bc2540011..0000000000
--- a/MdePkg/Library/BaseLib/X64/CpuIdEx.S
+++ /dev/null
@@ -1,62 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CpuIdEx.S
-#
-# Abstract:
-#
-# AsmCpuidEx function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-#------------------------------------------------------------------------------
-# UINT32
-# EFIAPI
-# AsmCpuidEx (
-# IN UINT32 RegisterInEax,
-# IN UINT32 RegisterInEcx,
-# OUT UINT32 *RegisterOutEax OPTIONAL,
-# OUT UINT32 *RegisterOutEbx OPTIONAL,
-# OUT UINT32 *RegisterOutEcx OPTIONAL,
-# OUT UINT32 *RegisterOutEdx OPTIONAL
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(AsmCpuidEx)
-ASM_PFX(AsmCpuidEx):
- push %rbx
- movl %ecx,%eax
- movl %edx,%ecx
- push %rax # save Index on stack
- cpuid
- mov 0x38(%rsp), %r10
- test %r10, %r10
- jz L1
- mov %ecx,(%r10)
-L1:
- mov %r8, %rcx
- jrcxz L2
- movl %eax,(%rcx)
-L2:
- mov %r9, %rcx
- jrcxz L3
- mov %ebx, (%rcx)
-L3:
- mov 0x40(%rsp), %rcx
- jrcxz L4
- mov %edx, (%rcx)
-L4:
- pop %rax # restore Index to rax as return value
- pop %rbx
- ret
diff --git a/MdePkg/Library/BaseLib/X64/DisableCache.S b/MdePkg/Library/BaseLib/X64/DisableCache.S
deleted file mode 100644
index 970f2f3618..0000000000
--- a/MdePkg/Library/BaseLib/X64/DisableCache.S
+++ /dev/null
@@ -1,39 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# DisableCache.S
-#
-# Abstract:
-#
-# Set the CD bit of CR0 to 1, clear the NW bit of CR0 to 0, and flush all caches with a
-# WBINVD instruction.
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# AsmDisableCache (
-# VOID
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(AsmDisableCache)
-ASM_PFX(AsmDisableCache):
- movq %cr0, %rax
- btsq $30, %rax
- btrq $29, %rax
- movq %rax, %cr0
- wbinvd
- ret
diff --git a/MdePkg/Library/BaseLib/X64/DisablePaging64.S b/MdePkg/Library/BaseLib/X64/DisablePaging64.S
deleted file mode 100644
index 220a59127b..0000000000
--- a/MdePkg/Library/BaseLib/X64/DisablePaging64.S
+++ /dev/null
@@ -1,82 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# DisablePaging64.S
-#
-# Abstract:
-#
-# AsmDisablePaging64 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# InternalX86DisablePaging64 (
-# IN UINT16 Cs,
-# IN UINT32 EntryPoint,
-# IN UINT32 Context1, OPTIONAL
-# IN UINT32 Context2, OPTIONAL
-# IN UINT32 NewStack
-# );
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalX86DisablePaging64)
-ASM_PFX(InternalX86DisablePaging64):
- cli
- lea L1(%rip), %rsi # rsi <- The start address of transition code
- mov 0x28(%rsp), %edi # rdi <- New stack
- lea _mTransitionEnd(%rip), %rax # rax <- end of transition code
- sub %rsi, %rax # rax <- The size of transition piece code
- add $4, %rax # round rax up to the next 4 byte boundary
- and $0xfc, %al
- sub %rax, %rdi # rdi <- use stack to hold transition code
- mov %edi, %r10d # r10 <- The start address of transicition code below 4G
- push %rcx # save rcx to stack
- mov %rax, %rcx # rcx <- The size of transition piece code
- rep
- movsb # copy transition code to (new stack - 64byte) below 4G
- pop %rcx # restore rcx
-
- mov %r8d, %esi
- mov %r9d, %edi
- mov %r10d, %eax
- sub $4, %eax
- push %rcx # push Cs to stack
- push %r10 # push address of transition code on stack
- .byte 0x48, 0xcb # retq: Use far return to load CS register from stack
- # (Use raw byte code since some GNU assemblers generates incorrect code for "retq")
-L1:
- mov %eax,%esp # set up new stack
- mov %cr0,%rax
- btr $0x1f,%eax # clear CR0.PG
- mov %rax,%cr0 # disable paging
-
- mov %edx,%ebx # save EntryPoint to ebx, for rdmsr will overwrite edx
- mov $0xc0000080,%ecx
- rdmsr
- and $0xfe,%ah # clear LME
- wrmsr
- mov %cr4,%rax
- and $0xdf,%al # clear PAE
- mov %rax,%cr4
- push %rdi # push Context2
- push %rsi # push Context1
- callq *%rbx # transfer control to EntryPoint
- jmp . # no one should get here
-
-_mTransitionEnd :
diff --git a/MdePkg/Library/BaseLib/X64/EnableCache.S b/MdePkg/Library/BaseLib/X64/EnableCache.S
deleted file mode 100644
index 9f01f3d793..0000000000
--- a/MdePkg/Library/BaseLib/X64/EnableCache.S
+++ /dev/null
@@ -1,39 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# EnableCache.S
-#
-# Abstract:
-#
-# Flush all caches with a WBINVD instruction, clear the CD bit of CR0 to 0, and clear
-# the NW bit of CR0 to 0
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# AsmEnableCache (
-# VOID
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(AsmEnableCache)
-ASM_PFX(AsmEnableCache):
- wbinvd
- movq %cr0, %rax
- btrq $30, %rax
- btrq $29, %rax
- movq %rax, %cr0
- ret
diff --git a/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S b/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S
deleted file mode 100644
index f2ff61ecfd..0000000000
--- a/MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S
+++ /dev/null
@@ -1,36 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# EnableDisableInterrupts.S
-#
-# Abstract:
-#
-# EnableDisableInterrupts function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# EnableDisableInterrupts (
-# VOID
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(EnableDisableInterrupts)
-ASM_PFX(EnableDisableInterrupts):
- sti
- cli
- ret
diff --git a/MdePkg/Library/BaseLib/X64/LongJump.S b/MdePkg/Library/BaseLib/X64/LongJump.S
deleted file mode 100644
index 5256529f06..0000000000
--- a/MdePkg/Library/BaseLib/X64/LongJump.S
+++ /dev/null
@@ -1,54 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# LongJump.S
-#
-# Abstract:
-#
-# Implementation of _LongJump() on x64.
-#
-#------------------------------------------------------------------------------
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# InternalLongJump (
-# IN BASE_LIBRARY_JUMP_BUFFER *JumpBuffer,
-# IN UINTN Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalLongJump)
-ASM_PFX(InternalLongJump):
- mov (%rcx), %rbx
- mov 0x8(%rcx), %rsp
- mov 0x10(%rcx), %rbp
- mov 0x18(%rcx), %rdi
- mov 0x20(%rcx), %rsi
- mov 0x28(%rcx), %r12
- mov 0x30(%rcx), %r13
- mov 0x38(%rcx), %r14
- mov 0x40(%rcx), %r15
- # load non-volatile fp registers
- ldmxcsr 0x50(%rcx)
- movdqu 0x58(%rcx), %xmm6
- movdqu 0x68(%rcx), %xmm7
- movdqu 0x78(%rcx), %xmm8
- movdqu 0x88(%rcx), %xmm9
- movdqu 0x98(%rcx), %xmm10
- movdqu 0xA8(%rcx), %xmm11
- movdqu 0xB8(%rcx), %xmm12
- movdqu 0xC8(%rcx), %xmm13
- movdqu 0xD8(%rcx), %xmm14
- movdqu 0xE8(%rcx), %xmm15
- mov %rdx, %rax # set return value
- jmp *0x48(%rcx)
diff --git a/MdePkg/Library/BaseLib/X64/RdRand.S b/MdePkg/Library/BaseLib/X64/RdRand.S
deleted file mode 100644
index 55724c0868..0000000000
--- a/MdePkg/Library/BaseLib/X64/RdRand.S
+++ /dev/null
@@ -1,72 +0,0 @@
-#------------------------------------------------------------------------------ ;
-# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# RdRand.S
-#
-# Abstract:
-#
-# Generates random number through CPU RdRand instruction under 64-bit platform.
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-//------------------------------------------------------------------------------
-// Generates a 16 bit random number through RDRAND instruction.
-// Return TRUE if Rand generated successfully, or FALSE if not.
-//
-// BOOLEAN EFIAPI InternalX86RdRand16 (UINT16 *Rand);
-//------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalX86RdRand16)
-ASM_PFX(InternalX86RdRand16):
- .byte 0x0f, 0xc7, 0xf0 // rdrand r16: "0f c7 /6 ModRM:r/m(w)"
- jc rn16_ok // jmp if CF=1
- xor %rax, %rax // reg=0 if CF=0
- ret // return with failure status
-rn16_ok:
- mov %ax, (%rcx)
- mov $0x1, %rax
- ret
-
-//------------------------------------------------------------------------------
-// Generates a 32 bit random number through RDRAND instruction.
-// Return TRUE if Rand generated successfully, or FALSE if not.
-//
-// BOOLEAN EFIAPI InternalX86RdRand32 (UINT32 *Rand);
-//------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalX86RdRand32)
-ASM_PFX(InternalX86RdRand32):
- .byte 0x0f, 0xc7, 0xf0 // rdrand r32: "0f c7 /6 ModRM:r/m(w)"
- jc rn32_ok // jmp if CF=1
- xor %rax, %rax // reg=0 if CF=0
- ret // return with failure status
-rn32_ok:
- mov %eax, (%rcx)
- mov $0x1, %rax
- ret
-
-//------------------------------------------------------------------------------
-// Generates a 64 bit random number through RDRAND instruction.
-// Return TRUE if Rand generated successfully, or FALSE if not.
-//
-// BOOLEAN EFIAPI InternalX86RdRand64 (UINT64 *Rand);
-//------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalX86RdRand64)
-ASM_PFX(InternalX86RdRand64):
- .byte 0x48, 0x0f, 0xc7, 0xf0 // rdrand r64: "REX.W + 0f c7 /6 ModRM:r/m(w)"
- jc rn64_ok // jmp if CF=1
- xor %rax, %rax // reg=0 if CF=0
- ret // return with failure status
-rn64_ok:
- mov %rax, (%rcx)
- mov $0x1, %rax
- ret
diff --git a/MdePkg/Library/BaseLib/X64/SetJump.S b/MdePkg/Library/BaseLib/X64/SetJump.S
deleted file mode 100644
index 582f671681..0000000000
--- a/MdePkg/Library/BaseLib/X64/SetJump.S
+++ /dev/null
@@ -1,53 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetJump.S
-#
-# Abstract:
-#
-# Implementation of SetJump() on x86_64
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(SetJump)
-ASM_PFX(SetJump):
- push %rcx
- add $0xffffffffffffffe0,%rsp
- call ASM_PFX(InternalAssertJumpBuffer)
- add $0x20,%rsp
- pop %rcx
- pop %rdx
- mov %rbx,(%rcx)
- mov %rsp,0x8(%rcx)
- mov %rbp,0x10(%rcx)
- mov %rdi,0x18(%rcx)
- mov %rsi,0x20(%rcx)
- mov %r12,0x28(%rcx)
- mov %r13,0x30(%rcx)
- mov %r14,0x38(%rcx)
- mov %r15,0x40(%rcx)
- mov %rdx,0x48(%rcx)
- # save non-volatile fp registers
- stmxcsr 0x50(%rcx)
- movdqu %xmm6, 0x58(%rcx)
- movdqu %xmm7, 0x68(%rcx)
- movdqu %xmm8, 0x78(%rcx)
- movdqu %xmm9, 0x88(%rcx)
- movdqu %xmm10, 0x98(%rcx)
- movdqu %xmm11, 0xA8(%rcx)
- movdqu %xmm12, 0xB8(%rcx)
- movdqu %xmm13, 0xC8(%rcx)
- movdqu %xmm14, 0xD8(%rcx)
- movdqu %xmm15, 0xE8(%rcx)
- xor %rax,%rax
- jmpq *%rdx
diff --git a/MdePkg/Library/BaseLib/X64/SwitchStack.S b/MdePkg/Library/BaseLib/X64/SwitchStack.S
deleted file mode 100644
index 5ce2612a7b..0000000000
--- a/MdePkg/Library/BaseLib/X64/SwitchStack.S
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SwitchStack.S
-#
-# Abstract:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# Routine Description:
-#
-# Routine for switching stacks with 2 parameters
-#
-# Arguments:
-#
-# (rcx) EntryPoint - Entry point with new stack.
-# (rdx) Context1 - Parameter1 for entry point.
-# (r8) Context2 - Parameter2 for entry point.
-# (r9) NewStack - The pointer to new stack.
-#
-# Returns:
-#
-# None
-#
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalSwitchStack)
-ASM_PFX(InternalSwitchStack):
- pushq %rbp
- movq %rsp, %rbp
-
- mov %rcx, %rax // Shift registers for new call
- mov %rdx, %rcx
- mov %r8, %rdx
- #
- # Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack,
- # in case the callee wishes to spill them.
- #
- lea -0x20(%r9), %rsp
- pushq $0 // stop gdb stack unwind
- jmp *%rax // call EntryPoint ()
diff --git a/MdePkg/Library/BaseLib/X64/Thunk16.S b/MdePkg/Library/BaseLib/X64/Thunk16.S
deleted file mode 100644
index fd03b97b56..0000000000
--- a/MdePkg/Library/BaseLib/X64/Thunk16.S
+++ /dev/null
@@ -1,334 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# Thunk16.S
-#
-# Abstract:
-#
-# Real mode thunk
-#
-#------------------------------------------------------------------------------
-
-#include <Library/BaseLib.h>
-
-ASM_GLOBAL ASM_PFX(m16Start)
-ASM_GLOBAL ASM_PFX(m16Size)
-ASM_GLOBAL ASM_PFX(mThunk16Attr)
-ASM_GLOBAL ASM_PFX(m16Gdt)
-ASM_GLOBAL ASM_PFX(m16GdtrBase)
-ASM_GLOBAL ASM_PFX(mTransition)
-ASM_GLOBAL ASM_PFX(InternalAsmThunk16)
-
-# define the structure of IA32_REGS
-.set _EDI, 0 #size 4
-.set _ESI, 4 #size 4
-.set _EBP, 8 #size 4
-.set _ESP, 12 #size 4
-.set _EBX, 16 #size 4
-.set _EDX, 20 #size 4
-.set _ECX, 24 #size 4
-.set _EAX, 28 #size 4
-.set _DS, 32 #size 2
-.set _ES, 34 #size 2
-.set _FS, 36 #size 2
-.set _GS, 38 #size 2
-.set _EFLAGS, 40 #size 8
-.set _EIP, 48 #size 4
-.set _CS, 52 #size 2
-.set _SS, 54 #size 2
-.set IA32_REGS_SIZE, 56
-
- .data
-
-.set Lm16Size, ASM_PFX(InternalAsmThunk16) - ASM_PFX(m16Start)
-ASM_PFX(m16Size): .word Lm16Size
-.set LmThunk16Attr, L_ThunkAttr - ASM_PFX(m16Start)
-ASM_PFX(mThunk16Attr): .word LmThunk16Attr
-.set Lm16Gdt, ASM_PFX(NullSeg) - ASM_PFX(m16Start)
-ASM_PFX(m16Gdt): .word Lm16Gdt
-.set Lm16GdtrBase, _16GdtrBase - ASM_PFX(m16Start)
-ASM_PFX(m16GdtrBase): .word Lm16GdtrBase
-.set LmTransition, _EntryPoint - ASM_PFX(m16Start)
-ASM_PFX(mTransition): .word LmTransition
-
- .text
-
-ASM_PFX(m16Start):
-
-SavedGdt: .space 10
-
-#------------------------------------------------------------------------------
-# _BackFromUserCode() takes control in real mode after 'retf' has been executed
-# by user code. It will be shadowed to somewhere in memory below 1MB.
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(BackFromUserCode)
-ASM_PFX(BackFromUserCode):
- #
- # The order of saved registers on the stack matches the order they appears
- # in IA32_REGS structure. This facilitates wrapper function to extract them
- # into that structure.
- #
- # Some instructions for manipulation of segment registers have to be written
- # in opcode since 64-bit MASM prevents accesses to those registers.
- #
- .byte 0x16 # push ss
- .byte 0xe # push cs
- .byte 0x66
- call L_Base # push eip
-L_Base:
- .byte 0x66
- pushq $0 # reserved high order 32 bits of EFlags
- .byte 0x66, 0x9c # pushfd actually
- cli # disable interrupts
- push %gs
- push %fs
- .byte 6 # push es
- .byte 0x1e # push ds
- .byte 0x66,0x60 # pushad
- .byte 0x66,0xba # mov edx, imm32
-L_ThunkAttr: .space 4
- testb $THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15, %dl
- jz L_1
- movl $0x15cd2401,%eax # mov ax, 2401h & int 15h
- cli # disable interrupts
- jnc L_2
-L_1:
- testb $THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL, %dl
- jz L_2
- inb $0x92,%al
- orb $2,%al
- outb %al, $0x92 # deactivate A20M#
-L_2:
- xorw %ax, %ax # xor eax, eax
- movl %ss, %eax # mov ax, ss
- lea IA32_REGS_SIZE(%esp), %bp
- #
- # rsi in the following 2 instructions is indeed bp in 16-bit code
- #
- movw %bp, (_ESP - IA32_REGS_SIZE)(%rsi)
- .byte 0x66
- movl (_EIP - IA32_REGS_SIZE)(%rsi), %ebx
- shlw $4,%ax # shl eax, 4
- addw %ax,%bp # add ebp, eax
- movw %cs,%ax
- shlw $4,%ax
- lea (L_64BitCode - L_Base)(%ebx, %eax), %ax
- .byte 0x66,0x2e,0x89,0x87 # mov cs:[bx + (L_64Eip - L_Base)], eax
- .word L_64Eip - L_Base
- .byte 0x66,0xb8 # mov eax, imm32
-L_SavedCr4: .space 4
- movq %rax, %cr4
- #
- # rdi in the instruction below is indeed bx in 16-bit code
- #
- .byte 0x66,0x2e # 2eh is "cs:" segment override
- lgdt (SavedGdt - L_Base)(%rdi)
- .byte 0x66
- movl $0xc0000080,%ecx
- rdmsr
- orb $1,%ah
- wrmsr
- .byte 0x66,0xb8 # mov eax, imm32
-L_SavedCr0: .space 4
- movq %rax, %cr0
- .byte 0x66,0xea # jmp far cs:L_64Bit
-L_64Eip: .space 4
-L_SavedCs: .space 2
-L_64BitCode:
- .byte 0x90
- .byte 0x48,0xbc # mov rsp, imm64
-L_SavedSp: .space 8 # restore stack
- nop
- ret
-
-_EntryPoint: .long ASM_PFX(ToUserCode) - ASM_PFX(m16Start)
- .word CODE16
-_16Gdtr: .word GDT_SIZE - 1
-_16GdtrBase: .quad 0
-_16Idtr: .word 0x3ff
- .long 0
-
-#------------------------------------------------------------------------------
-# _ToUserCode() takes control in real mode before passing control to user code.
-# It will be shadowed to somewhere in memory below 1MB.
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(ToUserCode)
-ASM_PFX(ToUserCode):
- movl %edx,%ss # set new segment selectors
- movl %edx,%ds
- movl %edx,%es
- movl %edx,%fs
- movl %edx,%gs
- .byte 0x66
- movl $0xc0000080,%ecx
- movq %rax, %cr0
- rdmsr
- andb $0xfe, %ah # $0b11111110
- wrmsr
- movq %rbp, %cr4
- movl %esi,%ss # set up 16-bit stack segment
- movw %bx,%sp # set up 16-bit stack pointer
- .byte 0x66 # make the following call 32-bit
- call L_Base1 # push eip
-L_Base1:
- popw %bp # ebp <- address of L_Base1
- pushq (IA32_REGS_SIZE + 2)(%esp)
- lea 0x0c(%rsi), %eax
- pushq %rax
- lret # execution begins at next instruction
-L_RealMode:
- .byte 0x66,0x2e # CS and operand size override
- lidt (_16Idtr - L_Base1)(%rsi)
- .byte 0x66,0x61 # popad
- .byte 0x1f # pop ds
- .byte 0x7 # pop es
- .byte 0x0f, 0xa1 # pop fs
- .byte 0x0f, 0xa9 # pop gs
- .byte 0x66, 0x9d # popfd
- leaw 4(%esp),%sp # skip high order 32 bits of EFlags
- .byte 0x66 # make the following retf 32-bit
- lret # transfer control to user code
-
-.set CODE16, ASM_PFX(_16Code) - .
-.set DATA16, ASM_PFX(_16Data) - .
-.set DATA32, ASM_PFX(_32Data) - .
-
-ASM_PFX(NullSeg): .quad 0
-ASM_PFX(_16Code):
- .word -1
- .word 0
- .byte 0
- .byte 0x9b
- .byte 0x8f # 16-bit segment, 4GB limit
- .byte 0
-ASM_PFX(_16Data):
- .word -1
- .word 0
- .byte 0
- .byte 0x93
- .byte 0x8f # 16-bit segment, 4GB limit
- .byte 0
-ASM_PFX(_32Data):
- .word -1
- .word 0
- .byte 0
- .byte 0x93
- .byte 0xcf # 16-bit segment, 4GB limit
- .byte 0
-
-.set GDT_SIZE, . - ASM_PFX(NullSeg)
-
-#------------------------------------------------------------------------------
-# IA32_REGISTER_SET *
-# EFIAPI
-# InternalAsmThunk16 (
-# IN IA32_REGISTER_SET *RegisterSet,
-# IN OUT VOID *Transition
-# );
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalAsmThunk16)
-ASM_PFX(InternalAsmThunk16):
- pushq %rbp
- pushq %rbx
- pushq %rsi
- pushq %rdi
-
- movl %ds, %ebx
- pushq %rbx # Save ds segment register on the stack
- movl %es, %ebx
- pushq %rbx # Save es segment register on the stack
- movl %ss, %ebx
- pushq %rbx # Save ss segment register on the stack
-
- .byte 0x0f, 0xa0 #push fs
- .byte 0x0f, 0xa8 #push gs
- movq %rcx, %rsi
- movzwl _SS(%rsi), %r8d
- movl _ESP(%rsi), %edi
- lea -(IA32_REGS_SIZE + 4)(%edi), %rdi
- imul $16, %r8d, %eax
- movl %edi,%ebx # ebx <- stack for 16-bit code
- pushq $(IA32_REGS_SIZE / 4)
- addl %eax,%edi # edi <- linear address of 16-bit stack
- popq %rcx
- rep
- movsl # copy RegSet
- lea (L_SavedCr4 - ASM_PFX(m16Start))(%rdx), %ecx
- movl %edx,%eax # eax <- transition code address
- andl $0xf,%edx
- shll $12,%eax # segment address in high order 16 bits
- .set LBackFromUserCodeDelta, ASM_PFX(BackFromUserCode) - ASM_PFX(m16Start)
- lea (LBackFromUserCodeDelta)(%rdx), %ax
- stosl # [edi] <- return address of user code
- sgdt 0x60(%rsp) # save GDT stack in argument space
- movzwq 0x60(%rsp), %r10 # r10 <- GDT limit
- lea ((ASM_PFX(InternalAsmThunk16) - L_SavedCr4) + 0xf)(%rcx), %r11
- andq $0xfffffffffffffff0, %r11 # r11 <- 16-byte aligned shadowed GDT table in real mode buffer
-
- movw %r10w, (SavedGdt - L_SavedCr4)(%rcx) # save the limit of shadowed GDT table
- movq %r11, (SavedGdt - L_SavedCr4 + 0x2)(%rcx) # save the base address of shadowed GDT table
-
- movq 0x62(%rsp) ,%rsi # rsi <- the original GDT base address
- xchg %r10, %rcx # save rcx to r10 and initialize rcx to be the limit of GDT table
- incq %rcx # rcx <- the size of memory to copy
- xchg %r11, %rdi # save rdi to r11 and initialize rdi to the base address of shadowed GDT table
- rep
- movsb # perform memory copy to shadow GDT table
- movq %r10, %rcx # restore the orignal rcx before memory copy
- movq %r11, %rdi # restore the original rdi before memory copy
-
- sidt 0x50(%rsp)
- movq %cr0, %rax
- .set LSavedCrDelta, L_SavedCr0 - L_SavedCr4
- movl %eax, (LSavedCrDelta)(%rcx)
- andl $0x7ffffffe,%eax # clear PE, PG bits
- movq %cr4, %rbp
- movl %ebp, (%rcx) # save CR4 in SavedCr4
- andl $0xffffffcf,%ebp # clear PAE, PSE bits
- movl %r8d, %esi # esi <- 16-bit stack segment
- .byte 0x6a, DATA32
- popq %rdx
- lgdt (_16Gdtr - L_SavedCr4)(%rcx)
- movl %edx,%ss
- pushfq
- lea -8(%rdx), %edx
- lea L_RetFromRealMode(%rip), %r8
- pushq %r8
- movl %cs, %r8d
- movw %r8w, (L_SavedCs - L_SavedCr4)(%rcx)
- movq %rsp, (L_SavedSp - L_SavedCr4)(%rcx)
- .byte 0xff, 0x69 # jmp (_EntryPoint - L_SavedCr4)(%rcx)
- .set Ltemp1, _EntryPoint - L_SavedCr4
- .byte Ltemp1
-L_RetFromRealMode:
- popfq
- lgdt 0x60(%rsp) # restore protected mode GDTR
- lidt 0x50(%rsp) # restore protected mode IDTR
- lea -IA32_REGS_SIZE(%rbp), %eax
- .byte 0x0f, 0xa9 # pop gs
- .byte 0x0f, 0xa1 # pop fs
-
- popq %rbx
- movl %ebx, %ss
- popq %rbx
- movl %ebx, %es
- popq %rbx
- movl %ebx, %ds
-
- popq %rdi
- popq %rsi
- popq %rbx
- popq %rbp
-
- ret
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 06/14] MdePkg/BaseMemoryLibMmx: Remove .S files for IA32 and X64 arch
2019-04-01 8:29 [PATCH v4 00/14] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg Shenglei Zhang
` (4 preceding siblings ...)
2019-04-01 8:29 ` [PATCH v3 05/14] MdePkg/BaseLib: " Shenglei Zhang
@ 2019-04-01 8:29 ` Shenglei Zhang
2019-04-01 8:29 ` [PATCH v3 07/14] MdePkg/BaseMemoryLibOptDxe: " Shenglei Zhang
` (7 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Shenglei Zhang @ 2019-04-01 8:29 UTC (permalink / raw)
To: edk2-devel; +Cc: Michael D Kinney, Liming Gao
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
---
.../BaseMemoryLibMmx/BaseMemoryLibMmx.inf | 22 -----
.../BaseMemoryLibMmx/Ia32/CompareMem.S | 55 ------------
.../Library/BaseMemoryLibMmx/Ia32/CopyMem.S | 86 -------------------
.../Library/BaseMemoryLibMmx/Ia32/ScanMem16.S | 52 -----------
.../Library/BaseMemoryLibMmx/Ia32/ScanMem32.S | 52 -----------
.../Library/BaseMemoryLibMmx/Ia32/ScanMem64.S | 61 -------------
.../Library/BaseMemoryLibMmx/Ia32/ScanMem8.S | 52 -----------
MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S | 66 --------------
.../Library/BaseMemoryLibMmx/Ia32/SetMem16.S | 59 -------------
.../Library/BaseMemoryLibMmx/Ia32/SetMem32.S | 52 -----------
.../Library/BaseMemoryLibMmx/Ia32/SetMem64.S | 43 ----------
.../Library/BaseMemoryLibMmx/Ia32/ZeroMem.S | 54 ------------
.../Library/BaseMemoryLibMmx/X64/CompareMem.S | 59 -------------
MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S | 74 ----------------
.../Library/BaseMemoryLibMmx/X64/ScanMem16.S | 56 ------------
.../Library/BaseMemoryLibMmx/X64/ScanMem32.S | 56 ------------
.../Library/BaseMemoryLibMmx/X64/ScanMem64.S | 55 ------------
.../Library/BaseMemoryLibMmx/X64/ScanMem8.S | 56 ------------
MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S | 61 -------------
.../Library/BaseMemoryLibMmx/X64/SetMem16.S | 60 -------------
.../Library/BaseMemoryLibMmx/X64/SetMem32.S | 55 ------------
.../Library/BaseMemoryLibMmx/X64/SetMem64.S | 47 ----------
MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S | 57 ------------
23 files changed, 1290 deletions(-)
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S
diff --git a/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf b/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
index d17fcf24b6..9a073d1cd9 100644
--- a/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
+++ b/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
@@ -52,27 +52,16 @@
[Sources.Ia32]
Ia32/ScanMem64.nasm
- Ia32/ScanMem64.S
Ia32/ScanMem32.nasm
- Ia32/ScanMem32.S
Ia32/ScanMem16.nasm
- Ia32/ScanMem16.S
Ia32/ScanMem8.nasm
- Ia32/ScanMem8.S
Ia32/CompareMem.nasm
- Ia32/CompareMem.S
Ia32/SetMem64.nasm
- Ia32/SetMem64.S
Ia32/SetMem32.nasm
- Ia32/SetMem32.S
Ia32/SetMem16.nasm
- Ia32/SetMem16.S
Ia32/ZeroMem.nasm
- Ia32/ZeroMem.S
Ia32/SetMem.nasm
- Ia32/SetMem.S
Ia32/CopyMem.nasm
- Ia32/CopyMem.S
Ia32/ScanMem64.nasm
Ia32/ScanMem32.nasm
Ia32/ScanMem16.nasm
@@ -99,27 +88,16 @@
X64/SetMem.nasm
X64/CopyMem.nasm
X64/ScanMem64.nasm
- X64/ScanMem64.S
X64/ScanMem32.nasm
- X64/ScanMem32.S
X64/ScanMem16.nasm
- X64/ScanMem16.S
X64/ScanMem8.nasm
- X64/ScanMem8.S
X64/CompareMem.nasm
- X64/CompareMem.S
X64/SetMem64.nasm
- X64/SetMem64.S
X64/SetMem32.nasm
- X64/SetMem32.S
X64/SetMem16.nasm
- X64/SetMem16.S
X64/ZeroMem.nasm
- X64/ZeroMem.S
X64/SetMem.nasm
- X64/SetMem.S
X64/CopyMem.nasm
- X64/CopyMem.S
X64/IsZeroBuffer.nasm
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S
deleted file mode 100644
index b509586adb..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S
+++ /dev/null
@@ -1,55 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CompareMem.Asm
-#
-# Abstract:
-#
-# CompareMem function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemCompareMem)
-
-#------------------------------------------------------------------------------
-# INTN
-# EFIAPI
-# InternalMemCompareMem (
-# IN CONST VOID *DestinationBuffer,
-# IN CONST VOID *SourceBuffer,
-# IN UINTN Length
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemCompareMem):
- push %esi
- push %edi
- movl 12(%esp), %esi
- movl 16(%esp), %edi
- movl 20(%esp), %ecx
- repe cmpsb
- movzbl -1(%esi), %eax
- movzbl -1(%edi), %edx
- subl %edx, %eax
- pop %edi
- pop %esi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S
deleted file mode 100644
index b934ff5ae2..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S
+++ /dev/null
@@ -1,86 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CopyMem.asm
-#
-# Abstract:
-#
-# CopyMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemCopyMem (
-# IN VOID *Destination,
-# IN VOID *Source,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemCopyMem):
- push %esi
- push %edi
- movl 16(%esp), %esi # esi <- Source
- movl 12(%esp), %edi # edi <- Destination
- movl 20(%esp), %edx # edx <- Count
- leal -1(%esi,%edx,), %eax # eax <- End of Source
- cmpl %edi, %esi
- jae L0
- cmpl %edi, %eax # Overlapped?
- jae L_CopyBackward # Copy backward if overlapped
-L0:
- xorl %ecx, %ecx
- subl %esi, %ecx
- andl $7, %ecx # ecx + esi aligns on 8-byte boundary
- jz L1
- cmpl %edx, %ecx
- cmova %edx, %ecx
- subl %ecx, %edx # edx <- remaining bytes to copy
- rep
- movsb
-L1:
- movl %edx, %ecx
- andl $7, %edx
- shrl $3, %ecx # ecx <- # of Qwords to copy
- jz L_CopyBytes
- pushl %eax
- pushl %eax
- movq %mm0, (%esp) # save mm0
-L2:
- movq (%esi), %mm0
- movq %mm0, (%edi)
- addl $8, %esi
- addl $8, %edi
- loop L2
- movq (%esp), %mm0 # restore mm0
- popl %ecx # stack cleanup
- popl %ecx # stack cleanup
- jmp L_CopyBytes
-L_CopyBackward:
- movl %eax, %esi # esi <- Last byte in Source
- leal -1(%edi,%edx,), %edi # edi <- Last byte in Destination
- std
-L_CopyBytes:
- movl %edx, %ecx
- rep
- movsb
- cld
- movl 12(%esp), %eax
- pop %edi
- pop %esi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.S
deleted file mode 100644
index e247d4ad09..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.S
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem16.Asm
-#
-# Abstract:
-#
-# ScanMem16 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem16)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem16 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT16 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem16):
- push %edi
- movl 12(%esp), %ecx
- movl 8(%esp), %edi
- movl 16(%esp), %eax
- repne scasw
- leal -2(%edi), %eax
- cmovnz %ecx, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.S
deleted file mode 100644
index 066fde42ce..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.S
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem32.Asm
-#
-# Abstract:
-#
-# ScanMem32 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem32)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem32 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem32):
- push %edi
- movl 12(%esp), %ecx
- movl 8(%esp), %edi
- movl 16(%esp), %eax
- repne scasl
- leal -4(%edi), %eax
- cmovnz %ecx, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.S
deleted file mode 100644
index b3435d7fc3..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.S
+++ /dev/null
@@ -1,61 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem64.Asm
-#
-# Abstract:
-#
-# ScanMem64 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem64)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem64 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT64 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem64):
- push %edi
- movl 12(%esp), %ecx
- movl 16(%esp), %eax
- movl 20(%esp), %edx
- movl 8(%esp), %edi
-L0:
- cmpl (%edi), %eax
- leal 8(%edi), %edi
- loopne L0
- jne L1
- cmpl -4(%edi), %edx
- jecxz L1
- jne L0
-L1:
- leal -8(%edi), %eax
- cmovne %ecx, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.S
deleted file mode 100644
index 5e451fd7b9..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.S
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem8.Asm
-#
-# Abstract:
-#
-# ScanMem8 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem8)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem8 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT8 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem8):
- push %edi
- movl 12(%esp), %ecx
- movl 8(%esp), %edi
- movb 16(%esp), %al
- repne scasb
- leal -1(%edi), %eax
- cmovnz %ecx, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S
deleted file mode 100644
index 7329d6818d..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S
+++ /dev/null
@@ -1,66 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem.asm
-#
-# Abstract:
-#
-# SetMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT8 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem):
- push %edi
- movb 16(%esp), %al
- movb %al, %ah
- shrdl $16, %eax, %edx
- shldl $16, %edx, %eax
- movl 12(%esp), %ecx # ecx <- Count
- movl 8(%esp), %edi # edi <- Buffer
- movl %ecx, %edx
- andl $7, %edx
- shrl $3, %ecx # # of Qwords to set
- jz L1
- addl $-16, %esp
- movq %mm0, (%esp) # save mm0
- movq %mm1, 8(%esp) # save mm1
- movd %eax, %mm0
- movd %eax, %mm1
- psllq $32, %mm0
- por %mm1, %mm0 # fill mm0 with 8 Value's
-L0:
- movq %mm0, (%edi)
- addl $8, %edi
- loop L0
- movq (%esp), %mm0 # restore mm0
- movq 8(%esp), %mm1 # restore mm1
- addl $0x10, %esp # stack cleanup
-L1:
- movl %edx, %ecx
- rep
- stosb
- movl 8(%esp), %eax # eax <- Buffer as return value
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.S
deleted file mode 100644
index 4d84bebba9..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.S
+++ /dev/null
@@ -1,59 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem16.asm
-#
-# Abstract:
-#
-# SetMem16 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem16)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem16 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT16 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem16):
- push %edi
- movl 16(%esp), %eax
- shrdl $16, %eax, %edx
- shldl $16, %edx, %eax
- movl 12(%esp), %edx
- movl 8(%esp), %edi
- movl %edx, %ecx
- andl $3, %edx
- shrl $2, %ecx
- jz L1
- movd %eax, %mm0
- movd %eax, %mm1
- psllq $32, %mm0
- por %mm1, %mm0
-L0:
- movq %mm0, (%edi)
- addl $8, %edi
- loop L0
-L1:
- movl %edx, %ecx
- rep
- stosw
- movl 8(%esp), %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.S
deleted file mode 100644
index fb0d0788f9..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.S
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem32.asm
-#
-# Abstract:
-#
-# SetMem32 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem32 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT32 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem32):
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- movd 12(%esp), %mm0
- shrl %ecx
- movl %eax, %edx
- jz L1
- movq %mm0, %mm1
- psllq $32, %mm1
- por %mm1, %mm0
-L0:
- movq %mm0, (%edx)
- lea 8(%edx), %edx
- loop L0
-L1:
- jnc L2
- movd %mm0, (%edx)
-L2:
- ret
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.S
deleted file mode 100644
index 53379ad0ef..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.S
+++ /dev/null
@@ -1,43 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem64.asm
-#
-# Abstract:
-#
-# SetMem64 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem64)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem64 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT64 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem64):
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- movq 12(%esp), %mm0
- movl %eax, %edx
-L0:
- movq %mm0, (%edx)
- lea 8(%edx), %edx
- loop L0
- ret
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.S b/MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.S
deleted file mode 100644
index d6452713ca..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.S
+++ /dev/null
@@ -1,54 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ZeroMem.asm
-#
-# Abstract:
-#
-# ZeroMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemZeroMem (
-# IN VOID *Buffer,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemZeroMem):
- push %edi
- movl 8(%esp), %edi
- movl 12(%esp), %ecx
- movl %ecx, %edx
- shrl $3, %ecx
- jz L_ZeroBytes
- pxor %mm0, %mm0
-L0:
- movq %mm0, (%edi)
- addl $8, %edi
- loop L0
-L_ZeroBytes:
- andl $7, %edx
- xorl %eax, %eax
- movl %edx, %ecx
- rep
- stosb
- movl 8(%esp), %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S
deleted file mode 100644
index ee6bbe2715..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from CompareMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CompareMem.S
-#
-# Abstract:
-#
-# CompareMem function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# INTN
-# EFIAPI
-# InternalMemCompareMem (
-# IN CONST VOID *DestinationBuffer,
-# IN CONST VOID *SourceBuffer,
-# IN UINTN Length
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemCompareMem)
-ASM_PFX(InternalMemCompareMem):
- pushq %rsi
- pushq %rdi
- movq %rcx, %rsi
- movq %rdx, %rdi
- movq %r8, %rcx
- repe cmpsb
- movzbq -1(%rsi), %rax
- movzbq -1(%rdi), %rdx
- subq %rdx, %rax
- popq %rdi
- popq %rsi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S
deleted file mode 100644
index 42a1e28df9..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from CopyMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CopyMem.S
-#
-# Abstract:
-#
-# CopyMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemCopyMem (
-# IN VOID *Destination,
-# IN VOID *Source,
-# IN UINTN Count
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
-ASM_PFX(InternalMemCopyMem):
- pushq %rsi
- pushq %rdi
- movq %rdx, %rsi # rsi <- Source
- movq %rcx, %rdi # rdi <- Destination
- leaq -1(%rsi, %r8,), %r9 # r9 <- End of Source
- cmpq %rdi, %rsi
- movq %rdi, %rax # rax <- Destination as return value
- jae L0
- cmpq %rdi, %r9
- jae L_CopyBackward # Copy backward if overlapped
-L0:
- movq %r8, %rcx
- andq $7, %r8
- shrq $3, %rcx # rcx <- # of Qwords to copy
- jz L_CopyBytes
- movd %mm0, %r10 # (Save mm0 in r10)
-L1:
- movq (%rsi), %mm0
- movntq %mm0, (%rdi)
- addq $8, %rsi
- addq $8, %rdi
- loop L1
- mfence
- movd %r10, %mm0 # (Restore mm0)
- jmp L_CopyBytes
-L_CopyBackward:
- movq %r9, %rsi # rsi <- End of Source
- leaq -1(%rdi, %r8,), %rdi # rdi <- End of Destination
- std # set direction flag
-L_CopyBytes:
- movq %r8, %rcx
- rep movsb # Copy bytes backward
- cld
- popq %rdi
- popq %rsi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S
deleted file mode 100644
index 358651419a..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem16.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem16.S
-#
-# Abstract:
-#
-# ScanMem16 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem16 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT16 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem16)
-ASM_PFX(InternalMemScanMem16):
- pushq %rdi
- movq %rcx, %rdi
- movq %r8, %rax
- movq %rdx, %rcx
- repne scasw
- leaq -2(%rdi), %rax
- cmovnz %rcx, %rax
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S
deleted file mode 100644
index 93e6cc2f13..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem32.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem32.S
-#
-# Abstract:
-#
-# ScanMem32 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem32 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem32)
-ASM_PFX(InternalMemScanMem32):
- pushq %rdi
- movq %rcx, %rdi
- movq %r8, %rax
- movq %rdx, %rcx
- repne scasl
- leaq -4(%rdi), %rax
- cmovnz %rcx, %rax
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S
deleted file mode 100644
index 2e59c8dd52..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem64.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem64.S
-#
-# Abstract:
-#
-# ScanMem64 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem64 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT64 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem64)
-ASM_PFX(InternalMemScanMem64):
- pushq %rdi
- movq %rcx, %rdi
- movq %r8, %rax
- movq %rdx, %rcx
- repne scasq
- leaq -8(%rdi), %rax
- cmovnz %rcx, %rax
- popq %rdi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S
deleted file mode 100644
index 4bdacf7e01..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem8.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem8.S
-#
-# Abstract:
-#
-# ScanMem8 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem8 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT8 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem8)
-ASM_PFX(InternalMemScanMem8):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdx, %rcx
- movq %r8, %rax
- repne scasb
- leaq -1(%rdi), %rax
- cmovnz %rcx, %rax # set rax to 0 if not found
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S
deleted file mode 100644
index 16ccb3fc1d..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S
+++ /dev/null
@@ -1,61 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem.S
-#
-# Abstract:
-#
-# SetMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT8 Value
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem)
-ASM_PFX(InternalMemSetMem):
- push %rdi
- movq %r8, %rax
- movb %al, %ah
- movd %rax, %mm0
- movq %rcx, %r8
- movq %r8, %rdi # rdi <- Buffer
- movq %rdx, %rcx
- andq $7, %rdx
- shrq $3, %rcx
- jz L_SetBytes
- .byte 0x0f, 0x70, 0x0C0, 0x00
-L0:
- movntq %mm0, (%rdi)
- addq $8, %rdi
- loop L0
- mfence
-L_SetBytes:
- movl %edx, %ecx
- rep stosb
- movq %r8, %rax
- pop %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S
deleted file mode 100644
index 4f77bacf14..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem16.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem16.S
-#
-# Abstract:
-#
-# SetMem16 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem16 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT16 Value
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem16)
-ASM_PFX(InternalMemSetMem16):
- pushq %rdi
- movq %r8, %rax
- movd %rax, %mm0
- movq %rcx, %r8
- movq %r8, %rdi
- movq %rdx, %rcx
- andl $3, %edx
- shrq $2, %rcx
- jz L_SetWords
- .byte 0x0f, 0x70, 0x0C0, 0x00
-L0:
- movntq %mm0, (%rdi)
- addq $8, %rdi
- loop L0
- mfence
-L_SetWords:
- movl %edx, %ecx
- rep stosw
- movq %r8, %rax
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S
deleted file mode 100644
index 82c7cbf4d6..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem32.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem32.S
-#
-# Abstract:
-#
-# SetMem32 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem32 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
-ASM_PFX(InternalMemSetMem32):
- movd %r8, %mm0 # mm0 <- Value
- movq %rcx, %rax # rax <- Buffer
- xchgq %rdx, %rcx # rcx <- Count rdx <- Buffer
- shrq $1, % rcx # rcx <- # of qwords to set
- jz L_SetDwords
- .byte 0x0f, 0x70, 0x0C0, 0x44
-L0:
- movntq %mm0, (%rdx)
- leaq 8(%rdx), %rdx # use "lea" to avoid flag changes
- loop L0
- mfence
-L_SetDwords:
- jnc L1
- movd %mm0, (%rdx)
-L1:
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S b/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S
deleted file mode 100644
index 110c6f2d9c..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem64.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem64.S
-#
-# Abstract:
-#
-# SetMem64 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem64 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT64 Value
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem64)
-ASM_PFX(InternalMemSetMem64):
- movd %r8, %mm0 #Value
- movq %rcx, %rax #rax <- Buffer
- xchg %rdx, %rcx #rcx <- Count
-L0:
- movntq %mm0, (%rdx)
- addq $8, %rdx
- loop L0
- mfence
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S b/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S
deleted file mode 100644
index 79f0b3d501..0000000000
--- a/MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S
+++ /dev/null
@@ -1,57 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ZeroMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ZeroMem.S
-#
-# Abstract:
-#
-# ZeroMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemZeroMem (
-# IN VOID *Buffer,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
-ASM_PFX(InternalMemZeroMem):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdx, %rcx
- movq %rdi, %r8
- andq $7, %rdx
- shrq $3, %rcx
- jz L_ZeroBytes
- pxor %mm0, %mm0
-L0:
- movntq %mm0, (%rdi)
- addq $8, %rdi
- loop L0
- mfence
-L_ZeroBytes:
- xorl %eax, %eax
- movl %edx, %ecx
- rep stosb
- movq %r8, %rax
- popq %rdi
- ret
-
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 07/14] MdePkg/BaseMemoryLibOptDxe: Remove .S files for IA32 and X64 arch
2019-04-01 8:29 [PATCH v4 00/14] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg Shenglei Zhang
` (5 preceding siblings ...)
2019-04-01 8:29 ` [PATCH v3 06/14] MdePkg/BaseMemoryLibMmx: " Shenglei Zhang
@ 2019-04-01 8:29 ` Shenglei Zhang
2019-04-01 8:29 ` [PATCH v3 08/14] MdePkg/BaseMemoryLibOptPei: " Shenglei Zhang
` (6 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Shenglei Zhang @ 2019-04-01 8:29 UTC (permalink / raw)
To: edk2-devel; +Cc: Michael D Kinney, Liming Gao
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
---
.../BaseMemoryLibOptDxe.inf | 22 -----
.../BaseMemoryLibOptDxe/Ia32/CompareMem.S | 55 ------------
.../BaseMemoryLibOptDxe/Ia32/CopyMem.S | 85 -------------------
.../BaseMemoryLibOptDxe/Ia32/ScanMem16.S | 52 ------------
.../BaseMemoryLibOptDxe/Ia32/ScanMem32.S | 52 ------------
.../BaseMemoryLibOptDxe/Ia32/ScanMem64.S | 61 -------------
.../BaseMemoryLibOptDxe/Ia32/ScanMem8.S | 52 ------------
.../Library/BaseMemoryLibOptDxe/Ia32/SetMem.S | 50 -----------
.../BaseMemoryLibOptDxe/Ia32/SetMem16.S | 43 ----------
.../BaseMemoryLibOptDxe/Ia32/SetMem32.S | 43 ----------
.../BaseMemoryLibOptDxe/Ia32/SetMem64.S | 46 ----------
.../BaseMemoryLibOptDxe/Ia32/ZeroMem.S | 49 -----------
.../BaseMemoryLibOptDxe/X64/CompareMem.S | 59 -------------
.../Library/BaseMemoryLibOptDxe/X64/CopyMem.S | 82 ------------------
.../BaseMemoryLibOptDxe/X64/ScanMem16.S | 56 ------------
.../BaseMemoryLibOptDxe/X64/ScanMem32.S | 56 ------------
.../BaseMemoryLibOptDxe/X64/ScanMem64.S | 55 ------------
.../BaseMemoryLibOptDxe/X64/ScanMem8.S | 56 ------------
.../Library/BaseMemoryLibOptDxe/X64/SetMem.S | 57 -------------
.../BaseMemoryLibOptDxe/X64/SetMem16.S | 47 ----------
.../BaseMemoryLibOptDxe/X64/SetMem32.S | 47 ----------
.../BaseMemoryLibOptDxe/X64/SetMem64.S | 46 ----------
.../Library/BaseMemoryLibOptDxe/X64/ZeroMem.S | 51 -----------
23 files changed, 1222 deletions(-)
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.S
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf b/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
index 3f756647e1..5ee1d70473 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
@@ -35,27 +35,16 @@
[Sources.Ia32]
Ia32/ScanMem64.nasm
- Ia32/ScanMem64.S
Ia32/ScanMem32.nasm
- Ia32/ScanMem32.S
Ia32/ScanMem16.nasm
- Ia32/ScanMem16.S
Ia32/ScanMem8.nasm
- Ia32/ScanMem8.S
Ia32/CompareMem.nasm
- Ia32/CompareMem.S
Ia32/ZeroMem.nasm
- Ia32/ZeroMem.S
Ia32/SetMem64.nasm
- Ia32/SetMem64.S
Ia32/SetMem32.nasm
- Ia32/SetMem32.S
Ia32/SetMem16.nasm
- Ia32/SetMem16.S
Ia32/SetMem.nasm
- Ia32/SetMem.S
Ia32/CopyMem.nasm
- Ia32/CopyMem.S
Ia32/ScanMem64.nasm
Ia32/ScanMem32.nasm
Ia32/ScanMem16.nasm
@@ -72,27 +61,16 @@
[Sources.X64]
X64/ScanMem64.nasm
- X64/ScanMem64.S
X64/ScanMem32.nasm
- X64/ScanMem32.S
X64/ScanMem16.nasm
- X64/ScanMem16.S
X64/ScanMem8.nasm
- X64/ScanMem8.S
X64/CompareMem.nasm
- X64/CompareMem.S
X64/ZeroMem.nasm
- X64/ZeroMem.S
X64/SetMem64.nasm
- X64/SetMem64.S
X64/SetMem32.nasm
- X64/SetMem32.S
X64/SetMem16.nasm
- X64/SetMem16.S
X64/SetMem.nasm
- X64/SetMem.S
X64/CopyMem.nasm
- X64/CopyMem.S
X64/IsZeroBuffer.nasm
MemLibGuid.c
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S
deleted file mode 100644
index 23758781c9..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S
+++ /dev/null
@@ -1,55 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CompareMem.S
-#
-# Abstract:
-#
-# CompareMem function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemCompareMem)
-
-#------------------------------------------------------------------------------
-# INTN
-# EFIAPI
-# InternalMemCompareMem (
-# IN CONST VOID *DestinationBuffer,
-# IN CONST VOID *SourceBuffer,
-# IN UINTN Length
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemCompareMem):
- push %esi
- push %edi
- movl 12(%esp), %esi
- movl 16(%esp), %edi
- movl 20(%esp), %ecx
- repe cmpsb
- movzbl -1(%esi), %eax
- movzbl -1(%edi), %edx
- subl %edx, %eax
- pop %edi
- pop %esi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.S
deleted file mode 100644
index bfc02d6319..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.S
+++ /dev/null
@@ -1,85 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CopyMem.S
-#
-# Abstract:
-#
-# CopyMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemCopyMem (
-# IN VOID *Destination,
-# IN VOID *Source,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemCopyMem):
- push %esi
- push %edi
- movl 16(%esp), %esi # esi <- Source
- movl 12(%esp), %edi # edi <- Destination
- movl 20(%esp), %edx # edx <- Count
- leal -1(%esi,%edx,), %eax # eax <- End of Source
- cmpl %edi, %esi
- jae L0
- cmpl %edi, %eax # Overlapped?
- jae L_CopyBackward # Copy backward if overlapped
-L0:
- xorl %ecx, %ecx
- subl %edi, %ecx
- andl $15, %ecx # ecx + edi aligns on 16-byte boundary
- jz L1
- cmpl %edx, %ecx
- cmova %edx, %ecx
- subl %ecx, %edx # edx <- remaining bytes to copy
- rep
- movsb
-L1:
- movl %edx, %ecx
- andl $15, %edx
- shrl $4, %ecx # ecx <- # of DQwords to copy
- jz L_CopyBytes
- addl $-16, %esp
- movdqu %xmm0, (%esp)
-L2:
- movdqu (%esi), %xmm0
- movntdq %xmm0, (%edi)
- addl $16, %esi
- addl $16, %edi
- loop L2
- mfence
- movdqu (%esp),%xmm0
- addl $16, %esp # stack cleanup
- jmp L_CopyBytes
-L_CopyBackward:
- movl %eax, %esi # esi <- Last byte in Source
- leal -1(%edi,%edx,), %edi # edi <- Last byte in Destination
- std
-L_CopyBytes:
- movl %edx, %ecx
- rep
- movsb
- cld
- movl 12(%esp), %eax # eax <- Destination as return value
- pop %edi
- pop %esi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.S
deleted file mode 100644
index e247d4ad09..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.S
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem16.Asm
-#
-# Abstract:
-#
-# ScanMem16 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem16)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem16 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT16 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem16):
- push %edi
- movl 12(%esp), %ecx
- movl 8(%esp), %edi
- movl 16(%esp), %eax
- repne scasw
- leal -2(%edi), %eax
- cmovnz %ecx, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.S
deleted file mode 100644
index 7f0a3241d9..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.S
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem32.S
-#
-# Abstract:
-#
-# ScanMem32 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem32)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem32 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem32):
- push %edi
- movl 12(%esp), %ecx
- movl 8(%esp), %edi
- movl 16(%esp), %eax
- repne scasl
- leal -4(%edi), %eax
- cmovnz %ecx, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.S
deleted file mode 100644
index c8f76f14a0..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.S
+++ /dev/null
@@ -1,61 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem64.S
-#
-# Abstract:
-#
-# ScanMem64 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem64)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem64 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT64 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem64):
- push %edi
- movl 12(%esp), %ecx
- movl 16(%esp), %eax
- movl 20(%esp), %edx
- movl 8(%esp), %edi
-L0:
- cmpl (%edi), %eax
- leal 8(%edi), %edi
- loopne L0
- jne L1
- cmpl -4(%edi), %edx
- jecxz L1
- jne L0
-L1:
- leal -8(%edi), %eax
- cmovne %ecx, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.S
deleted file mode 100644
index 478b926165..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.S
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem8.S
-#
-# Abstract:
-#
-# ScanMem8 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem8)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem8 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT8 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem8):
- push %edi
- movl 12(%esp), %ecx
- movl 8(%esp), %edi
- movb 16(%esp), %al
- repne scasb
- leal -1(%edi), %eax
- cmovnz %ecx, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.S
deleted file mode 100644
index 8c643ae46f..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.S
+++ /dev/null
@@ -1,50 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem.S
-#
-# Abstract:
-#
-# SetMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT8 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem):
- push %edi
- movl 12(%esp),%ecx
- movb 16(%esp),%al
- movb %al, %ah
- shrd $16, %eax, %edx
- shld $16, %edx, %eax
- movl %ecx, %edx
- movl 8(%esp),%edi
- shr $2, %ecx
- rep stosl
- movl %edx, %ecx
- andl $3, %ecx
- rep stosb
- movl 8(%esp),%eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.S
deleted file mode 100644
index a31c8aef49..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.S
+++ /dev/null
@@ -1,43 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem16.S
-#
-# Abstract:
-#
-# SetMem16 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem16)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem16 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT16 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem16):
- push %edi
- movl 16(%esp), %eax
- movl 8(%esp), %edi
- movl 12(%esp), %ecx
- rep
- stosw
- movl 8(%esp), %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.S
deleted file mode 100644
index 73e36b731b..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.S
+++ /dev/null
@@ -1,43 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem32.S
-#
-# Abstract:
-#
-# SetMem32 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem32 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT32 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem32):
- push %edi
- movl 16(%esp),%eax
- movl 8(%esp),%edi
- movl 12(%esp),%ecx
- rep
- stosl
- movl 8(%esp),%eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.S
deleted file mode 100644
index 51687d46c2..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.S
+++ /dev/null
@@ -1,46 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem64.S
-#
-# Abstract:
-#
-# SetMem64 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem64)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem64 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT64 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem64):
- push %edi
- movl 12(%esp), %ecx
- movl 16(%esp), %eax
- movl 20(%esp), %edx
- movl 8(%esp), %edi
-L0:
- mov %eax, -8(%edi, %ecx, 8)
- mov %edx, -4(%edi, %ecx, 8)
- loop L0
- movl %edi, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.S
deleted file mode 100644
index 8ac52897be..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.S
+++ /dev/null
@@ -1,49 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ZeroMem.S
-#
-# Abstract:
-#
-# ZeroMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemZeroMem (
-# IN VOID *Buffer,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemZeroMem):
- push %edi
- xorl %eax,%eax
- movl 8(%esp),%edi
- movl 12(%esp),%ecx
- movl %ecx,%edx
- shrl $2,%ecx
- andl $3,%edx
- pushl %edi
- rep
- stosl
- movl %edx,%ecx
- rep
- stosb
- popl %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.S
deleted file mode 100644
index ae27318373..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.S
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from CompareMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CompareMem.S
-#
-# Abstract:
-#
-# CompareMem function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# INTN
-# EFIAPI
-# InternalMemCompareMem (
-# IN CONST VOID *DestinationBuffer,
-# IN CONST VOID *SourceBuffer,
-# IN UINTN Length
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemCompareMem)
-ASM_PFX(InternalMemCompareMem):
- pushq %rsi
- pushq %rdi
- movq %rcx, %rsi
- movq %rdx, %rdi
- movq %r8, %rcx
- repe cmpsb
- movzbq -1(%rsi) , %rax
- movzbq -1(%rdi) , %rdx
- sub %dl, %al
- popq %rdi
- popq %rsi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.S
deleted file mode 100644
index d6fc9cb860..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.S
+++ /dev/null
@@ -1,82 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from CopyMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CopyMem.S
-#
-# Abstract:
-#
-# CopyMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemCopyMem (
-# IN VOID *Destination,
-# IN VOID *Source,
-# IN UINTN Count
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
-ASM_PFX(InternalMemCopyMem):
- pushq %rsi
- pushq %rdi
- movq %rdx, %rsi # rsi <- Source
- movq %rcx, %rdi # rdi <- Destination
- leaq -1(%rsi,%r8,), %r9 # r9 <- Last byte of Source
- cmpq %rdi, %rsi
- movq %rdi, %rax # rax <- Destination as return value
- jae L0 # Copy forward if Source > Destination
- cmpq %rdi, %r9 # Overlapped?
- jae L_CopyBackward # Copy backward if overlapped
-L0:
- xorq %rcx, %rcx
- subq %rdi, %rcx # rcx <- -rdi
- andq $15, %rcx # rcx + rsi should be 16 bytes aligned
- jz L1 # skip if rcx == 0
- cmpq %r8, %rcx
- cmova %r8, %rcx
- subq %rcx, %r8
- rep movsb
-L1:
- movq %r8, %rcx
- andq $15, %r8
- shrq $4, %rcx # rcx <- # of DQwords to copy
- jz L_CopyBytes
- movdqu %xmm0, 0x18(%rsp) # save xmm0 on stack
-L2:
- movdqu (%rsi), %xmm0 # rsi may not be 16-byte aligned
- movntdq %xmm0, (%rdi) # rdi should be 16-byte aligned
- addq $16, %rsi
- addq $16, %rdi
- loop L2
- mfence
- movdqa 0x18(%rsp), %xmm0 # restore xmm0
- jmp L_CopyBytes # copy remaining bytes
-L_CopyBackward:
- movq %r9, %rsi # rsi <- Last byte of Source
- leaq -1(%rdi, %r8,), %rdi # rdi <- Last byte of Destination
- std
-L_CopyBytes:
- movq %r8, %rcx
- rep movsb
- cld
- popq %rdi
- popq %rsi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.S
deleted file mode 100644
index f72de1dc6a..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem16.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem16.S
-#
-# Abstract:
-#
-# ScanMem16 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem16 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT16 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem16)
-ASM_PFX(InternalMemScanMem16):
- pushq %rdi
- movq %rcx, %rdi
- movq %r8, %rax
- movq %rdx, %rcx
- repne scasw
- leaq -2(%rdi), %rax
- cmovnz %rcx, %rax
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.S
deleted file mode 100644
index d7ab3f8078..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem32.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem32.S
-#
-# Abstract:
-#
-# ScanMem32 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem32 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem32)
-ASM_PFX(InternalMemScanMem32):
- pushq %rdi
- movq %rcx, %rdi
- movq %r8, %rax
- movq %rdx, %rcx
- repne scasl
- leaq -4(%rdi), %rax
- cmovnz %rcx, %rax
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.S
deleted file mode 100644
index e7fb07633a..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.S
+++ /dev/null
@@ -1,55 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem64.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem64.S
-#
-# Abstract:
-#
-# ScanMem64 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem64 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT64 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem64)
-ASM_PFX(InternalMemScanMem64):
- pushq %rdi
- movq %rcx, %rdi
- movq %r8, %rax
- movq %rdx, %rcx
- repne scasq
- leaq -8(%rdi), %rax
- cmovnz %rcx, %rax
- popq %rdi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.S
deleted file mode 100644
index 3f0ad09984..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem8.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem8.S
-#
-# Abstract:
-#
-# ScanMem8 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem8 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT8 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem8)
-ASM_PFX(InternalMemScanMem8):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdx, %rcx
- movq %r8, %rax
- repne scasb
- leaq -1(%rdi), %rax
- cmovnz %rcx, %rax # set rax to 0 if not found
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.S
deleted file mode 100644
index c3a4d76b4f..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.S
+++ /dev/null
@@ -1,57 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem.S
-#
-# Abstract:
-#
-# SetMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT8 Value
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem)
-ASM_PFX(InternalMemSetMem):
- pushq %rdi
- pushq %rbx
- pushq %rcx # push Buffer
- movq %r8, %rax # rax = Value
- andq $0xff, %rax # rax = lower 8 bits of r8, upper 56 bits are 0
- movb %al, %ah # ah = al
- movw %ax, %bx # bx = ax
- shlq $0x10, %rax # rax = ax << 16
- movw %bx, %ax # ax = bx
- movq %rax, %rbx # ebx = eax
- shlq $0x20, %rax # rax = rax << 32
- orq %rbx, %rax # eax = ebx
- movq %rcx, %rdi # rdi = Buffer
- movq %rdx, %rcx # rcx = Count
- shrq $3, %rcx # rcx = rcx / 8
- cld
- rep stosq
- movq %rdx, %rcx # rcx = rdx
- andq $7, %rcx # rcx = rcx & 7
- rep stosb
- popq %rax # rax = Buffer
- popq %rbx
- popq %rdi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.S
deleted file mode 100644
index cb11f8ac2b..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.S
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem16.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem16.S
-#
-# Abstract:
-#
-# SetMem16 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem16 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT16 Value
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem16)
-ASM_PFX(InternalMemSetMem16):
- pushq %rdi
- movq %rcx, %rdi
- movq %r8, %rax
- xchg %rdx, %rcx
- rep stosw
- movq %rdx, %rax
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.S
deleted file mode 100644
index 9b9a63d14f..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.S
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem32.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem32.S
-#
-# Abstract:
-#
-# SetMem32 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem32 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
-ASM_PFX(InternalMemSetMem32):
- pushq %rdi
- movq %rcx, %rdi
- movq %r8, %rax
- xchgq %rdx, %rcx
- rep stosl
- movq %rdx, %rax
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.S
deleted file mode 100644
index 90acd1f236..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.S
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem64.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem64.S
-#
-# Abstract:
-#
-# SetMem64 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem64 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT64 Value
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem64)
-ASM_PFX(InternalMemSetMem64):
- pushq %rdi
- movq %rcx, %rdi
- movq %r8, %rax
- xchg %rdx, %rcx
- rep stosq
- movq %rdx, %rax
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.S b/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.S
deleted file mode 100644
index 3432f23c68..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.S
+++ /dev/null
@@ -1,51 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ZeroMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ZeroMem.S
-#
-# Abstract:
-#
-# ZeroMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemZeroMem (
-# IN VOID *Buffer,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
-ASM_PFX(InternalMemZeroMem):
- pushq %rdi
- pushq %rcx
- xorq %rax, %rax
- movq %rcx, %rdi
- movq %rdx, %rcx
- shrq $3, %rcx
- andq $7, %rdx
- cld
- rep stosq
- movq %rdx, %rcx
- rep stosb
- popq %rax
- popq %rdi
- ret
-
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 08/14] MdePkg/BaseMemoryLibOptPei: Remove .S files for IA32 and X64 arch
2019-04-01 8:29 [PATCH v4 00/14] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg Shenglei Zhang
` (6 preceding siblings ...)
2019-04-01 8:29 ` [PATCH v3 07/14] MdePkg/BaseMemoryLibOptDxe: " Shenglei Zhang
@ 2019-04-01 8:29 ` Shenglei Zhang
2019-04-01 8:29 ` [PATCH v3 09/14] MdePkg/BaseMemoryLibRepStr: " Shenglei Zhang
` (5 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Shenglei Zhang @ 2019-04-01 8:29 UTC (permalink / raw)
To: edk2-devel; +Cc: Michael D Kinney, Liming Gao
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
---
.../BaseMemoryLibOptPei.inf | 22 -------
.../BaseMemoryLibOptPei/Ia32/CompareMem.S | 55 ----------------
.../BaseMemoryLibOptPei/Ia32/CopyMem.S | 62 -----------------
.../BaseMemoryLibOptPei/Ia32/ScanMem16.S | 52 ---------------
.../BaseMemoryLibOptPei/Ia32/ScanMem32.S | 52 ---------------
.../BaseMemoryLibOptPei/Ia32/ScanMem64.S | 61 -----------------
.../BaseMemoryLibOptPei/Ia32/ScanMem8.S | 52 ---------------
.../Library/BaseMemoryLibOptPei/Ia32/SetMem.S | 50 --------------
.../BaseMemoryLibOptPei/Ia32/SetMem16.S | 43 ------------
.../BaseMemoryLibOptPei/Ia32/SetMem32.S | 43 ------------
.../BaseMemoryLibOptPei/Ia32/SetMem64.S | 46 -------------
.../BaseMemoryLibOptPei/Ia32/ZeroMem.S | 49 --------------
.../BaseMemoryLibOptPei/X64/CompareMem.S | 59 -----------------
.../Library/BaseMemoryLibOptPei/X64/CopyMem.S | 66 -------------------
.../BaseMemoryLibOptPei/X64/ScanMem16.S | 56 ----------------
.../BaseMemoryLibOptPei/X64/ScanMem32.S | 56 ----------------
.../BaseMemoryLibOptPei/X64/ScanMem64.S | 56 ----------------
.../BaseMemoryLibOptPei/X64/ScanMem8.S | 56 ----------------
.../Library/BaseMemoryLibOptPei/X64/SetMem.S | 47 -------------
.../BaseMemoryLibOptPei/X64/SetMem16.S | 47 -------------
.../BaseMemoryLibOptPei/X64/SetMem32.S | 47 -------------
.../BaseMemoryLibOptPei/X64/SetMem64.S | 46 -------------
.../Library/BaseMemoryLibOptPei/X64/ZeroMem.S | 50 --------------
23 files changed, 1173 deletions(-)
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.S
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf b/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf
index 8f274d83b0..6fcb5fdac2 100644
--- a/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf
+++ b/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf
@@ -35,27 +35,16 @@
[Sources.Ia32]
Ia32/ScanMem64.nasm
- Ia32/ScanMem64.S
Ia32/ScanMem32.nasm
- Ia32/ScanMem32.S
Ia32/ScanMem16.nasm
- Ia32/ScanMem16.S
Ia32/ScanMem8.nasm
- Ia32/ScanMem8.S
Ia32/CompareMem.nasm
- Ia32/CompareMem.S
Ia32/ZeroMem.nasm
- Ia32/ZeroMem.S
Ia32/SetMem64.nasm
- Ia32/SetMem64.S
Ia32/SetMem32.nasm
- Ia32/SetMem32.S
Ia32/SetMem16.nasm
- Ia32/SetMem16.S
Ia32/SetMem.nasm
- Ia32/SetMem.S
Ia32/CopyMem.nasm
- Ia32/CopyMem.S
Ia32/ScanMem64.nasm
Ia32/ScanMem32.nasm
Ia32/ScanMem16.nasm
@@ -84,27 +73,16 @@
[Sources.X64]
X64/ScanMem64.nasm
- X64/ScanMem64.S
X64/ScanMem32.nasm
- X64/ScanMem32.S
X64/ScanMem16.nasm
- X64/ScanMem16.S
X64/ScanMem8.nasm
- X64/ScanMem8.S
X64/CompareMem.nasm
- X64/CompareMem.S
X64/ZeroMem.nasm
- X64/ZeroMem.S
X64/SetMem64.nasm
- X64/SetMem64.S
X64/SetMem32.nasm
- X64/SetMem32.S
X64/SetMem16.nasm
- X64/SetMem16.S
X64/SetMem.nasm
- X64/SetMem.S
X64/CopyMem.nasm
- X64/CopyMem.S
X64/IsZeroBuffer.nasm
ScanMem64Wrapper.c
ScanMem32Wrapper.c
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S
deleted file mode 100644
index 23758781c9..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S
+++ /dev/null
@@ -1,55 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CompareMem.S
-#
-# Abstract:
-#
-# CompareMem function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemCompareMem)
-
-#------------------------------------------------------------------------------
-# INTN
-# EFIAPI
-# InternalMemCompareMem (
-# IN CONST VOID *DestinationBuffer,
-# IN CONST VOID *SourceBuffer,
-# IN UINTN Length
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemCompareMem):
- push %esi
- push %edi
- movl 12(%esp), %esi
- movl 16(%esp), %edi
- movl 20(%esp), %ecx
- repe cmpsb
- movzbl -1(%esi), %eax
- movzbl -1(%edi), %edx
- subl %edx, %eax
- pop %edi
- pop %esi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S
deleted file mode 100644
index 9d5873c888..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S
+++ /dev/null
@@ -1,62 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CopyMem.S
-#
-# Abstract:
-#
-# CopyMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemCopyMem (
-# IN VOID *Destination,
-# IN VOID *Source,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemCopyMem):
- push %esi
- push %edi
- movl 16(%esp), %esi # esi <- Source
- movl 12(%esp), %edi # edi <- Destination
- movl 20(%esp), %edx # edx <- Count
- cmpl %esi, %edi
- je L_CopyDone
- cmpl $0, %edx
- je L_CopyDone
- leal -1(%esi, %edx), %eax # eax <- End of Source
- cmpl %edi, %esi
- jae L_CopyBytes
- cmpl %edi, %eax
- jb L_CopyBytes # Copy backward if overlapped
- movl %eax, %esi # esi <- End of Source
- leal -1(%edi, %edx), %edi # edi <- End of Destination
- std
-L_CopyBytes:
- movl %edx, %ecx
- rep
- movsb # Copy bytes backward
- cld
-L_CopyDone:
- movl 12(%esp), %eax # eax <- Destination as return value
- pop %edi
- pop %esi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.S
deleted file mode 100644
index c1a374861e..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.S
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem16.S
-#
-# Abstract:
-#
-# ScanMem16 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem16)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem16 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT16 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem16):
- push %edi
- movl 12(%esp), %ecx
- movl 8(%esp), %edi
- movl 16(%esp), %eax
- repne scasw
- leal -2(%edi), %eax
- cmovnz %ecx, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.S
deleted file mode 100644
index 066fde42ce..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.S
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem32.Asm
-#
-# Abstract:
-#
-# ScanMem32 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem32)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem32 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem32):
- push %edi
- movl 12(%esp), %ecx
- movl 8(%esp), %edi
- movl 16(%esp), %eax
- repne scasl
- leal -4(%edi), %eax
- cmovnz %ecx, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.S
deleted file mode 100644
index c8f76f14a0..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.S
+++ /dev/null
@@ -1,61 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem64.S
-#
-# Abstract:
-#
-# ScanMem64 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem64)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem64 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT64 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem64):
- push %edi
- movl 12(%esp), %ecx
- movl 16(%esp), %eax
- movl 20(%esp), %edx
- movl 8(%esp), %edi
-L0:
- cmpl (%edi), %eax
- leal 8(%edi), %edi
- loopne L0
- jne L1
- cmpl -4(%edi), %edx
- jecxz L1
- jne L0
-L1:
- leal -8(%edi), %eax
- cmovne %ecx, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.S
deleted file mode 100644
index 478b926165..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.S
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem8.S
-#
-# Abstract:
-#
-# ScanMem8 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem8)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem8 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT8 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem8):
- push %edi
- movl 12(%esp), %ecx
- movl 8(%esp), %edi
- movb 16(%esp), %al
- repne scasb
- leal -1(%edi), %eax
- cmovnz %ecx, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.S
deleted file mode 100644
index 8c643ae46f..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.S
+++ /dev/null
@@ -1,50 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem.S
-#
-# Abstract:
-#
-# SetMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT8 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem):
- push %edi
- movl 12(%esp),%ecx
- movb 16(%esp),%al
- movb %al, %ah
- shrd $16, %eax, %edx
- shld $16, %edx, %eax
- movl %ecx, %edx
- movl 8(%esp),%edi
- shr $2, %ecx
- rep stosl
- movl %edx, %ecx
- andl $3, %ecx
- rep stosb
- movl 8(%esp),%eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.S
deleted file mode 100644
index a31c8aef49..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.S
+++ /dev/null
@@ -1,43 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem16.S
-#
-# Abstract:
-#
-# SetMem16 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem16)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem16 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT16 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem16):
- push %edi
- movl 16(%esp), %eax
- movl 8(%esp), %edi
- movl 12(%esp), %ecx
- rep
- stosw
- movl 8(%esp), %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.S
deleted file mode 100644
index 73e36b731b..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.S
+++ /dev/null
@@ -1,43 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem32.S
-#
-# Abstract:
-#
-# SetMem32 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem32 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT32 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem32):
- push %edi
- movl 16(%esp),%eax
- movl 8(%esp),%edi
- movl 12(%esp),%ecx
- rep
- stosl
- movl 8(%esp),%eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.S
deleted file mode 100644
index 51687d46c2..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.S
+++ /dev/null
@@ -1,46 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem64.S
-#
-# Abstract:
-#
-# SetMem64 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem64)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem64 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT64 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem64):
- push %edi
- movl 12(%esp), %ecx
- movl 16(%esp), %eax
- movl 20(%esp), %edx
- movl 8(%esp), %edi
-L0:
- mov %eax, -8(%edi, %ecx, 8)
- mov %edx, -4(%edi, %ecx, 8)
- loop L0
- movl %edi, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.S b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.S
deleted file mode 100644
index 8ac52897be..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.S
+++ /dev/null
@@ -1,49 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ZeroMem.S
-#
-# Abstract:
-#
-# ZeroMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemZeroMem (
-# IN VOID *Buffer,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemZeroMem):
- push %edi
- xorl %eax,%eax
- movl 8(%esp),%edi
- movl 12(%esp),%ecx
- movl %ecx,%edx
- shrl $2,%ecx
- andl $3,%edx
- pushl %edi
- rep
- stosl
- movl %edx,%ecx
- rep
- stosb
- popl %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.S
deleted file mode 100644
index 26ed8dd866..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.S
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from CompareMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CompareMem.S
-#
-# Abstract:
-#
-# CompareMem function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# INTN
-# EFIAPI
-# InternalMemCompareMem (
-# IN CONST VOID *DestinationBuffer,
-# IN CONST VOID *SourceBuffer,
-# IN UINTN Length
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemCompareMem)
-ASM_PFX(InternalMemCompareMem):
- pushq %rsi
- pushq %rdi
- movq %rcx, %rsi
- movq %rdx, %rdi
- movq %r8, %rcx
- repe cmpsb
- movzbq -1(%rsi) , %rax
- movzbq -1(%rdi) , %rdx
- subq %rdx, %rax
- popq %rdi
- popq %rsi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.S
deleted file mode 100644
index fad30a5f31..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.S
+++ /dev/null
@@ -1,66 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from CopyMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CopyMem.S
-#
-# Abstract:
-#
-# CopyMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemCopyMem (
-# IN VOID *Destination,
-# IN VOID *Source,
-# IN UINTN Count
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
-ASM_PFX(InternalMemCopyMem):
- pushq %rsi
- pushq %rdi
- movq %rdx, %rsi # rsi <- Source
- movq %rcx, %rdi # rdi <- Destination
- leaq -1(%rsi, %r8,), %r9 # r9 <- End of Source
- cmpq %rdi, %rsi
- movq %rdi, %rax # rax <- Destination as return value
- jae _InternalMemCopyMem_al_0000
- cmpq %rdi, %r9
- jae _atSym_CopyBackward # Copy backward if overlapped
-_InternalMemCopyMem_al_0000:
- movq %r8, %rcx
- andq $7, %r8
- shrq $3, %rcx
- rep movsq # Copy as many Qwords as possible
- jmp _atSym_CopyBytes
-_atSym_CopyBackward:
- movq %r9, %rsi # rsi <- End of Source
- leaq -1(%rdi, %r8), %rdi # rdi <- End of Destination
- std # set direction flag
-_atSym_CopyBytes:
- movq %r8, %rcx
- rep movsb # Copy bytes backward
- cld
- popq %rdi
- popq %rsi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.S
deleted file mode 100644
index 282dc3cd12..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem16.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem16.S
-#
-# Abstract:
-#
-# ScanMem16 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem16 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT16 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem16)
-ASM_PFX(InternalMemScanMem16):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdx, %rcx
- movq %r8, %rax
- repne scasw
- leaq -2(%rdi), %rax
- cmovnz %rcx, %rax # set rax to 0 if not found
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.S
deleted file mode 100644
index 70426e73be..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem32.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem32.S
-#
-# Abstract:
-#
-# ScanMem32 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem32 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem32)
-ASM_PFX(InternalMemScanMem32):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdx, %rcx
- movq %r8, %rax
- repne scasl
- leaq -4(%rdi), %rax
- cmovnz %rcx, %rax # set rax to 0 if not found
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.S
deleted file mode 100644
index eac15bc84e..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem64.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem64.S
-#
-# Abstract:
-#
-# ScanMem64 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem64 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT64 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem64)
-ASM_PFX(InternalMemScanMem64):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdx, %rcx
- movq %r8, %rax
- repne scasq
- leaq -8(%rdi), %rax
- cmovnz %rcx, %rax # set rax to 0 if not found
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.S
deleted file mode 100644
index cea3f56781..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem8.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem8.S
-#
-# Abstract:
-#
-# ScanMem8 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem8 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT8 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem8)
-ASM_PFX(InternalMemScanMem8):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdx, %rcx
- movq %r8, %rax
- repne scasb
- leaq -1(%rdi), %rax
- cmovnz %rcx, %rax # set rax to 0 if not found
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.S
deleted file mode 100644
index 5dead6c992..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.S
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem.S
-#
-# Abstract:
-#
-# SetMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT8 Value
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem)
-ASM_PFX(InternalMemSetMem):
- pushq %rdi
- movq %r8, %rax # rax = Value
- movq %rcx, %rdi # rdi = Buffer
- xchgq %rdx, %rcx # rcx = Count, rdx = Buffer
- rep stosb
- movq %rdx, %rax # rax = Buffer
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.S
deleted file mode 100644
index 4c291e0b87..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.S
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem16.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem16.S
-#
-# Abstract:
-#
-# SetMem16 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem16 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT16 Value
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem16)
-ASM_PFX(InternalMemSetMem16):
- pushq %rdi
- movq %rcx, %rdi
- movq %r8, %rax
- xchgq %rdx, %rcx
- rep stosw
- movq %rdx, %rax
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.S
deleted file mode 100644
index 9b9a63d14f..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.S
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem32.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem32.S
-#
-# Abstract:
-#
-# SetMem32 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem32 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
-ASM_PFX(InternalMemSetMem32):
- pushq %rdi
- movq %rcx, %rdi
- movq %r8, %rax
- xchgq %rdx, %rcx
- rep stosl
- movq %rdx, %rax
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S
deleted file mode 100644
index 6721693a20..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem64.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem64.S
-#
-# Abstract:
-#
-# SetMem64 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem64 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT64 Value
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem64)
-ASM_PFX(InternalMemSetMem64):
- pushq %rdi
- movq %rcx, %rdi
- movq %r8, %rax
- xchgq %rdx, %rcx
- rep stosq
- movq %rdx, %rax
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.S b/MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.S
deleted file mode 100644
index 83f3901e51..0000000000
--- a/MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.S
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ZeroMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ZeroMem.S
-#
-# Abstract:
-#
-# ZeroMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemZeroMem (
-# IN VOID *Buffer,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
-ASM_PFX(InternalMemZeroMem):
- pushq %rdi
- pushq %rcx
- xorq %rax, %rax
- movq %rcx, %rdi
- movq %rdx, %rcx
- shrq $3, %rcx
- andq $7, %rdx
- rep stosq
- movl %edx, %ecx
- rep stosb
- popq %rax
- popq %rdi
- ret
-
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 09/14] MdePkg/BaseMemoryLibRepStr: Remove .S files for IA32 and X64 arch
2019-04-01 8:29 [PATCH v4 00/14] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg Shenglei Zhang
` (7 preceding siblings ...)
2019-04-01 8:29 ` [PATCH v3 08/14] MdePkg/BaseMemoryLibOptPei: " Shenglei Zhang
@ 2019-04-01 8:29 ` Shenglei Zhang
2019-04-01 8:29 ` [PATCH v3 10/14] MdePkg/BaseMemoryLibSse2: " Shenglei Zhang
` (4 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Shenglei Zhang @ 2019-04-01 8:29 UTC (permalink / raw)
To: edk2-devel; +Cc: Michael D Kinney, Liming Gao
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
---
.../BaseMemoryLibRepStr.inf | 22 -------
.../BaseMemoryLibRepStr/Ia32/CompareMem.S | 55 ----------------
.../BaseMemoryLibRepStr/Ia32/CopyMem.S | 65 ------------------
.../BaseMemoryLibRepStr/Ia32/ScanMem16.S | 54 ---------------
.../BaseMemoryLibRepStr/Ia32/ScanMem32.S | 54 ---------------
.../BaseMemoryLibRepStr/Ia32/ScanMem64.S | 63 ------------------
.../BaseMemoryLibRepStr/Ia32/ScanMem8.S | 54 ---------------
.../Library/BaseMemoryLibRepStr/Ia32/SetMem.S | 46 -------------
.../BaseMemoryLibRepStr/Ia32/SetMem16.S | 43 ------------
.../BaseMemoryLibRepStr/Ia32/SetMem32.S | 43 ------------
.../BaseMemoryLibRepStr/Ia32/SetMem64.S | 46 -------------
.../BaseMemoryLibRepStr/Ia32/ZeroMem.S | 49 --------------
.../BaseMemoryLibRepStr/X64/CompareMem.S | 59 -----------------
.../Library/BaseMemoryLibRepStr/X64/CopyMem.S | 66 -------------------
.../BaseMemoryLibRepStr/X64/ScanMem16.S | 56 ----------------
.../BaseMemoryLibRepStr/X64/ScanMem32.S | 56 ----------------
.../BaseMemoryLibRepStr/X64/ScanMem64.S | 56 ----------------
.../BaseMemoryLibRepStr/X64/ScanMem8.S | 56 ----------------
.../Library/BaseMemoryLibRepStr/X64/SetMem.S | 47 -------------
.../BaseMemoryLibRepStr/X64/SetMem16.S | 47 -------------
.../BaseMemoryLibRepStr/X64/SetMem32.S | 47 -------------
.../BaseMemoryLibRepStr/X64/SetMem64.S | 46 -------------
.../Library/BaseMemoryLibRepStr/X64/ZeroMem.S | 50 --------------
23 files changed, 1180 deletions(-)
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.S
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf b/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
index 049936deab..7b315b8302 100644
--- a/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
+++ b/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
@@ -48,27 +48,16 @@
[Sources.Ia32]
Ia32/ScanMem64.nasm
- Ia32/ScanMem64.S
Ia32/ScanMem32.nasm
- Ia32/ScanMem32.S
Ia32/ScanMem16.nasm
- Ia32/ScanMem16.S
Ia32/ScanMem8.nasm
- Ia32/ScanMem8.S
Ia32/CompareMem.nasm
- Ia32/CompareMem.S
Ia32/ZeroMem.nasm
- Ia32/ZeroMem.S
Ia32/SetMem64.nasm
- Ia32/SetMem64.S
Ia32/SetMem32.nasm
- Ia32/SetMem32.S
Ia32/SetMem16.nasm
- Ia32/SetMem16.S
Ia32/SetMem.nasm
- Ia32/SetMem.S
Ia32/CopyMem.nasm
- Ia32/CopyMem.S
Ia32/ScanMem64.nasm
Ia32/ScanMem32.nasm
Ia32/ScanMem16.nasm
@@ -84,27 +73,16 @@
[Sources.X64]
X64/ScanMem64.nasm
- X64/ScanMem64.S
X64/ScanMem32.nasm
- X64/ScanMem32.S
X64/ScanMem16.nasm
- X64/ScanMem16.S
X64/ScanMem8.nasm
- X64/ScanMem8.S
X64/CompareMem.nasm
- X64/CompareMem.S
X64/ZeroMem.nasm
- X64/ZeroMem.S
X64/SetMem64.nasm
- X64/SetMem64.S
X64/SetMem32.nasm
- X64/SetMem32.S
X64/SetMem16.nasm
- X64/SetMem16.S
X64/SetMem.nasm
- X64/SetMem.S
X64/CopyMem.nasm
- X64/CopyMem.S
X64/ScanMem64.nasm
X64/ScanMem32.nasm
X64/ScanMem16.nasm
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S
deleted file mode 100644
index b509586adb..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S
+++ /dev/null
@@ -1,55 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CompareMem.Asm
-#
-# Abstract:
-#
-# CompareMem function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemCompareMem)
-
-#------------------------------------------------------------------------------
-# INTN
-# EFIAPI
-# InternalMemCompareMem (
-# IN CONST VOID *DestinationBuffer,
-# IN CONST VOID *SourceBuffer,
-# IN UINTN Length
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemCompareMem):
- push %esi
- push %edi
- movl 12(%esp), %esi
- movl 16(%esp), %edi
- movl 20(%esp), %ecx
- repe cmpsb
- movzbl -1(%esi), %eax
- movzbl -1(%edi), %edx
- subl %edx, %eax
- pop %edi
- pop %esi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.S
deleted file mode 100644
index 5aeef75a5d..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.S
+++ /dev/null
@@ -1,65 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CopyMem.Asm
-#
-# Abstract:
-#
-# CopyMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemCopyMem (
-# IN VOID *Destination,
-# IN VOID *Source,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemCopyMem):
- push %esi
- push %edi
- movl 16(%esp), %esi # esi <- Source
- movl 12(%esp), %edi # edi <- Destination
- movl 20(%esp), %edx # edx <- Count
- leal -1(%esi, %edx), %eax # eax <- End of Source
- cmpl %edi, %esi
- jae L0
- cmpl %edi, %eax
- jae L_CopyBackward # Copy backward if overlapped
-L0:
- movl %edx, %ecx
- andl $3, %edx
- shrl $2, %ecx
- rep
- movsl # Copy as many Dwords as possible
- jmp L_CopyBytes
-L_CopyBackward:
- movl %eax, %esi # esi <- End of Source
- leal -1(%edi, %edx), %edi # edi <- End of Destination
- std
-L_CopyBytes:
- movl %edx, %ecx
- rep
- movsb # Copy bytes backward
- cld
- movl 12(%esp), %eax # eax <- Destination as return value
- pop %edi
- pop %esi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S
deleted file mode 100644
index 1977be7938..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S
+++ /dev/null
@@ -1,54 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem16.Asm
-#
-# Abstract:
-#
-# ScanMem16 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem16)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem16 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT16 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem16):
- push %edi
- movl 12(%esp), %ecx
- movl 8(%esp), %edi
- movl 16(%esp), %eax
- repne scasw
- leal -2(%edi), %eax
- jz L0
- movl %ecx, %eax
-L0:
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S
deleted file mode 100644
index 9751b4a82b..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S
+++ /dev/null
@@ -1,54 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem32.Asm
-#
-# Abstract:
-#
-# ScanMem32 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem32)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem32 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem32):
- push %edi
- movl 12(%esp), %ecx
- movl 8(%esp), %edi
- movl 16(%esp), %eax
- repne scasl
- leal -4(%edi), %eax
- jz L0
- movl %ecx, %eax
-L0:
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S
deleted file mode 100644
index 3efc9b82d3..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S
+++ /dev/null
@@ -1,63 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem64.Asm
-#
-# Abstract:
-#
-# ScanMem64 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem64)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem64 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT64 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem64):
- push %edi
- movl 12(%esp), %ecx
- movl 16(%esp), %eax
- movl 20(%esp), %edx
- movl 8(%esp), %edi
-L0:
- cmpl (%edi), %eax
- leal 8(%edi), %edi
- loopne L0
- jne L1
- cmpl -4(%edi), %edx
- jecxz L1
- jne L0
-L1:
- leal -8(%edi), %eax
- jz L2
- movl %ecx, %eax
-L2:
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S
deleted file mode 100644
index f8d8b7a736..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S
+++ /dev/null
@@ -1,54 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem8.Asm
-#
-# Abstract:
-#
-# ScanMem8 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem8)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem8 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT8 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem8):
- push %edi
- movl 12(%esp), %ecx
- movl 8(%esp), %edi
- movb 16(%esp), %al
- repne scasb
- leal -1(%edi), %eax
- jz L0
- movl %ecx, %eax
-L0:
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S
deleted file mode 100644
index 9b1f1cb60c..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S
+++ /dev/null
@@ -1,46 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem.Asm
-#
-# Abstract:
-#
-# SetMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
- .code:
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT8 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem):
- push %edi
- movl 16(%esp),%eax
- movl 8(%esp),%edi
- movl 12(%esp),%ecx
- rep
- stosb
- movl 8(%esp),%eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.S
deleted file mode 100644
index e35774a8ac..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.S
+++ /dev/null
@@ -1,43 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem16.Asm
-#
-# Abstract:
-#
-# SetMem16 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem16)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem16 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT16 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem16):
- push %edi
- movl 16(%esp), %eax
- movl 8(%esp), %edi
- movl 12(%esp), %ecx
- rep
- stosw
- movl 8(%esp), %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.S
deleted file mode 100644
index 0a8b1c3c64..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.S
+++ /dev/null
@@ -1,43 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem32.Asm
-#
-# Abstract:
-#
-# SetMem32 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem32 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT32 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem32):
- push %edi
- movl 16(%esp),%eax
- movl 8(%esp),%edi
- movl 12(%esp),%ecx
- rep
- stosl
- movl 8(%esp),%eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.S
deleted file mode 100644
index 2e4b7ced57..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.S
+++ /dev/null
@@ -1,46 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem64.Asm
-#
-# Abstract:
-#
-# SetMem64 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem64)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem64 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT64 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem64):
- push %edi
- movl 12(%esp), %ecx
- movl 16(%esp), %eax
- movl 20(%esp), %edx
- movl 8(%esp), %edi
-L0:
- mov %eax, -8(%edi, %ecx, 8)
- mov %edx, -4(%edi, %ecx, 8)
- loop L0
- movl %edi, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.S b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.S
deleted file mode 100644
index 86ba2414a8..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.S
+++ /dev/null
@@ -1,49 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ZeroMem.Asm
-#
-# Abstract:
-#
-# ZeroMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemZeroMem (
-# IN VOID *Buffer,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemZeroMem):
- push %edi
- xorl %eax,%eax
- movl 8(%esp),%edi
- movl 12(%esp),%ecx
- movl %ecx,%edx
- shrl $2,%ecx
- andl $3,%edx
- pushl %edi
- rep
- stosl
- movl %edx,%ecx
- rep
- stosb
- popl %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.S
deleted file mode 100644
index 3087aea0c2..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.S
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from CompareMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CompareMem.S
-#
-# Abstract:
-#
-# CompareMem function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# INTN
-# EFIAPI
-# InternalMemCompareMem (
-# IN CONST VOID *DestinationBuffer,
-# IN CONST VOID *SourceBuffer,
-# IN UINTN Length
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemCompareMem)
-ASM_PFX(InternalMemCompareMem):
- pushq %rsi
- pushq %rdi
- movq %rcx, %rsi
- movq %rdx, %rdi
- movq %r8, %rcx
- repe cmpsb
- movzbq -1(%rsi) , %rax
- movzbq -1(%rdi) , %rdx
- subq %rdx, %rax
- popq %rdi
- popq %rsi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.S
deleted file mode 100644
index 4d7a7d096f..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.S
+++ /dev/null
@@ -1,66 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from CopyMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CopyMem.S
-#
-# Abstract:
-#
-# CopyMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemCopyMem (
-# IN VOID *Destination,
-# IN VOID *Source,
-# IN UINTN Count
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
-ASM_PFX(InternalMemCopyMem):
- pushq %rsi
- pushq %rdi
- movq %rdx, %rsi # rsi <- Source
- movq %rcx, %rdi # rdi <- Destination
- leaq -1(%rsi, %r8,), %r9 # r9 <- End of Source
- cmpq %rdi, %rsi
- movq %rdi, %rax # rax <- Destination as return value
- jae L0
- cmpq %rdi, %r9
- jae L_CopyBackward # Copy backward if overlapped
-L0:
- movq %r8, %rcx
- andq $7, %r8
- shrq $3, %rcx
- rep movsq # Copy as many Qwords as possible
- jmp L_CopyBytes
-L_CopyBackward:
- movq %r9, %rsi # rsi <- End of Source
- leaq -1(%rdi, %r8), %rdi # esi <- End of Destination
- std # set direction flag
-L_CopyBytes:
- movq %r8, %rcx
- rep movsb # Copy bytes backward
- cld
- popq %rdi
- popq %rsi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.S
deleted file mode 100644
index 282dc3cd12..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem16.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem16.S
-#
-# Abstract:
-#
-# ScanMem16 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem16 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT16 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem16)
-ASM_PFX(InternalMemScanMem16):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdx, %rcx
- movq %r8, %rax
- repne scasw
- leaq -2(%rdi), %rax
- cmovnz %rcx, %rax # set rax to 0 if not found
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.S
deleted file mode 100644
index 70426e73be..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem32.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem32.S
-#
-# Abstract:
-#
-# ScanMem32 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem32 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem32)
-ASM_PFX(InternalMemScanMem32):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdx, %rcx
- movq %r8, %rax
- repne scasl
- leaq -4(%rdi), %rax
- cmovnz %rcx, %rax # set rax to 0 if not found
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.S
deleted file mode 100644
index eac15bc84e..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem64.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem64.S
-#
-# Abstract:
-#
-# ScanMem64 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem64 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT64 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem64)
-ASM_PFX(InternalMemScanMem64):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdx, %rcx
- movq %r8, %rax
- repne scasq
- leaq -8(%rdi), %rax
- cmovnz %rcx, %rax # set rax to 0 if not found
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.S
deleted file mode 100644
index cea3f56781..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem8.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem8.S
-#
-# Abstract:
-#
-# ScanMem8 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem8 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT8 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem8)
-ASM_PFX(InternalMemScanMem8):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdx, %rcx
- movq %r8, %rax
- repne scasb
- leaq -1(%rdi), %rax
- cmovnz %rcx, %rax # set rax to 0 if not found
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.S
deleted file mode 100644
index 2e7edfaeea..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.S
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem.S
-#
-# Abstract:
-#
-# SetMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT8 Value
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem)
-ASM_PFX(InternalMemSetMem):
- pushq %rdi
- movq %r8, %rax # rax = Value
- movq %rcx, %rdi # rdi = Buffer
- xchgq %rdx, %rcx # rcx = Count, rdx = Buffer
- rep stosb
- movq %rdx, %rax # rax = Buffer
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.S
deleted file mode 100644
index 4c291e0b87..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.S
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem16.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem16.S
-#
-# Abstract:
-#
-# SetMem16 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem16 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT16 Value
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem16)
-ASM_PFX(InternalMemSetMem16):
- pushq %rdi
- movq %rcx, %rdi
- movq %r8, %rax
- xchgq %rdx, %rcx
- rep stosw
- movq %rdx, %rax
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.S
deleted file mode 100644
index 9b9a63d14f..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.S
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem32.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem32.S
-#
-# Abstract:
-#
-# SetMem32 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem32 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
-ASM_PFX(InternalMemSetMem32):
- pushq %rdi
- movq %rcx, %rdi
- movq %r8, %rax
- xchgq %rdx, %rcx
- rep stosl
- movq %rdx, %rax
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.S
deleted file mode 100644
index 6721693a20..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.S
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem64.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem64.S
-#
-# Abstract:
-#
-# SetMem64 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem64 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT64 Value
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem64)
-ASM_PFX(InternalMemSetMem64):
- pushq %rdi
- movq %rcx, %rdi
- movq %r8, %rax
- xchgq %rdx, %rcx
- rep stosq
- movq %rdx, %rax
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.S b/MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.S
deleted file mode 100644
index 83f3901e51..0000000000
--- a/MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.S
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ZeroMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ZeroMem.S
-#
-# Abstract:
-#
-# ZeroMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemZeroMem (
-# IN VOID *Buffer,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
-ASM_PFX(InternalMemZeroMem):
- pushq %rdi
- pushq %rcx
- xorq %rax, %rax
- movq %rcx, %rdi
- movq %rdx, %rcx
- shrq $3, %rcx
- andq $7, %rdx
- rep stosq
- movl %edx, %ecx
- rep stosb
- popq %rax
- popq %rdi
- ret
-
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 10/14] MdePkg/BaseMemoryLibSse2: Remove .S files for IA32 and X64 arch
2019-04-01 8:29 [PATCH v4 00/14] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg Shenglei Zhang
` (8 preceding siblings ...)
2019-04-01 8:29 ` [PATCH v3 09/14] MdePkg/BaseMemoryLibRepStr: " Shenglei Zhang
@ 2019-04-01 8:29 ` Shenglei Zhang
2019-04-01 8:29 ` [PATCH v3 11/14] CryptoPkg/IntrinsicLib: Remove .S files for IA32 arch Shenglei Zhang
` (3 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Shenglei Zhang @ 2019-04-01 8:29 UTC (permalink / raw)
To: edk2-devel; +Cc: Michael D Kinney, Liming Gao
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
---
.../BaseMemoryLibSse2/BaseMemoryLibSse2.inf | 22 -----
.../BaseMemoryLibSse2/Ia32/CompareMem.S | 55 ------------
.../Library/BaseMemoryLibSse2/Ia32/CopyMem.S | 85 -------------------
.../BaseMemoryLibSse2/Ia32/ScanMem16.S | 52 ------------
.../BaseMemoryLibSse2/Ia32/ScanMem32.S | 52 ------------
.../BaseMemoryLibSse2/Ia32/ScanMem64.S | 61 -------------
.../Library/BaseMemoryLibSse2/Ia32/ScanMem8.S | 52 ------------
.../Library/BaseMemoryLibSse2/Ia32/SetMem.S | 76 -----------------
.../Library/BaseMemoryLibSse2/Ia32/SetMem16.S | 69 ---------------
.../Library/BaseMemoryLibSse2/Ia32/SetMem32.S | 68 ---------------
.../Library/BaseMemoryLibSse2/Ia32/SetMem64.S | 58 -------------
.../Library/BaseMemoryLibSse2/Ia32/ZeroMem.S | 65 --------------
.../BaseMemoryLibSse2/X64/CompareMem.S | 59 -------------
.../Library/BaseMemoryLibSse2/X64/CopyMem.S | 83 ------------------
.../Library/BaseMemoryLibSse2/X64/ScanMem16.S | 56 ------------
.../Library/BaseMemoryLibSse2/X64/ScanMem32.S | 56 ------------
.../Library/BaseMemoryLibSse2/X64/ScanMem64.S | 56 ------------
.../Library/BaseMemoryLibSse2/X64/ScanMem8.S | 56 ------------
MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S | 72 ----------------
.../Library/BaseMemoryLibSse2/X64/SetMem16.S | 70 ---------------
.../Library/BaseMemoryLibSse2/X64/SetMem32.S | 69 ---------------
.../Library/BaseMemoryLibSse2/X64/SetMem64.S | 60 -------------
.../Library/BaseMemoryLibSse2/X64/ZeroMem.S | 65 --------------
23 files changed, 1417 deletions(-)
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S
delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S
diff --git a/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf b/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf
index 771fddaa45..340ca15f06 100644
--- a/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf
+++ b/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf
@@ -47,27 +47,16 @@
[Sources.Ia32]
Ia32/ScanMem64.nasm
- Ia32/ScanMem64.S
Ia32/ScanMem32.nasm
- Ia32/ScanMem32.S
Ia32/ScanMem16.nasm
- Ia32/ScanMem16.S
Ia32/ScanMem8.nasm
- Ia32/ScanMem8.S
Ia32/CompareMem.nasm
- Ia32/CompareMem.S
Ia32/ZeroMem.nasm
- Ia32/ZeroMem.S
Ia32/SetMem64.nasm
- Ia32/SetMem64.S
Ia32/SetMem32.nasm
- Ia32/SetMem32.S
Ia32/SetMem16.nasm
- Ia32/SetMem16.S
Ia32/SetMem.nasm
- Ia32/SetMem.S
Ia32/CopyMem.nasm
- Ia32/CopyMem.S
Ia32/ScanMem64.nasm
Ia32/ScanMem32.nasm
Ia32/ScanMem16.nasm
@@ -94,27 +83,16 @@
X64/SetMem.nasm
X64/CopyMem.nasm
X64/ScanMem64.nasm
- X64/ScanMem64.S
X64/ScanMem32.nasm
- X64/ScanMem32.S
X64/ScanMem16.nasm
- X64/ScanMem16.S
X64/ScanMem8.nasm
- X64/ScanMem8.S
X64/CompareMem.nasm
- X64/CompareMem.S
X64/ZeroMem.nasm
- X64/ZeroMem.S
X64/SetMem64.nasm
- X64/SetMem64.S
X64/SetMem32.nasm
- X64/SetMem32.S
X64/SetMem16.nasm
- X64/SetMem16.S
X64/SetMem.nasm
- X64/SetMem.S
X64/CopyMem.nasm
- X64/CopyMem.S
X64/IsZeroBuffer.nasm
[Packages]
diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S
deleted file mode 100644
index b509586adb..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S
+++ /dev/null
@@ -1,55 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CompareMem.Asm
-#
-# Abstract:
-#
-# CompareMem function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemCompareMem)
-
-#------------------------------------------------------------------------------
-# INTN
-# EFIAPI
-# InternalMemCompareMem (
-# IN CONST VOID *DestinationBuffer,
-# IN CONST VOID *SourceBuffer,
-# IN UINTN Length
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemCompareMem):
- push %esi
- push %edi
- movl 12(%esp), %esi
- movl 16(%esp), %edi
- movl 20(%esp), %ecx
- repe cmpsb
- movzbl -1(%esi), %eax
- movzbl -1(%edi), %edx
- subl %edx, %eax
- pop %edi
- pop %esi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.S
deleted file mode 100644
index 17414abd72..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.S
+++ /dev/null
@@ -1,85 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CopyMem.asm
-#
-# Abstract:
-#
-# CopyMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemCopyMem (
-# IN VOID *Destination,
-# IN VOID *Source,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemCopyMem):
- push %esi
- push %edi
- movl 16(%esp), %esi # esi <- Source
- movl 12(%esp), %edi # edi <- Destination
- movl 20(%esp), %edx # edx <- Count
- leal -1(%esi,%edx,), %eax # eax <- End of Source
- cmpl %edi, %esi
- jae L0
- cmpl %edi, %eax # Overlapped?
- jae L_CopyBackward # Copy backward if overlapped
-L0:
- xorl %ecx, %ecx
- subl %edi, %ecx
- andl $15, %ecx # ecx + edi aligns on 16-byte boundary
- jz L1
- cmpl %edx, %ecx
- cmova %edx, %ecx
- subl %ecx, %edx # edx <- remaining bytes to copy
- rep
- movsb
-L1:
- movl %edx, %ecx
- andl $15, %edx
- shrl $4, %ecx # ecx <- # of DQwords to copy
- jz L_CopyBytes
- addl $-16, %esp
- movdqu %xmm0, (%esp)
-L2:
- movdqu (%esi), %xmm0
- movntdq %xmm0, (%edi)
- addl $16, %esi
- addl $16, %edi
- loop L2
- mfence
- movdqu (%esp),%xmm0
- addl $16, %esp # stack cleanup
- jmp L_CopyBytes
-L_CopyBackward:
- movl %eax, %esi # esi <- Last byte in Source
- leal -1(%edi,%edx,), %edi # edi <- Last byte in Destination
- std
-L_CopyBytes:
- movl %edx, %ecx
- rep
- movsb
- cld
- movl 12(%esp), %eax # eax <- Destination as return value
- pop %edi
- pop %esi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.S
deleted file mode 100644
index e247d4ad09..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.S
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem16.Asm
-#
-# Abstract:
-#
-# ScanMem16 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem16)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem16 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT16 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem16):
- push %edi
- movl 12(%esp), %ecx
- movl 8(%esp), %edi
- movl 16(%esp), %eax
- repne scasw
- leal -2(%edi), %eax
- cmovnz %ecx, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.S
deleted file mode 100644
index 066fde42ce..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.S
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem32.Asm
-#
-# Abstract:
-#
-# ScanMem32 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem32)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem32 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem32):
- push %edi
- movl 12(%esp), %ecx
- movl 8(%esp), %edi
- movl 16(%esp), %eax
- repne scasl
- leal -4(%edi), %eax
- cmovnz %ecx, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.S
deleted file mode 100644
index b3435d7fc3..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.S
+++ /dev/null
@@ -1,61 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem64.Asm
-#
-# Abstract:
-#
-# ScanMem64 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem64)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem64 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT64 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem64):
- push %edi
- movl 12(%esp), %ecx
- movl 16(%esp), %eax
- movl 20(%esp), %edx
- movl 8(%esp), %edi
-L0:
- cmpl (%edi), %eax
- leal 8(%edi), %edi
- loopne L0
- jne L1
- cmpl -4(%edi), %edx
- jecxz L1
- jne L0
-L1:
- leal -8(%edi), %eax
- cmovne %ecx, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.S
deleted file mode 100644
index 5e451fd7b9..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.S
+++ /dev/null
@@ -1,52 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem8.Asm
-#
-# Abstract:
-#
-# ScanMem8 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemScanMem8)
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem8 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT8 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemScanMem8):
- push %edi
- movl 12(%esp), %ecx
- movl 8(%esp), %edi
- movb 16(%esp), %al
- repne scasb
- leal -1(%edi), %eax
- cmovnz %ecx, %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S
deleted file mode 100644
index 63e2a993e7..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S
+++ /dev/null
@@ -1,76 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem.asm
-#
-# Abstract:
-#
-# SetMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
- #.MODEL flat,C
- .xmm:
- .code:
-
-#------------------------------------------------------------------------------
-# VOID *
-# _mem_SetMem (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT8 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem)
-ASM_PFX(InternalMemSetMem):
- push %edi
- movl 12(%esp), %edx # edx <- Count
- movl 8(%esp), %edi # edi <- Buffer
- movb 16(%esp), %al # al <- Value
- xorl %ecx, %ecx
- subl %edi, %ecx
- andl $15, %ecx # ecx + edi aligns on 16-byte boundary
- jz L0
- cmpl %edx, %ecx
- cmova %edx, %ecx
- subl %ecx, %edx
- rep
- stosb
-L0:
- movl %edx, %ecx
- andl $15, %edx
- shrl $4, %ecx # ecx <- # of DQwords to set
- jz L_SetBytes
- movb %al, %ah # ax <- Value | (Value << 8)
- addl $-16, %esp
- movdqu %xmm0, (%esp)
- movd %eax, %xmm0
- pshuflw $0, %xmm0, %xmm0
- movlhps %xmm0, %xmm0
-L1:
- movntdq %xmm0, (%edi)
- addl $16, %edi
- loop L1
- mfence
- movdqu (%esp), %xmm0
- addl $16, %esp # stack cleanup
-L_SetBytes:
- movl %edx, %ecx
- rep
- stosb
- movl 8(%esp), %eax # eax <- Buffer as return value
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.S
deleted file mode 100644
index 9222a18b35..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.S
+++ /dev/null
@@ -1,69 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem16.asm
-#
-# Abstract:
-#
-# SetMem16 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem16)
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem16 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT16 Value
-# )
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem16):
- push %edi
- movl 12(%esp), %edx
- movl 8(%esp), %edi
- xorl %ecx, %ecx
- subl %edi, %ecx
- andl $15, %ecx # ecx + edi aligns on 16-byte boundary
- movl 16(%esp), %eax
- jz L0
- shrl %ecx
- cmpl %edx, %ecx
- cmova %edx, %ecx
- subl %ecx, %edx
- rep
- stosw
-L0:
- movl %edx, %ecx
- andl $7, %edx
- shrl $3, %ecx
- jz L_SetWords
- movd %eax, %xmm0
- pshuflw $0, %xmm0, %xmm0
- movlhps %xmm0, %xmm0
-L1:
- movntdq %xmm0, (%edi)
- addl $16, %edi
- loop L1
- mfence
-L_SetWords:
- movl %edx, %ecx
- rep
- stosw
- movl 8(%esp), %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.S
deleted file mode 100644
index 0edbaa2046..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.S
+++ /dev/null
@@ -1,68 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem32.asm
-#
-# Abstract:
-#
-# SetMem32 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem32 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem32):
- push %edi
- movl 12(%esp), %edx
- movl 8(%esp), %edi
- xorl %ecx, %ecx
- subl %edi, %ecx
- andl $15, %ecx # ecx + edi aligns on 16-byte boundary
- movl 16(%esp), %eax
- jz L0
- shrl $2, %ecx
- cmpl %edx, %ecx
- cmova %edx, %ecx
- subl %ecx, %edx
- rep
- stosl
-L0:
- movl %edx, %ecx
- andl $3, %edx
- shrl $2, %ecx
- jz L_SetDwords
- movd %eax, %xmm0
- pshufd $0, %xmm0, %xmm0
-L1:
- movntdq %xmm0, (%edi)
- addl $16, %edi
- loop L1
- mfence
-L_SetDwords:
- movl %edx, %ecx
- rep
- stosl
- movl 8(%esp), %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem64.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem64.S
deleted file mode 100644
index c9e6d63788..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem64.S
+++ /dev/null
@@ -1,58 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem64.S
-#
-# Abstract:
-#
-# SetMem64 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemSetMem64)
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem64 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT64 Value
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemSetMem64):
- movl 4(%esp), %eax
- movl 8(%esp), %ecx
- testb $8, %al
- movl %eax, %edx
- movq 0xc(%esp), %xmm0
- jz L1
- movq %xmm0, (%edx)
- addl $8, %edx
- decl %ecx
-L1:
- shrl %ecx
- jz L_SetQwords
- movlhps %xmm0, %xmm0
-L2:
- movntdq %xmm0, (%edx)
- leal 16(%edx), %edx
- loop L2
- mfence
-L_SetQwords:
- jnc L3
- movq %xmm0, (%edx)
-L3:
- ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.S b/MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.S
deleted file mode 100644
index fc9f0596d3..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.S
+++ /dev/null
@@ -1,65 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ZeroMem.asm
-#
-# Abstract:
-#
-# ZeroMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemZeroMem (
-# IN VOID *Buffer,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_PFX(InternalMemZeroMem):
- push %edi
- movl 8(%esp), %edi
- movl 12(%esp), %edx
- xorl %ecx, %ecx
- subl %edi, %ecx
- xorl %eax, %eax
- andl $15, %ecx
- jz L0
- cmpl %edx, %ecx
- cmova %edx, %ecx
- subl %ecx, %edx
- rep
- stosb
-L0:
- movl %edx, %ecx
- andl $15, %edx
- shrl $4, %ecx
- jz L_ZeroBytes
- pxor %xmm0, %xmm0
-L1:
- movntdq %xmm0, (%edi)
- addl $16, %edi
- loop L1
- mfence
-L_ZeroBytes:
- movl %edx, %ecx
- rep
- stosb
- movl 8(%esp), %eax
- pop %edi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S b/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S
deleted file mode 100644
index 26ed8dd866..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from CompareMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CompareMem.S
-#
-# Abstract:
-#
-# CompareMem function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# INTN
-# EFIAPI
-# InternalMemCompareMem (
-# IN CONST VOID *DestinationBuffer,
-# IN CONST VOID *SourceBuffer,
-# IN UINTN Length
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemCompareMem)
-ASM_PFX(InternalMemCompareMem):
- pushq %rsi
- pushq %rdi
- movq %rcx, %rsi
- movq %rdx, %rdi
- movq %r8, %rcx
- repe cmpsb
- movzbq -1(%rsi) , %rax
- movzbq -1(%rdi) , %rdx
- subq %rdx, %rax
- popq %rdi
- popq %rsi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S b/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S
deleted file mode 100644
index bbe433d360..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from CopyMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# CopyMem.S
-#
-# Abstract:
-#
-# CopyMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemCopyMem (
-# IN VOID *Destination,
-# IN VOID *Source,
-# IN UINTN Count
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemCopyMem)
-ASM_PFX(InternalMemCopyMem):
- pushq %rsi
- pushq %rdi
- movq %rdx, %rsi # rsi <- Source
- movq %rcx, %rdi # rdi <- Destination
- leaq -1(%rsi, %r8,), %r9 # r9 <- Last byte of Source
- cmpq %rdi, %rsi
- movq %rdi, %rax # rax <- Destination as return value
- jae L0 # Copy forward if Source > Destination
- cmpq %rdi, %r9 # Overlapped?
- jae L_CopyBackward # Copy backward if overlapped
-L0:
- xorq %rcx, %rcx
- subq %rdi, %rcx # rcx <- -rdi
- andq $15, %rcx # rcx + rsi should be 16 bytes aligned
- jz L1 # skip if rcx == 0
- cmpq %r8, %rcx
- cmova %r8, %rcx
- subq %rcx, %r8
- rep movsb
-L1:
- movq %r8, %rcx
- andq $15, %r8
- shrq $4, %rcx # rcx <- # of DQwords to copy
- jz L_CopyBytes
- movdqa %xmm0, 0x18(%rsp) # save xmm0 on stack
-L2:
- movdqu (%rsi), %xmm0 # rsi may not be 16-byte aligned
- movntdq %xmm0, (%rdi) # rdi should be 16-byte aligned
- addq $16, %rsi
- addq $16, %rdi
- loop L2
- mfence
- movdqa 0x18(%rsp), %xmm0 # restore xmm0
- jmp L_CopyBytes # copy remaining bytes
-L_CopyBackward:
- movq %r9, %rsi # rsi <- Last byte of Source
- leaq -1(%rdi, %r8,), %rdi # rdi <- Last byte of Destination
- std
-L_CopyBytes:
- movq %r8, %rcx
- rep movsb
- cld
- popq %rdi
- popq %rsi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S b/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S
deleted file mode 100644
index 282dc3cd12..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem16.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem16.S
-#
-# Abstract:
-#
-# ScanMem16 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem16 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT16 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem16)
-ASM_PFX(InternalMemScanMem16):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdx, %rcx
- movq %r8, %rax
- repne scasw
- leaq -2(%rdi), %rax
- cmovnz %rcx, %rax # set rax to 0 if not found
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S b/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S
deleted file mode 100644
index eb91dafb85..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem32.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem32.S
-#
-# Abstract:
-#
-# ScanMem32 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem32 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem32)
-ASM_PFX(InternalMemScanMem32):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdx, %rcx
- movq %r8, %rax
- repne scasl
- leaq -4(%rdi), %rax
- cmovnz %rcx, %rax # set rax to 0 if not found
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S b/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S
deleted file mode 100644
index 20d20aa3c3..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem64.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem64.S
-#
-# Abstract:
-#
-# ScanMem64 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem64 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT64 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem64)
-ASM_PFX(InternalMemScanMem64):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdx, %rcx
- movq %r8, %rax
- repne scasq
- leaq -8(%rdi), %rax
- cmovnz %rcx, %rax # set rax to 0 if not found
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S b/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S
deleted file mode 100644
index b1715ea728..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ScanMem8.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ScanMem8.S
-#
-# Abstract:
-#
-# ScanMem8 function
-#
-# Notes:
-#
-# The following BaseMemoryLib instances contain the same copy of this file:
-#
-# BaseMemoryLibRepStr
-# BaseMemoryLibMmx
-# BaseMemoryLibSse2
-# BaseMemoryLibOptDxe
-# BaseMemoryLibOptPei
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# CONST VOID *
-# EFIAPI
-# InternalMemScanMem8 (
-# IN CONST VOID *Buffer,
-# IN UINTN Length,
-# IN UINT8 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemScanMem8)
-ASM_PFX(InternalMemScanMem8):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdx, %rcx
- movq %r8, %rax
- repne scasb
- leaq -1(%rdi), %rax
- cmovnz %rcx, %rax # set rax to 0 if not found
- popq %rdi
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S b/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S
deleted file mode 100644
index eb4ce80e1e..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S
+++ /dev/null
@@ -1,72 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem.S
-#
-# Abstract:
-#
-# SetMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT8 Value
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem)
-ASM_PFX(InternalMemSetMem):
- pushq %rdi
- movq %rcx, %rdi # rdi <- Buffer
- movb %r8b, %al # al <- Value
- movq %rdi, %r9 # r9 <- Buffer as return value
- xorq %rcx, %rcx
- subq %rdi, %rcx
- andq $15, %rcx # rcx + rdi aligns on 16-byte boundary
- jz L0
- cmpq %rdx, %rcx
- cmova %rdx, %rcx
- subq %rcx, %rdx
- rep stosb
-L0:
- movq %rdx, %rcx
- andq $15, %rdx
- shrq $4, %rcx
- jz L_SetBytes
- movb %al, %ah # ax <- Value repeats twice
- movdqa %xmm0, 0x10(%rsp) # save xmm0
- movd %eax, %xmm0 # xmm0[0..16] <- Value repeats twice
- pshuflw $0, %xmm0, %xmm0 # xmm0[0..63] <- Value repeats 8 times
- movlhps %xmm0, %xmm0 # xmm0 <- Value repeats 16 times
-L1:
- movntdq %xmm0, (%rdi) # rdi should be 16-byte aligned
- add $16, %rdi
- loop L1
- mfence
- movdqa 0x10(%rsp), %xmm0 # restore xmm0
-L_SetBytes:
- movl %edx, %ecx # high 32 bits of rcx are always zero
- rep stosb
- movq %r9, %rax # rax <- Return value
- popq %rdi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S b/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S
deleted file mode 100644
index 74fef09255..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S
+++ /dev/null
@@ -1,70 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem16.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem16.S
-#
-# Abstract:
-#
-# SetMem16 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem16 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT16 Value
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem16)
-ASM_PFX(InternalMemSetMem16):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdi, %r9
- xorq %rcx, %rcx
- subq %rdi, %rcx
- andq $15, %rcx
- movq %r8, %rax
- jz L0
- shrq $1, %rcx
- cmpq %rdx, %rcx
- cmova %rdx, %rcx
- subq %rcx, %rdx
- rep stosw
-L0:
- movq %rdx, %rcx
- andl $7, %edx
- shrq $3, %rcx
- jz L_SetWords
- movd %eax, %xmm0
- pshuflw $0, %xmm0, %xmm0
- movlhps %xmm0, %xmm0
-L1:
- movntdq %xmm0, (%rdi)
- addq $16, %rdi
- loop L1
- mfence
-L_SetWords:
- movl %edx, %ecx
- rep stosw
- movq %r9, %rax
- popq %rdi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S b/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S
deleted file mode 100644
index 24103cf509..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem32.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem32.S
-#
-# Abstract:
-#
-# SetMem32 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# EFIAPI
-# InternalMemSetMem32 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT32 Value
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem32)
-ASM_PFX(InternalMemSetMem32):
- pushq %rdi
- movq %rcx, %rdi
- movq %rdi, %r9
- xorq %rcx, %rcx
- subq %rdi, %rcx
- andq $15, %rcx
- movq %r8, %rax
- jz L0
- shrq $2, %rcx
- cmpq %rdx, %rcx
- cmova %rdx, %rcx
- subq %rcx, %rdx
- rep stosl
-L0:
- movq %rdx, %rcx
- andl $3, %edx
- shrq $2, %rcx
- jz L_SetDwords
- movd %eax, %xmm0
- pshufd $0, %xmm0, %xmm0
-L1:
- movntdq %xmm0, (%rdi)
- addq $16, %rdi
- loop L1
- mfence
-L_SetDwords:
- movl %edx, %ecx
- rep stosl
- movq %r9, %rax
- popq %rdi
- ret
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S b/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S
deleted file mode 100644
index c44ec08ae6..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S
+++ /dev/null
@@ -1,60 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from SetMem64.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SetMem64.S
-#
-# Abstract:
-#
-# SetMem64 function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemSetMem64 (
-# IN VOID *Buffer,
-# IN UINTN Count,
-# IN UINT64 Value
-# )
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemSetMem64)
-ASM_PFX(InternalMemSetMem64):
- movq %rcx, %rax # rax <- Buffer
- xchgq %rdx, %rcx # rcx <- Count & rdx <- Buffer
- testb $8, %dl
- movd %r8, %xmm0
- jz L0
- movq %r8, (%rdx)
- addq $8, %rdx
- decq %rcx
-L0:
- shrq $1, %rcx
- jz L_SetQwords
- movlhps %xmm0, %xmm0
-L1:
- movntdq %xmm0, (%rdx)
- leaq 16(%rdx), %rdx
- loop L1
- mfence
-L_SetQwords:
- jnc L2
- movq %r8, (%rdx)
-L2:
- ret
-
diff --git a/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S b/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S
deleted file mode 100644
index 3b00ce7309..0000000000
--- a/MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S
+++ /dev/null
@@ -1,65 +0,0 @@
-#
-# ConvertAsm.py: Automatically generated from ZeroMem.asm
-#
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# ZeroMem.S
-#
-# Abstract:
-#
-# ZeroMem function
-#
-# Notes:
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID *
-# InternalMemZeroMem (
-# IN VOID *Buffer,
-# IN UINTN Count
-# );
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX(InternalMemZeroMem)
-ASM_PFX(InternalMemZeroMem):
- pushq %rdi
- movq %rcx, %rdi
- xorq %rcx, %rcx
- xorl %eax, %eax
- subq %rdi, %rcx
- andq $15, %rcx
- movq %rdi, %r8
- jz L0
- cmpq %rdx, %rcx
- cmova %rdx, %rcx
- subq %rcx, %rdx
- rep stosb
-L0:
- movq %rdx, %rcx
- andl $15, %edx
- shrq $4, %rcx
- jz L_ZeroBytes
- pxor %xmm0, %xmm0
-L1:
- movntdq %xmm0, (%rdi) # rdi should be 16-byte aligned
- addq $16, %rdi
- loop L1
- mfence
-L_ZeroBytes:
- movl %edx, %ecx
- rep stosb
- movq %r8, %rax
- popq %rdi
- ret
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 11/14] CryptoPkg/IntrinsicLib: Remove .S files for IA32 arch
2019-04-01 8:29 [PATCH v4 00/14] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg Shenglei Zhang
` (9 preceding siblings ...)
2019-04-01 8:29 ` [PATCH v3 10/14] MdePkg/BaseMemoryLibSse2: " Shenglei Zhang
@ 2019-04-01 8:29 ` Shenglei Zhang
2019-04-01 8:29 ` [PATCH v3 12/14] SourceLevelDebugPkg/DebugAgentCommon: Remove .S files Shenglei Zhang
` (2 subsequent siblings)
13 siblings, 0 replies; 18+ messages in thread
From: Shenglei Zhang @ 2019-04-01 8:29 UTC (permalink / raw)
To: edk2-devel; +Cc: Ting Ye, Jian Wang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594
Cc: Ting Ye <ting.ye@intel.com>
Cc: Jian Wang <jian.j.wang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
---
.../Library/IntrinsicLib/Ia32/MathLShiftS64.S | 62 -----------------
.../Library/IntrinsicLib/Ia32/MathRShiftU64.S | 66 -------------------
.../Library/IntrinsicLib/IntrinsicLib.inf | 2 -
3 files changed, 130 deletions(-)
delete mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
delete mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S b/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
deleted file mode 100644
index 7031a59a71..0000000000
--- a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
+++ /dev/null
@@ -1,62 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# MathLShiftS64.S
-#
-# Abstract:
-#
-# 64-bit Math Worker Function.
-# Shifts a 64-bit signed value left by a certain number of bits.
-#
-#------------------------------------------------------------------------------
-
- .686:
- .code:
-
-ASM_GLOBAL ASM_PFX(__ashldi3)
-
-#------------------------------------------------------------------------------
-#
-# void __cdecl __ashldi3 (void)
-#
-#------------------------------------------------------------------------------
-ASM_PFX(__ashldi3):
- #
- # Handle shifting of 64 or more bits (return 0)
- #
- cmpb $64, %cl
- jae ReturnZero
-
- #
- # Handle shifting of between 0 and 31 bits
- #
- cmpb $32, %cl
- jae More32
- shld %cl, %eax, %edx
- shl %cl, %eax
- ret
-
- #
- # Handle shifting of between 32 and 63 bits
- #
-More32:
- movl %eax, %edx
- xor %eax, %eax
- and $31, %cl
- shl %cl, %edx
- ret
-
-ReturnZero:
- xor %eax, %eax
- xor %edx, %edx
- ret
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S b/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
deleted file mode 100644
index 24142b088e..0000000000
--- a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
+++ /dev/null
@@ -1,66 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# MathRShiftU64.S
-#
-# Abstract:
-#
-# 64-bit Math Worker Function.
-# Shifts a 64-bit unsigned value right by a certain number of bits.
-#
-#------------------------------------------------------------------------------
-
-
- .686:
- .code:
-
-ASM_GLOBAL ASM_PFX(__ashrdi3)
-
-#------------------------------------------------------------------------------
-#
-# void __cdecl __ashrdi3 (void)
-#
-#------------------------------------------------------------------------------
-ASM_PFX(__ashrdi3):
- #
- # Checking: Only handle 64bit shifting or more
- #
- cmpb $64, %cl
- jae _Exit
-
- #
- # Handle shifting between 0 and 31 bits
- #
- cmpb $32, %cl
- jae More32
- shrd %cl, %edx, %eax
- shr %cl, %edx
- ret
-
- #
- # Handle shifting of 32-63 bits
- #
-More32:
- movl %edx, %eax
- xor %edx, %edx
- and $31, %cl
- shr %cl, %eax
- ret
-
- #
- # Invalid number (less then 32bits), return 0
- #
-_Exit:
- xor %eax, %eax
- xor %edx, %edx
- ret
diff --git a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
index a91c850013..9704b9ea7d 100644
--- a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+++ b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
@@ -39,8 +39,6 @@
Ia32/MathLShiftS64.c | INTEL
Ia32/MathRShiftU64.c | INTEL
- Ia32/MathLShiftS64.S | GCC
- Ia32/MathRShiftU64.S | GCC
Ia32/MathLShiftS64.nasm | GCC
Ia32/MathRShiftU64.nasm | GCC
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH v3 12/14] SourceLevelDebugPkg/DebugAgentCommon: Remove .S files
2019-04-01 8:29 [PATCH v4 00/14] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg Shenglei Zhang
` (10 preceding siblings ...)
2019-04-01 8:29 ` [PATCH v3 11/14] CryptoPkg/IntrinsicLib: Remove .S files for IA32 arch Shenglei Zhang
@ 2019-04-01 8:29 ` Shenglei Zhang
2019-04-02 1:31 ` Wu, Hao A
2019-04-01 8:29 ` [PATCH v4 13/14] SourceLevelDebugPkg/PeCoffExtraActionLibDebug: " Shenglei Zhang
2019-04-01 8:29 ` [PATCH v4 14/14] CorebootModulePkg/SecCore: Remove .S files for IA32 arch Shenglei Zhang
13 siblings, 1 reply; 18+ messages in thread
From: Shenglei Zhang @ 2019-04-01 8:29 UTC (permalink / raw)
To: edk2-devel; +Cc: Hao Wu
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
---
.../DebugAgentCommon/Ia32/AsmFuncs.S | 415 -----------------
.../DebugAgentCommon/X64/AsmFuncs.S | 431 ------------------
.../Library/DebugAgent/DxeDebugAgentLib.inf | 2 -
3 files changed, 848 deletions(-)
delete mode 100644 SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Ia32/AsmFuncs.S
delete mode 100644 SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/X64/AsmFuncs.S
diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Ia32/AsmFuncs.S b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Ia32/AsmFuncs.S
deleted file mode 100644
index 30d279e80d..0000000000
--- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Ia32/AsmFuncs.S
+++ /dev/null
@@ -1,415 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# AsmFuncs.S
-#
-# Abstract:
-#
-# Debug interrupt handle functions.
-#
-#------------------------------------------------------------------------------
-
-#include "DebugException.h"
-
-ASM_GLOBAL ASM_PFX(InterruptProcess)
-ASM_GLOBAL ASM_PFX(Exception0Handle)
-ASM_GLOBAL ASM_PFX(ExceptionStubHeaderSize)
-ASM_GLOBAL ASM_PFX(TimerInterruptHandle)
-ASM_GLOBAL ASM_PFX(CommonEntry)
-
-.macro AGENT_HANDLER_SIGNATURE
- .byte 0x41, 0x47, 0x54, 0x48 # AGENT_HANDLER_SIGNATURE SIGNATURE_32('A','G','T','H')
-.endm
-
-.data
-
-ASM_PFX(ExceptionStubHeaderSize): .long ASM_PFX(Exception1Handle) - ASM_PFX(Exception0Handle)
-
-.text
-
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception0Handle):
- cli
- pushl %eax
- mov $0, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception1Handle):
- cli
- pushl %eax
- mov $1, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception2Handle):
- cli
- pushl %eax
- mov $2, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception3Handle):
- cli
- pushl %eax
- mov $3, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception4Handle):
- cli
- pushl %eax
- mov $4, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception5Handle):
- cli
- pushl %eax
- mov $5, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception6Handle):
- cli
- pushl %eax
- mov $6, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception7Handle):
- cli
- pushl %eax
- mov $7, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception8Handle):
- cli
- pushl %eax
- mov $8, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception9Handle):
- cli
- pushl %eax
- mov $9, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception10Handle):
- cli
- pushl %eax
- mov $10, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception11Handle):
- cli
- pushl %eax
- mov $11, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception12Handle):
- cli
- pushl %eax
- mov $12, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception13Handle):
- cli
- pushl %eax
- mov $13, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception14Handle):
- cli
- pushl %eax
- mov $14, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception15Handle):
- cli
- pushl %eax
- mov $15, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception16Handle):
- cli
- pushl %eax
- mov $16, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception17Handle):
- cli
- pushl %eax
- mov $17, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception18Handle):
- cli
- pushl %eax
- mov $18, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception19Handle):
- cli
- pushl %eax
- mov $19, %eax
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(TimerInterruptHandle):
- cli
- pushl %eax
- mov $32, %eax
- jmp ASM_PFX(CommonEntry)
-
-
-ASM_PFX(CommonEntry):
-
-#---------------------------------------;
-# _CommonEntry ;
-#----------------------------------------------------------------------------;
-# The follow algorithm is used for the common interrupt routine.
-# Entry from each interrupt with a push eax and eax=interrupt number
-#
-# +---------------------+
-# + EFlags +
-# +---------------------+
-# + CS +
-# +---------------------+
-# + EIP +
-# +---------------------+
-# + Error Code +
-# +---------------------+
-# + EAX / Vector Number +
-# +---------------------+
-# + EBP +
-# +---------------------+ <-- EBP
-#
-
-# We need to determine if any extra data was pushed by the exception
- cmpl $DEBUG_EXCEPT_DOUBLE_FAULT, %eax
- je NoExtrPush
- cmpl $DEBUG_EXCEPT_INVALID_TSS, %eax
- je NoExtrPush
- cmpl $DEBUG_EXCEPT_SEG_NOT_PRESENT, %eax
- je NoExtrPush
- cmpl $DEBUG_EXCEPT_STACK_FAULT, %eax
- je NoExtrPush
- cmpl $DEBUG_EXCEPT_GP_FAULT, %eax
- je NoExtrPush
- cmpl $DEBUG_EXCEPT_PAGE_FAULT, %eax
- je NoExtrPush
- cmpl $DEBUG_EXCEPT_ALIGNMENT_CHECK, %eax
- je NoExtrPush
-
- pushl (%esp)
- movl $0, 4(%esp)
-
-NoExtrPush:
-
- pushl %ebp
- movl %esp,%ebp
-
- #
- # Align stack to make sure that EFI_FX_SAVE_STATE_IA32 of EFI_SYSTEM_CONTEXT_IA32
- # is 16-byte aligned
- #
- andl $0xfffffff0,%esp
- subl $12,%esp
-
-## UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
- pushl 0x4(%ebp)
- pushl %ebx
- pushl %ecx
- pushl %edx
- mov %eax, %ebx # save vector in ebx
- leal 24(%ebp),%ecx
- pushl %ecx # save original ESP
- pushl (%ebp)
- pushl %esi
- pushl %edi
-
-## UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
-## insure FXSAVE/FXRSTOR is enabled in CR4...
-## ... while we're at it, make sure DE is also enabled...
- mov $1, %eax
- pushl %ebx # temporarily save value of ebx on stack
- cpuid # use CPUID to determine if FXSAVE/FXRESTOR
- # and DE are supported
- popl %ebx # retore value of ebx that was overwritten
- # by CPUID
- movl %cr4, %eax
- pushl %eax # push cr4 firstly
- testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support
- jz L1
- orl $BIT9, %eax # Set CR4.OSFXSR
-L1:
- testl $BIT2, %edx # Test for Debugging Extensions support
- jz L2
- orl $BIT3, %eax # Set CR4.DE
-L2:
- movl %eax, %cr4
- movl %cr3, %eax
- pushl %eax
- movl %cr2, %eax
- pushl %eax
- xorl %eax,%eax
- pushl %eax
- movl %cr0, %eax
- pushl %eax
-
-## UINT32 Gs, Fs, Es, Ds, Cs, Ss;
- movl %ss,%eax
- pushl %eax
- movzwl 16(%ebp), %eax
- pushl %eax
- movl %ds,%eax
- pushl %eax
- movl %es,%eax
- pushl %eax
- movl %fs,%eax
- pushl %eax
- movl %gs,%eax
- pushl %eax
-
-## UINT32 Eip;
- pushl 12(%ebp)
-
-## UINT32 Gdtr[2], Idtr[2];
- subl $8,%esp
- sidt (%esp)
- subl $8,%esp
- sgdt (%esp)
-
-## UINT32 Ldtr, Tr;
- xorl %eax,%eax
- strl %eax
- pushl %eax
- sldtl %eax
- pushl %eax
-
-## UINT32 EFlags;
- pushl 20(%ebp)
-
-## UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
- movl %dr7, %eax
- pushl %eax
-## clear Dr7 while executing debugger itself
- xorl %eax,%eax
- movl %eax, %dr7
-
- movl %dr6, %eax
- pushl %eax
-## insure all status bits in dr6 are clear...
- xorl %eax,%eax
- movl %eax, %dr6
-
- movl %dr3, %eax
- pushl %eax
- movl %dr2, %eax
- pushl %eax
- movl %dr1, %eax
- pushl %eax
- movl %dr0, %eax
- pushl %eax
-
-## FX_SAVE_STATE_IA32 FxSaveState;
- subl $512,%esp
- movl %esp,%edi
- testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support.
- # edx still contains result from CPUID above
- jz L3
- .byte 0x0f, 0xae, 0x07 # fxsave [edi]
-L3:
-
-## save the exception data
- pushl 8(%esp)
-
-## Clear Direction Flag
- cld
-
-## Prepare parameter and call C function
- pushl %esp
- pushl %ebx
- call ASM_PFX(InterruptProcess)
- addl $8,%esp
-
-## skip the exception data
- addl $4,%esp
-
-## FX_SAVE_STATE_IA32 FxSaveState;
- movl %esp,%esi
- movl $1, %eax
- cpuid # use CPUID to determine if FXSAVE/FXRESTOR
- # are supported
- testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support
- jz L4
- .byte 0x0f, 0xae, 0x0e # fxrstor [esi]
-L4:
- addl $512,%esp
-
-## UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
- popl %eax
- movl %eax, %dr0
- popl %eax
- movl %eax, %dr1
- popl %eax
- movl %eax, %dr2
- popl %eax
- movl %eax, %dr3
-## skip restore of dr6. We cleared dr6 during the context save.
- addl $4,%esp
- popl %eax
- movl %eax, %dr7
-
-## UINT32 EFlags;
- popl 20(%ebp)
-
-## UINT32 Ldtr, Tr;
-## UINT32 Gdtr[2], Idtr[2];
-## Best not let anyone mess with these particular registers...
- addl $24,%esp
-
-## UINT32 Eip;
- pop 12(%ebp)
-
-## UINT32 Gs, Fs, Es, Ds, Cs, Ss;
-## NOTE - modified segment registers could hang the debugger... We
-## could attempt to insulate ourselves against this possibility,
-## but that poses risks as well.
-##
- popl %gs
- popl %fs
- popl %es
- popl %ds
- popl 16(%ebp)
- popl %ss
-
-## UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
- popl %eax
- movl %eax, %cr0
- addl $4,%esp # not for Cr1
- popl %eax
- movl %eax, %cr2
- popl %eax
- movl %eax, %cr3
- popl %eax
- movl %eax, %cr4
-
-## UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
- popl %edi
- popl %esi
- addl $4,%esp # not for ebp
- addl $4,%esp # not for esp
- popl %edx
- popl %ecx
- popl %ebx
- popl %eax
-
- movl %ebp,%esp
- popl %ebp
- addl $8,%esp # skip eax
- iretl
-
diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/X64/AsmFuncs.S b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/X64/AsmFuncs.S
deleted file mode 100644
index cdda41fb27..0000000000
--- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/X64/AsmFuncs.S
+++ /dev/null
@@ -1,431 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# AsmFuncs.S
-#
-# Abstract:
-#
-# Debug interrupt handle functions.
-#
-#------------------------------------------------------------------------------
-
-#include "DebugException.h"
-
-ASM_GLOBAL ASM_PFX(InterruptProcess)
-
-ASM_GLOBAL ASM_PFX(Exception0Handle)
-ASM_GLOBAL ASM_PFX(ExceptionStubHeaderSize)
-ASM_GLOBAL ASM_PFX(TimerInterruptHandle)
-ASM_GLOBAL ASM_PFX(CommonEntry)
-
-.macro AGENT_HANDLER_SIGNATURE
- .byte 0x41, 0x47, 0x54, 0x48 # AGENT_HANDLER_SIGNATURE SIGNATURE_32('A','G','T','H')
-.endm
-
-.data
-
-ASM_PFX(ExceptionStubHeaderSize): .long ASM_PFX(Exception1Handle) - ASM_PFX(Exception0Handle)
-
-
-.text
-
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception0Handle):
- cli
- pushq %rcx
- mov $0, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception1Handle):
- cli
- pushq %rcx
- mov $1, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception2Handle):
- cli
- pushq %rcx
- mov $2, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception3Handle):
- cli
- pushq %rcx
- mov $3, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception4Handle):
- cli
- pushq %rcx
- mov $4, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception5Handle):
- cli
- pushq %rcx
- mov $5, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception6Handle):
- cli
- pushq %rcx
- mov $6, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception7Handle):
- cli
- pushq %rcx
- mov $7, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception8Handle):
- cli
- pushq %rcx
- mov $8, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception9Handle):
- cli
- pushq %rcx
- mov $9, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception10Handle):
- cli
- pushq %rcx
- mov $10, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception11Handle):
- cli
- pushq %rcx
- mov $11, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception12Handle):
- cli
- pushq %rcx
- mov $12, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception13Handle):
- cli
- pushq %rcx
- mov $13, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception14Handle):
- cli
- pushq %rcx
- mov $14, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception15Handle):
- cli
- pushq %rcx
- mov $15, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception16Handle):
- cli
- pushq %rcx
- mov $16, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception17Handle):
- cli
- pushq %rcx
- mov $17, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception18Handle):
- cli
- pushq %rcx
- mov $18, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception19Handle):
- cli
- pushq %rcx
- mov $19, %rcx
- jmp ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(TimerInterruptHandle):
- cli
- pushq %rcx
- mov $32, %rcx
- jmp ASM_PFX(CommonEntry)
-
-
-ASM_PFX(CommonEntry):
-
-#---------------------------------------;
-# CommonInterruptEntry ;
-#---------------------------------------;
-# The follow algorithm is used for the common interrupt routine.
-
-#
-# +---------------------+ <-- 16-byte aligned ensured by processor
-# + Old SS +
-# +---------------------+
-# + Old RSP +
-# +---------------------+
-# + RFlags +
-# +---------------------+
-# + CS +
-# +---------------------+
-# + RIP +
-# +---------------------+
-# + Error Code +
-# +---------------------+
-# + RCX / Vector Number +
-# +---------------------+
-# + RBP +
-# +---------------------+ <-- RBP, 16-byte aligned
-#
-
-# We need to determine if any extra data was pushed by the exception
- cmpq $DEBUG_EXCEPT_DOUBLE_FAULT, %rcx
- je NoExtrPush
- cmpq $DEBUG_EXCEPT_INVALID_TSS, %rcx
- je NoExtrPush
- cmpq $DEBUG_EXCEPT_SEG_NOT_PRESENT, %rcx
- je NoExtrPush
- cmpq $DEBUG_EXCEPT_STACK_FAULT, %rcx
- je NoExtrPush
- cmpq $DEBUG_EXCEPT_GP_FAULT, %rcx
- je NoExtrPush
- cmpq $DEBUG_EXCEPT_PAGE_FAULT, %rcx
- je NoExtrPush
- cmpq $DEBUG_EXCEPT_ALIGNMENT_CHECK, %rcx
- je NoExtrPush
-
- pushq (%rsp)
- movq $0, 8(%rsp)
-
-NoExtrPush:
- #
- # All interrupt handlers are invoked through interrupt gates, so
- # IF flag automatically cleared at the entry point
- pushq %rbp
- movq %rsp, %rbp
-
- #
- # Since here the stack pointer is 16-byte aligned, so
- # EFI_FX_SAVE_STATE_X64 of EFI_SYSTEM_CONTEXT_x64
- # is 16-byte aligned
- #
-
-## UINT64 R8, R9, R10, R11, R12, R13, R14, R15;
- pushq %r15
- pushq %r14
- pushq %r13
- pushq %r12
- pushq %r11
- pushq %r10
- pushq %r9
- pushq %r8
-
- movq %cr8, %r8
- pushq %r8
-
-## UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;
- pushq %rax
- pushq %rbx
- pushq 8(%rbp) # original rcx
- pushq %rdx
- pushq 48(%rbp) # original rsp
- pushq (%rbp) # original rbp
- pushq %rsi
- pushq %rdi
-
-## UINT64 Cr0, Cr1, Cr2, Cr3, Cr4;
- movq %cr4, %rax
- orq $0x208, %rax
- movq %rax, %cr4
- pushq %rax
- movq %cr3, %rax
- pushq %rax
- movq %cr2, %rax
- pushq %rax
- xorq %rax, %rax
- pushq %rax
- movq %cr0, %rax
- pushq %rax
-
-## UINT64 Gs, Fs, Es, Ds, Cs, Ss; insure high 16 bits of each is zero
- xorq %rax, %rax # set rax to 0
- movzwq 56(%rbp), %rax
-# movq %ss, %rax
- pushq %rax
- movzwq 32(%rbp), %rax
-# movq %cs, %rax
- pushq %rax
- mov %ds, %rax
- pushq %rax
- mov %es, %rax
- pushq %rax
- mov %fs, %rax
- pushq %rax
- mov %gs, %rax
- pushq %rax
-
-## UINT64 Rip;
- pushq 24(%rbp)
-
-## UINT64 Gdtr[2], Idtr[2];
- subq $16, %rsp
- sidt (%rsp)
- subq $16, %rsp
- sgdt (%rsp)
-
-## UINT64 Ldtr, Tr;
- xorq %rax, %rax
- strw %ax
- pushq %rax
- sldtw %ax
- pushq %rax
-
-## UINT64 RFlags;
- pushq 40(%rbp)
-
-## UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
- movq %dr7, %rax
- pushq %rax
-## clear Dr7 while executing debugger itself
- xorq %rax, %rax
- movq %rax, %dr7
-
- movq %dr6, %rax
- pushq %rax
-## insure all status bits in dr6 are clear...
- xorq %rax, %rax
- movq %rax, %dr6
-
- movq %dr3, %rax
- pushq %rax
- movq %dr2, %rax
- pushq %rax
- movq %dr1, %rax
- pushq %rax
- movq %dr0, %rax
- pushq %rax
-
-## FX_SAVE_STATE_X64 FxSaveState;
- subq $512, %rsp
- movq %rsp, %rdi
- .byte 0x0f, 0xae, 0b00000111
-
-## save the exception data;
- pushq 16(%rbp)
-
-## Clear Direction Flag
- cld
-
-## Prepare parameter and call
-# movq 8(%rbp), %rcx
- movq %rsp, %rdx
- movq %rcx, %r15 # save vector in r15
- #
- # Per X64 calling convention, allocate maximum parameter stack space
- # and make sure RSP is 16-byte aligned
- #
- subq $(32 + 8), %rsp
- call ASM_PFX(InterruptProcess)
- addq $(32 + 8), %rsp
-
-## skip the exception data;
- addq $8, %rsp
-
-## FX_SAVE_STATE_X64 FxSaveState;
-
- movq %rsp, %rsi
- .byte 0x0f, 0xae, 0b00001110
- addq $512, %rsp
-
-## UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
- popq %rax
- movq %rax, %dr0
- popq %rax
- movq %rax, %dr1
- popq %rax
- movq %rax, %dr2
- popq %rax
- movq %rax, %dr3
-## skip restore of dr6. We cleared dr6 during the context save.
- addq $8, %rsp
- popq %rax
- movq %rax, %dr7
-
-## UINT64 RFlags;
- popq 40(%rbp)
-
-## UINT64 Ldtr, Tr;
-## UINT64 Gdtr[2], Idtr[2];
-## Best not let anyone mess with these particular registers...
- addq $48, %rsp
-
-## UINT64 Rip;
- popq 24(%rbp)
-
-## UINT64 Gs, Fs, Es, Ds, Cs, Ss;
- popq %rax
- # mov gs, rax ; not for gs
- popq %rax
- # mov fs, rax ; not for fs
- # (X64 will not use fs and gs, so we do not restore it)
- popq %rax
- mov %rax, %es
- popq %rax
- mov %rax, %ds
- popq 32(%rbp)
- popq 56(%rbp)
-
-## UINT64 Cr0, Cr1, Cr2, Cr3, Cr4, Cr8;
- popq %rax
- movq %rax, %cr0
- addq $8, %rsp
- popq %rax
- movq %rax, %cr2
- popq %rax
- movq %rax, %cr3
- popq %rax
- movq %rax, %cr4
-
-## UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;
-## UINT64 R8, R9, R10, R11, R12, R13, R14, R15;
- popq %rdi
- popq %rsi
- addq $8, %rsp
- addq $8, %rsp
- popq %rdx
- popq %rcx
- popq %rbx
- popq %rax
-
- popq %r8
- movq %r8, %cr8
-
- popq %r8
- popq %r9
- popq %r10
- popq %r11
- popq %r12
- popq %r13
- popq %r14
- popq %r15
-
- movq %rbp, %rsp
- popq %rbp
- addq $16, %rsp
- iretq
diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf b/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
index 38bd18d0fe..b309c18d88 100644
--- a/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
+++ b/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
@@ -42,14 +42,12 @@
DebugAgentCommon/DebugMp.h
[Sources.Ia32]
- DebugAgentCommon/Ia32/AsmFuncs.S
DebugAgentCommon/Ia32/AsmFuncs.nasm
DebugAgentCommon/Ia32/ArchDebugSupport.h
DebugAgentCommon/Ia32/ArchDebugSupport.c
DebugAgentCommon/Ia32/DebugException.h
[Sources.X64]
- DebugAgentCommon/X64/AsmFuncs.S
DebugAgentCommon/X64/AsmFuncs.nasm
DebugAgentCommon/X64/ArchDebugSupport.h
DebugAgentCommon/X64/ArchDebugSupport.c
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v3 12/14] SourceLevelDebugPkg/DebugAgentCommon: Remove .S files
2019-04-01 8:29 ` [PATCH v3 12/14] SourceLevelDebugPkg/DebugAgentCommon: Remove .S files Shenglei Zhang
@ 2019-04-02 1:31 ` Wu, Hao A
0 siblings, 0 replies; 18+ messages in thread
From: Wu, Hao A @ 2019-04-02 1:31 UTC (permalink / raw)
To: Zhang, Shenglei, edk2-devel@lists.01.org
> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Monday, April 01, 2019 4:30 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A
> Subject: [PATCH v3 12/14] SourceLevelDebugPkg/DebugAgentCommon:
> Remove .S files
>
> .nasm file has been added for X86 arch. .S assembly code
> is not required any more.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1594
>
> Cc: Hao Wu <hao.a.wu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> Reviewed-by: Liming Gao <liming.gao@intel.com>
> ---
> .../DebugAgentCommon/Ia32/AsmFuncs.S | 415 -----------------
> .../DebugAgentCommon/X64/AsmFuncs.S | 431 ------------------
> .../Library/DebugAgent/DxeDebugAgentLib.inf | 2 -
Please help to remove the .s file include in:
SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgentLib.inf
SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgentLib.inf
With the above changes:
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Sorry for missing this in the v2 patch.
Best Regards,
Hao Wu
> 3 files changed, 848 deletions(-)
> delete mode 100644
> SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Ia32/AsmFun
> cs.S
> delete mode 100644
> SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/X64/AsmFun
> cs.S
>
> diff --git
> a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Ia32/AsmF
> uncs.S
> b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Ia32/AsmF
> uncs.S
> deleted file mode 100644
> index 30d279e80d..0000000000
> ---
> a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Ia32/AsmF
> uncs.S
> +++ /dev/null
> @@ -1,415 +0,0 @@
> -#------------------------------------------------------------------------------
> -#
> -# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
> -# This program and the accompanying materials
> -# are licensed and made available under the terms and conditions of the BSD
> License
> -# which accompanies this distribution. The full text of the license may be
> found at
> -# http://opensource.org/licenses/bsd-license.php.
> -#
> -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> -#
> -# Module Name:
> -#
> -# AsmFuncs.S
> -#
> -# Abstract:
> -#
> -# Debug interrupt handle functions.
> -#
> -#------------------------------------------------------------------------------
> -
> -#include "DebugException.h"
> -
> -ASM_GLOBAL ASM_PFX(InterruptProcess)
> -ASM_GLOBAL ASM_PFX(Exception0Handle)
> -ASM_GLOBAL ASM_PFX(ExceptionStubHeaderSize)
> -ASM_GLOBAL ASM_PFX(TimerInterruptHandle)
> -ASM_GLOBAL ASM_PFX(CommonEntry)
> -
> -.macro AGENT_HANDLER_SIGNATURE
> - .byte 0x41, 0x47, 0x54, 0x48 # AGENT_HANDLER_SIGNATURE
> SIGNATURE_32('A','G','T','H')
> -.endm
> -
> -.data
> -
> -ASM_PFX(ExceptionStubHeaderSize): .long ASM_PFX(Exception1Handle) -
> ASM_PFX(Exception0Handle)
> -
> -.text
> -
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception0Handle):
> - cli
> - pushl %eax
> - mov $0, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception1Handle):
> - cli
> - pushl %eax
> - mov $1, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception2Handle):
> - cli
> - pushl %eax
> - mov $2, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception3Handle):
> - cli
> - pushl %eax
> - mov $3, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception4Handle):
> - cli
> - pushl %eax
> - mov $4, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception5Handle):
> - cli
> - pushl %eax
> - mov $5, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception6Handle):
> - cli
> - pushl %eax
> - mov $6, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception7Handle):
> - cli
> - pushl %eax
> - mov $7, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception8Handle):
> - cli
> - pushl %eax
> - mov $8, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception9Handle):
> - cli
> - pushl %eax
> - mov $9, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception10Handle):
> - cli
> - pushl %eax
> - mov $10, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception11Handle):
> - cli
> - pushl %eax
> - mov $11, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception12Handle):
> - cli
> - pushl %eax
> - mov $12, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception13Handle):
> - cli
> - pushl %eax
> - mov $13, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception14Handle):
> - cli
> - pushl %eax
> - mov $14, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception15Handle):
> - cli
> - pushl %eax
> - mov $15, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception16Handle):
> - cli
> - pushl %eax
> - mov $16, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception17Handle):
> - cli
> - pushl %eax
> - mov $17, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception18Handle):
> - cli
> - pushl %eax
> - mov $18, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception19Handle):
> - cli
> - pushl %eax
> - mov $19, %eax
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(TimerInterruptHandle):
> - cli
> - pushl %eax
> - mov $32, %eax
> - jmp ASM_PFX(CommonEntry)
> -
> -
> -ASM_PFX(CommonEntry):
> -
> -#---------------------------------------;
> -# _CommonEntry ;
> -#----------------------------------------------------------------------------;
> -# The follow algorithm is used for the common interrupt routine.
> -# Entry from each interrupt with a push eax and eax=interrupt number
> -#
> -# +---------------------+
> -# + EFlags +
> -# +---------------------+
> -# + CS +
> -# +---------------------+
> -# + EIP +
> -# +---------------------+
> -# + Error Code +
> -# +---------------------+
> -# + EAX / Vector Number +
> -# +---------------------+
> -# + EBP +
> -# +---------------------+ <-- EBP
> -#
> -
> -# We need to determine if any extra data was pushed by the exception
> - cmpl $DEBUG_EXCEPT_DOUBLE_FAULT, %eax
> - je NoExtrPush
> - cmpl $DEBUG_EXCEPT_INVALID_TSS, %eax
> - je NoExtrPush
> - cmpl $DEBUG_EXCEPT_SEG_NOT_PRESENT, %eax
> - je NoExtrPush
> - cmpl $DEBUG_EXCEPT_STACK_FAULT, %eax
> - je NoExtrPush
> - cmpl $DEBUG_EXCEPT_GP_FAULT, %eax
> - je NoExtrPush
> - cmpl $DEBUG_EXCEPT_PAGE_FAULT, %eax
> - je NoExtrPush
> - cmpl $DEBUG_EXCEPT_ALIGNMENT_CHECK, %eax
> - je NoExtrPush
> -
> - pushl (%esp)
> - movl $0, 4(%esp)
> -
> -NoExtrPush:
> -
> - pushl %ebp
> - movl %esp,%ebp
> -
> - #
> - # Align stack to make sure that EFI_FX_SAVE_STATE_IA32 of
> EFI_SYSTEM_CONTEXT_IA32
> - # is 16-byte aligned
> - #
> - andl $0xfffffff0,%esp
> - subl $12,%esp
> -
> -## UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
> - pushl 0x4(%ebp)
> - pushl %ebx
> - pushl %ecx
> - pushl %edx
> - mov %eax, %ebx # save vector in ebx
> - leal 24(%ebp),%ecx
> - pushl %ecx # save original ESP
> - pushl (%ebp)
> - pushl %esi
> - pushl %edi
> -
> -## UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
> -## insure FXSAVE/FXRSTOR is enabled in CR4...
> -## ... while we're at it, make sure DE is also enabled...
> - mov $1, %eax
> - pushl %ebx # temporarily save value of ebx on stack
> - cpuid # use CPUID to determine if FXSAVE/FXRESTOR
> - # and DE are supported
> - popl %ebx # retore value of ebx that was overwritten
> - # by CPUID
> - movl %cr4, %eax
> - pushl %eax # push cr4 firstly
> - testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support
> - jz L1
> - orl $BIT9, %eax # Set CR4.OSFXSR
> -L1:
> - testl $BIT2, %edx # Test for Debugging Extensions support
> - jz L2
> - orl $BIT3, %eax # Set CR4.DE
> -L2:
> - movl %eax, %cr4
> - movl %cr3, %eax
> - pushl %eax
> - movl %cr2, %eax
> - pushl %eax
> - xorl %eax,%eax
> - pushl %eax
> - movl %cr0, %eax
> - pushl %eax
> -
> -## UINT32 Gs, Fs, Es, Ds, Cs, Ss;
> - movl %ss,%eax
> - pushl %eax
> - movzwl 16(%ebp), %eax
> - pushl %eax
> - movl %ds,%eax
> - pushl %eax
> - movl %es,%eax
> - pushl %eax
> - movl %fs,%eax
> - pushl %eax
> - movl %gs,%eax
> - pushl %eax
> -
> -## UINT32 Eip;
> - pushl 12(%ebp)
> -
> -## UINT32 Gdtr[2], Idtr[2];
> - subl $8,%esp
> - sidt (%esp)
> - subl $8,%esp
> - sgdt (%esp)
> -
> -## UINT32 Ldtr, Tr;
> - xorl %eax,%eax
> - strl %eax
> - pushl %eax
> - sldtl %eax
> - pushl %eax
> -
> -## UINT32 EFlags;
> - pushl 20(%ebp)
> -
> -## UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
> - movl %dr7, %eax
> - pushl %eax
> -## clear Dr7 while executing debugger itself
> - xorl %eax,%eax
> - movl %eax, %dr7
> -
> - movl %dr6, %eax
> - pushl %eax
> -## insure all status bits in dr6 are clear...
> - xorl %eax,%eax
> - movl %eax, %dr6
> -
> - movl %dr3, %eax
> - pushl %eax
> - movl %dr2, %eax
> - pushl %eax
> - movl %dr1, %eax
> - pushl %eax
> - movl %dr0, %eax
> - pushl %eax
> -
> -## FX_SAVE_STATE_IA32 FxSaveState;
> - subl $512,%esp
> - movl %esp,%edi
> - testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support.
> - # edx still contains result from CPUID above
> - jz L3
> - .byte 0x0f, 0xae, 0x07 # fxsave [edi]
> -L3:
> -
> -## save the exception data
> - pushl 8(%esp)
> -
> -## Clear Direction Flag
> - cld
> -
> -## Prepare parameter and call C function
> - pushl %esp
> - pushl %ebx
> - call ASM_PFX(InterruptProcess)
> - addl $8,%esp
> -
> -## skip the exception data
> - addl $4,%esp
> -
> -## FX_SAVE_STATE_IA32 FxSaveState;
> - movl %esp,%esi
> - movl $1, %eax
> - cpuid # use CPUID to determine if FXSAVE/FXRESTOR
> - # are supported
> - testl $BIT24, %edx # Test for FXSAVE/FXRESTOR support
> - jz L4
> - .byte 0x0f, 0xae, 0x0e # fxrstor [esi]
> -L4:
> - addl $512,%esp
> -
> -## UINT32 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
> - popl %eax
> - movl %eax, %dr0
> - popl %eax
> - movl %eax, %dr1
> - popl %eax
> - movl %eax, %dr2
> - popl %eax
> - movl %eax, %dr3
> -## skip restore of dr6. We cleared dr6 during the context save.
> - addl $4,%esp
> - popl %eax
> - movl %eax, %dr7
> -
> -## UINT32 EFlags;
> - popl 20(%ebp)
> -
> -## UINT32 Ldtr, Tr;
> -## UINT32 Gdtr[2], Idtr[2];
> -## Best not let anyone mess with these particular registers...
> - addl $24,%esp
> -
> -## UINT32 Eip;
> - pop 12(%ebp)
> -
> -## UINT32 Gs, Fs, Es, Ds, Cs, Ss;
> -## NOTE - modified segment registers could hang the debugger... We
> -## could attempt to insulate ourselves against this possibility,
> -## but that poses risks as well.
> -##
> - popl %gs
> - popl %fs
> - popl %es
> - popl %ds
> - popl 16(%ebp)
> - popl %ss
> -
> -## UINT32 Cr0, Cr1, Cr2, Cr3, Cr4;
> - popl %eax
> - movl %eax, %cr0
> - addl $4,%esp # not for Cr1
> - popl %eax
> - movl %eax, %cr2
> - popl %eax
> - movl %eax, %cr3
> - popl %eax
> - movl %eax, %cr4
> -
> -## UINT32 Edi, Esi, Ebp, Esp, Ebx, Edx, Ecx, Eax;
> - popl %edi
> - popl %esi
> - addl $4,%esp # not for ebp
> - addl $4,%esp # not for esp
> - popl %edx
> - popl %ecx
> - popl %ebx
> - popl %eax
> -
> - movl %ebp,%esp
> - popl %ebp
> - addl $8,%esp # skip eax
> - iretl
> -
> diff --git
> a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/X64/AsmFu
> ncs.S
> b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/X64/AsmFu
> ncs.S
> deleted file mode 100644
> index cdda41fb27..0000000000
> ---
> a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/X64/AsmFu
> ncs.S
> +++ /dev/null
> @@ -1,431 +0,0 @@
> -#------------------------------------------------------------------------------
> -#
> -# Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
> -# This program and the accompanying materials
> -# are licensed and made available under the terms and conditions of the BSD
> License
> -# which accompanies this distribution. The full text of the license may be
> found at
> -# http://opensource.org/licenses/bsd-license.php.
> -#
> -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> -#
> -# Module Name:
> -#
> -# AsmFuncs.S
> -#
> -# Abstract:
> -#
> -# Debug interrupt handle functions.
> -#
> -#------------------------------------------------------------------------------
> -
> -#include "DebugException.h"
> -
> -ASM_GLOBAL ASM_PFX(InterruptProcess)
> -
> -ASM_GLOBAL ASM_PFX(Exception0Handle)
> -ASM_GLOBAL ASM_PFX(ExceptionStubHeaderSize)
> -ASM_GLOBAL ASM_PFX(TimerInterruptHandle)
> -ASM_GLOBAL ASM_PFX(CommonEntry)
> -
> -.macro AGENT_HANDLER_SIGNATURE
> - .byte 0x41, 0x47, 0x54, 0x48 # AGENT_HANDLER_SIGNATURE
> SIGNATURE_32('A','G','T','H')
> -.endm
> -
> -.data
> -
> -ASM_PFX(ExceptionStubHeaderSize): .long ASM_PFX(Exception1Handle) -
> ASM_PFX(Exception0Handle)
> -
> -
> -.text
> -
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception0Handle):
> - cli
> - pushq %rcx
> - mov $0, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception1Handle):
> - cli
> - pushq %rcx
> - mov $1, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception2Handle):
> - cli
> - pushq %rcx
> - mov $2, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception3Handle):
> - cli
> - pushq %rcx
> - mov $3, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception4Handle):
> - cli
> - pushq %rcx
> - mov $4, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception5Handle):
> - cli
> - pushq %rcx
> - mov $5, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception6Handle):
> - cli
> - pushq %rcx
> - mov $6, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception7Handle):
> - cli
> - pushq %rcx
> - mov $7, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception8Handle):
> - cli
> - pushq %rcx
> - mov $8, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception9Handle):
> - cli
> - pushq %rcx
> - mov $9, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception10Handle):
> - cli
> - pushq %rcx
> - mov $10, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception11Handle):
> - cli
> - pushq %rcx
> - mov $11, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception12Handle):
> - cli
> - pushq %rcx
> - mov $12, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception13Handle):
> - cli
> - pushq %rcx
> - mov $13, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception14Handle):
> - cli
> - pushq %rcx
> - mov $14, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception15Handle):
> - cli
> - pushq %rcx
> - mov $15, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception16Handle):
> - cli
> - pushq %rcx
> - mov $16, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception17Handle):
> - cli
> - pushq %rcx
> - mov $17, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception18Handle):
> - cli
> - pushq %rcx
> - mov $18, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(Exception19Handle):
> - cli
> - pushq %rcx
> - mov $19, %rcx
> - jmp ASM_PFX(CommonEntry)
> -AGENT_HANDLER_SIGNATURE
> -ASM_PFX(TimerInterruptHandle):
> - cli
> - pushq %rcx
> - mov $32, %rcx
> - jmp ASM_PFX(CommonEntry)
> -
> -
> -ASM_PFX(CommonEntry):
> -
> -#---------------------------------------;
> -# CommonInterruptEntry ;
> -#---------------------------------------;
> -# The follow algorithm is used for the common interrupt routine.
> -
> -#
> -# +---------------------+ <-- 16-byte aligned ensured by processor
> -# + Old SS +
> -# +---------------------+
> -# + Old RSP +
> -# +---------------------+
> -# + RFlags +
> -# +---------------------+
> -# + CS +
> -# +---------------------+
> -# + RIP +
> -# +---------------------+
> -# + Error Code +
> -# +---------------------+
> -# + RCX / Vector Number +
> -# +---------------------+
> -# + RBP +
> -# +---------------------+ <-- RBP, 16-byte aligned
> -#
> -
> -# We need to determine if any extra data was pushed by the exception
> - cmpq $DEBUG_EXCEPT_DOUBLE_FAULT, %rcx
> - je NoExtrPush
> - cmpq $DEBUG_EXCEPT_INVALID_TSS, %rcx
> - je NoExtrPush
> - cmpq $DEBUG_EXCEPT_SEG_NOT_PRESENT, %rcx
> - je NoExtrPush
> - cmpq $DEBUG_EXCEPT_STACK_FAULT, %rcx
> - je NoExtrPush
> - cmpq $DEBUG_EXCEPT_GP_FAULT, %rcx
> - je NoExtrPush
> - cmpq $DEBUG_EXCEPT_PAGE_FAULT, %rcx
> - je NoExtrPush
> - cmpq $DEBUG_EXCEPT_ALIGNMENT_CHECK, %rcx
> - je NoExtrPush
> -
> - pushq (%rsp)
> - movq $0, 8(%rsp)
> -
> -NoExtrPush:
> - #
> - # All interrupt handlers are invoked through interrupt gates, so
> - # IF flag automatically cleared at the entry point
> - pushq %rbp
> - movq %rsp, %rbp
> -
> - #
> - # Since here the stack pointer is 16-byte aligned, so
> - # EFI_FX_SAVE_STATE_X64 of EFI_SYSTEM_CONTEXT_x64
> - # is 16-byte aligned
> - #
> -
> -## UINT64 R8, R9, R10, R11, R12, R13, R14, R15;
> - pushq %r15
> - pushq %r14
> - pushq %r13
> - pushq %r12
> - pushq %r11
> - pushq %r10
> - pushq %r9
> - pushq %r8
> -
> - movq %cr8, %r8
> - pushq %r8
> -
> -## UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;
> - pushq %rax
> - pushq %rbx
> - pushq 8(%rbp) # original rcx
> - pushq %rdx
> - pushq 48(%rbp) # original rsp
> - pushq (%rbp) # original rbp
> - pushq %rsi
> - pushq %rdi
> -
> -## UINT64 Cr0, Cr1, Cr2, Cr3, Cr4;
> - movq %cr4, %rax
> - orq $0x208, %rax
> - movq %rax, %cr4
> - pushq %rax
> - movq %cr3, %rax
> - pushq %rax
> - movq %cr2, %rax
> - pushq %rax
> - xorq %rax, %rax
> - pushq %rax
> - movq %cr0, %rax
> - pushq %rax
> -
> -## UINT64 Gs, Fs, Es, Ds, Cs, Ss; insure high 16 bits of each is zero
> - xorq %rax, %rax # set rax to 0
> - movzwq 56(%rbp), %rax
> -# movq %ss, %rax
> - pushq %rax
> - movzwq 32(%rbp), %rax
> -# movq %cs, %rax
> - pushq %rax
> - mov %ds, %rax
> - pushq %rax
> - mov %es, %rax
> - pushq %rax
> - mov %fs, %rax
> - pushq %rax
> - mov %gs, %rax
> - pushq %rax
> -
> -## UINT64 Rip;
> - pushq 24(%rbp)
> -
> -## UINT64 Gdtr[2], Idtr[2];
> - subq $16, %rsp
> - sidt (%rsp)
> - subq $16, %rsp
> - sgdt (%rsp)
> -
> -## UINT64 Ldtr, Tr;
> - xorq %rax, %rax
> - strw %ax
> - pushq %rax
> - sldtw %ax
> - pushq %rax
> -
> -## UINT64 RFlags;
> - pushq 40(%rbp)
> -
> -## UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
> - movq %dr7, %rax
> - pushq %rax
> -## clear Dr7 while executing debugger itself
> - xorq %rax, %rax
> - movq %rax, %dr7
> -
> - movq %dr6, %rax
> - pushq %rax
> -## insure all status bits in dr6 are clear...
> - xorq %rax, %rax
> - movq %rax, %dr6
> -
> - movq %dr3, %rax
> - pushq %rax
> - movq %dr2, %rax
> - pushq %rax
> - movq %dr1, %rax
> - pushq %rax
> - movq %dr0, %rax
> - pushq %rax
> -
> -## FX_SAVE_STATE_X64 FxSaveState;
> - subq $512, %rsp
> - movq %rsp, %rdi
> - .byte 0x0f, 0xae, 0b00000111
> -
> -## save the exception data;
> - pushq 16(%rbp)
> -
> -## Clear Direction Flag
> - cld
> -
> -## Prepare parameter and call
> -# movq 8(%rbp), %rcx
> - movq %rsp, %rdx
> - movq %rcx, %r15 # save vector in r15
> - #
> - # Per X64 calling convention, allocate maximum parameter stack space
> - # and make sure RSP is 16-byte aligned
> - #
> - subq $(32 + 8), %rsp
> - call ASM_PFX(InterruptProcess)
> - addq $(32 + 8), %rsp
> -
> -## skip the exception data;
> - addq $8, %rsp
> -
> -## FX_SAVE_STATE_X64 FxSaveState;
> -
> - movq %rsp, %rsi
> - .byte 0x0f, 0xae, 0b00001110
> - addq $512, %rsp
> -
> -## UINT64 Dr0, Dr1, Dr2, Dr3, Dr6, Dr7;
> - popq %rax
> - movq %rax, %dr0
> - popq %rax
> - movq %rax, %dr1
> - popq %rax
> - movq %rax, %dr2
> - popq %rax
> - movq %rax, %dr3
> -## skip restore of dr6. We cleared dr6 during the context save.
> - addq $8, %rsp
> - popq %rax
> - movq %rax, %dr7
> -
> -## UINT64 RFlags;
> - popq 40(%rbp)
> -
> -## UINT64 Ldtr, Tr;
> -## UINT64 Gdtr[2], Idtr[2];
> -## Best not let anyone mess with these particular registers...
> - addq $48, %rsp
> -
> -## UINT64 Rip;
> - popq 24(%rbp)
> -
> -## UINT64 Gs, Fs, Es, Ds, Cs, Ss;
> - popq %rax
> - # mov gs, rax ; not for gs
> - popq %rax
> - # mov fs, rax ; not for fs
> - # (X64 will not use fs and gs, so we do not restore it)
> - popq %rax
> - mov %rax, %es
> - popq %rax
> - mov %rax, %ds
> - popq 32(%rbp)
> - popq 56(%rbp)
> -
> -## UINT64 Cr0, Cr1, Cr2, Cr3, Cr4, Cr8;
> - popq %rax
> - movq %rax, %cr0
> - addq $8, %rsp
> - popq %rax
> - movq %rax, %cr2
> - popq %rax
> - movq %rax, %cr3
> - popq %rax
> - movq %rax, %cr4
> -
> -## UINT64 Rdi, Rsi, Rbp, Rsp, Rbx, Rdx, Rcx, Rax;
> -## UINT64 R8, R9, R10, R11, R12, R13, R14, R15;
> - popq %rdi
> - popq %rsi
> - addq $8, %rsp
> - addq $8, %rsp
> - popq %rdx
> - popq %rcx
> - popq %rbx
> - popq %rax
> -
> - popq %r8
> - movq %r8, %cr8
> -
> - popq %r8
> - popq %r9
> - popq %r10
> - popq %r11
> - popq %r12
> - popq %r13
> - popq %r14
> - popq %r15
> -
> - movq %rbp, %rsp
> - popq %rbp
> - addq $16, %rsp
> - iretq
> diff --git a/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
> b/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
> index 38bd18d0fe..b309c18d88 100644
> --- a/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
> +++ b/SourceLevelDebugPkg/Library/DebugAgent/DxeDebugAgentLib.inf
> @@ -42,14 +42,12 @@
> DebugAgentCommon/DebugMp.h
>
> [Sources.Ia32]
> - DebugAgentCommon/Ia32/AsmFuncs.S
> DebugAgentCommon/Ia32/AsmFuncs.nasm
> DebugAgentCommon/Ia32/ArchDebugSupport.h
> DebugAgentCommon/Ia32/ArchDebugSupport.c
> DebugAgentCommon/Ia32/DebugException.h
>
> [Sources.X64]
> - DebugAgentCommon/X64/AsmFuncs.S
> DebugAgentCommon/X64/AsmFuncs.nasm
> DebugAgentCommon/X64/ArchDebugSupport.h
> DebugAgentCommon/X64/ArchDebugSupport.c
> --
> 2.18.0.windows.1
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v4 13/14] SourceLevelDebugPkg/PeCoffExtraActionLibDebug: Remove .S files
2019-04-01 8:29 [PATCH v4 00/14] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg Shenglei Zhang
` (11 preceding siblings ...)
2019-04-01 8:29 ` [PATCH v3 12/14] SourceLevelDebugPkg/DebugAgentCommon: Remove .S files Shenglei Zhang
@ 2019-04-01 8:29 ` Shenglei Zhang
2019-04-02 1:33 ` Wu, Hao A
2019-04-01 8:29 ` [PATCH v4 14/14] CorebootModulePkg/SecCore: Remove .S files for IA32 arch Shenglei Zhang
13 siblings, 1 reply; 18+ messages in thread
From: Shenglei Zhang @ 2019-04-01 8:29 UTC (permalink / raw)
To: edk2-devel; +Cc: Hao Wu
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
.../Ia32/IntHandler.S | 28 -------------------
| 2 --
.../X64/IntHandler.S | 28 -------------------
3 files changed, 58 deletions(-)
delete mode 100644 SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/Ia32/IntHandler.S
delete mode 100644 SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/X64/IntHandler.S
diff --git a/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/Ia32/IntHandler.S b/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/Ia32/IntHandler.S
deleted file mode 100644
index 69c903788c..0000000000
--- a/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/Ia32/IntHandler.S
+++ /dev/null
@@ -1,28 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# IntHandler.S
-#
-# Abstract:
-#
-# Assembly interrupt handler function.
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(AsmInterruptHandle)
-
-.text
-ASM_PFX(AsmInterruptHandle):
- cli
- movb $1, %al
- iretl
--git a/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf b/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
index 1c52a000b0..fd56b8c94a 100644
--- a/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
+++ b/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraActionLibDebug.inf
@@ -35,12 +35,10 @@
[Sources.IA32]
Ia32/IntHandlerFuncs.c
Ia32/IntHandler.nasm
- Ia32/IntHandler.S
[Sources.X64]
X64/IntHandlerFuncs.c
X64/IntHandler.nasm
- X64/IntHandler.S
[Packages]
MdePkg/MdePkg.dec
diff --git a/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/X64/IntHandler.S b/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/X64/IntHandler.S
deleted file mode 100644
index 108b40cf6d..0000000000
--- a/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/X64/IntHandler.S
+++ /dev/null
@@ -1,28 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# IntHandler.S
-#
-# Abstract:
-#
-# Assembly interrupt handler function.
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(AsmInterruptHandle)
-
-.text
-ASM_PFX(AsmInterruptHandle):
- cli
- movb $1, %al
- iretq
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v4 13/14] SourceLevelDebugPkg/PeCoffExtraActionLibDebug: Remove .S files
2019-04-01 8:29 ` [PATCH v4 13/14] SourceLevelDebugPkg/PeCoffExtraActionLibDebug: " Shenglei Zhang
@ 2019-04-02 1:33 ` Wu, Hao A
0 siblings, 0 replies; 18+ messages in thread
From: Wu, Hao A @ 2019-04-02 1:33 UTC (permalink / raw)
To: Zhang, Shenglei, edk2-devel@lists.01.org
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Best Regards,
Hao Wu
> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Monday, April 01, 2019 4:30 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A
> Subject: [PATCH v4 13/14] SourceLevelDebugPkg/PeCoffExtraActionLibDebug:
> Remove .S files
>
> .nasm file has been added for X86 arch. .S assembly code
> is not required any more.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1594
>
> Cc: Hao Wu <hao.a.wu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
> .../Ia32/IntHandler.S | 28 -------------------
> .../PeCoffExtraActionLibDebug.inf | 2 --
> .../X64/IntHandler.S | 28 -------------------
> 3 files changed, 58 deletions(-)
> delete mode 100644
> SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/Ia32/IntHandler.S
> delete mode 100644
> SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/X64/IntHandler.S
>
> diff --git
> a/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/Ia32/IntHandler.S
> b/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/Ia32/IntHandler.S
> deleted file mode 100644
> index 69c903788c..0000000000
> ---
> a/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/Ia32/IntHandler.S
> +++ /dev/null
> @@ -1,28 +0,0 @@
> -#------------------------------------------------------------------------------
> -#
> -# Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
> -# This program and the accompanying materials
> -# are licensed and made available under the terms and conditions of the BSD
> License
> -# which accompanies this distribution. The full text of the license may be
> found at
> -# http://opensource.org/licenses/bsd-license.php.
> -#
> -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> -#
> -# Module Name:
> -#
> -# IntHandler.S
> -#
> -# Abstract:
> -#
> -# Assembly interrupt handler function.
> -#
> -#------------------------------------------------------------------------------
> -
> -ASM_GLOBAL ASM_PFX(AsmInterruptHandle)
> -
> -.text
> -ASM_PFX(AsmInterruptHandle):
> - cli
> - movb $1, %al
> - iretl
> diff --git
> a/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraAction
> LibDebug.inf
> b/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraAction
> LibDebug.inf
> index 1c52a000b0..fd56b8c94a 100644
> ---
> a/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraAction
> LibDebug.inf
> +++
> b/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/PeCoffExtraAction
> LibDebug.inf
> @@ -35,12 +35,10 @@
> [Sources.IA32]
> Ia32/IntHandlerFuncs.c
> Ia32/IntHandler.nasm
> - Ia32/IntHandler.S
>
> [Sources.X64]
> X64/IntHandlerFuncs.c
> X64/IntHandler.nasm
> - X64/IntHandler.S
>
> [Packages]
> MdePkg/MdePkg.dec
> diff --git
> a/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/X64/IntHandler.S
> b/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/X64/IntHandler.S
> deleted file mode 100644
> index 108b40cf6d..0000000000
> ---
> a/SourceLevelDebugPkg/Library/PeCoffExtraActionLibDebug/X64/IntHandler.S
> +++ /dev/null
> @@ -1,28 +0,0 @@
> -#------------------------------------------------------------------------------
> -#
> -# Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
> -# This program and the accompanying materials
> -# are licensed and made available under the terms and conditions of the BSD
> License
> -# which accompanies this distribution. The full text of the license may be
> found at
> -# http://opensource.org/licenses/bsd-license.php.
> -#
> -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS,
> -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
> EXPRESS OR IMPLIED.
> -#
> -# Module Name:
> -#
> -# IntHandler.S
> -#
> -# Abstract:
> -#
> -# Assembly interrupt handler function.
> -#
> -#------------------------------------------------------------------------------
> -
> -ASM_GLOBAL ASM_PFX(AsmInterruptHandle)
> -
> -.text
> -ASM_PFX(AsmInterruptHandle):
> - cli
> - movb $1, %al
> - iretq
> --
> 2.18.0.windows.1
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH v4 14/14] CorebootModulePkg/SecCore: Remove .S files for IA32 arch
2019-04-01 8:29 [PATCH v4 00/14] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg Shenglei Zhang
` (12 preceding siblings ...)
2019-04-01 8:29 ` [PATCH v4 13/14] SourceLevelDebugPkg/PeCoffExtraActionLibDebug: " Shenglei Zhang
@ 2019-04-01 8:29 ` Shenglei Zhang
2019-04-02 3:25 ` Ma, Maurice
13 siblings, 1 reply; 18+ messages in thread
From: Shenglei Zhang @ 2019-04-01 8:29 UTC (permalink / raw)
To: edk2-devel
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
---
CorebootModulePkg/SecCore/Ia32/SecEntry.S | 74 ---------------------
CorebootModulePkg/SecCore/Ia32/Stack.S | 78 -----------------------
2 files changed, 152 deletions(-)
delete mode 100644 CorebootModulePkg/SecCore/Ia32/SecEntry.S
delete mode 100644 CorebootModulePkg/SecCore/Ia32/Stack.S
diff --git a/CorebootModulePkg/SecCore/Ia32/SecEntry.S b/CorebootModulePkg/SecCore/Ia32/SecEntry.S
deleted file mode 100644
index 3a3f76ed6b..0000000000
--- a/CorebootModulePkg/SecCore/Ia32/SecEntry.S
+++ /dev/null
@@ -1,74 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-# SecEntry.S
-#
-# Abstract:
-#
-# This is the code that begins in protected mode.
-# It will transfer the control to pei core.
-#
-#------------------------------------------------------------------------------
-
-ASM_GLOBAL ASM_PFX(SecStartup)
-
-# Pcds
-ASM_GLOBAL ASM_PFX(PcdGet32 (PcdPayloadFdMemBase))
-
-#
-# SecCore Entry Point
-#
-# Processor is in flat protected mode
-#
-# @param[in] EAX Initial value of the EAX register (BIST: Built-in Self Test)
-# @param[in] DI 'BP': boot-strap processor, or 'AP': application processor
-# @param[in] EBP Pointer to the start of the Boot Firmware Volume
-#
-# @return None This routine does not return
-#
-ASM_GLOBAL ASM_PFX(_ModuleEntryPoint)
-ASM_PFX(_ModuleEntryPoint):
- #
- # Disable all the interrupts
- #
- cli
-
- #
- # Construct the temporary memory at 0x80000, length 0x10000
- #
- movl $(BASE_512KB + SIZE_64KB), %esp
-
- #
- # Pass BFV into the PEI Core
- #
- pushl ASM_PFX(PcdGet32 (PcdPayloadFdMemBase))
-
- #
- # Pass stack base into the PEI Core
- #
- pushl $BASE_512KB
-
- #
- # Pass stack size into the PEI Core
- #
- pushl $SIZE_64KB
-
- #
- # Pass Control into the PEI Core
- #
- call SecStartup
-
- #
- # Never return to here
- #
- jmp .
diff --git a/CorebootModulePkg/SecCore/Ia32/Stack.S b/CorebootModulePkg/SecCore/Ia32/Stack.S
deleted file mode 100644
index 6a8e0e4b15..0000000000
--- a/CorebootModulePkg/SecCore/Ia32/Stack.S
+++ /dev/null
@@ -1,78 +0,0 @@
-#------------------------------------------------------------------------------
-#
-# Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution. The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Abstract:
-#
-# Switch the stack from temporary memory to permanent memory.
-#
-#------------------------------------------------------------------------------
-
-
-#------------------------------------------------------------------------------
-# VOID
-# EFIAPI
-# SecSwitchStack (
-# UINT32 TemporaryMemoryBase,
-# UINT32 PermenentMemoryBase
-# )#
-#------------------------------------------------------------------------------
-ASM_GLOBAL ASM_PFX (SecSwitchStack)
-ASM_PFX(SecSwitchStack):
- #
- # Save standard registers so they can be used to change stack
- #
- pushl %eax
- pushl %ebx
- pushl %ecx
- pushl %edx
-
- #
- # !!CAUTION!! this function address's is pushed into stack after
- # migration of whole temporary memory, so need save it to permanent
- # memory at first!
- #
- movl 20(%esp), %ebx # Save the first parameter
- movl 24(%esp), %ecx # Save the second parameter
-
- #
- # Save this function's return address into permanent memory at first.
- # Then, Fixup the esp point to permanent memory
- #
- movl %esp, %eax
- subl %ebx, %eax
- addl %ecx, %eax
- movl 0(%esp), %edx # copy pushed register's value to permanent memory
- movl %edx, 0(%eax)
- movl 4(%esp), %edx
- movl %edx, 4(%eax)
- movl 8(%esp), %edx
- movl %edx, 8(%eax)
- movl 12(%esp), %edx
- movl %edx, 12(%eax)
- movl 16(%esp), %edx # Update this function's return address into permanent memory
- movl %edx, 16(%eax)
- movl %eax, %esp # From now, esp is pointed to permanent memory
-
- #
- # Fixup the ebp point to permanent memory
- #
- movl %ebp, %eax
- subl %ebx, %eax
- addl %ecx, %eax
- movl %eax, %ebp # From now, ebp is pointed to permanent memory
-
- popl %edx
- popl %ecx
- popl %ebx
- popl %eax
- ret
-
-
--
2.18.0.windows.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH v4 14/14] CorebootModulePkg/SecCore: Remove .S files for IA32 arch
2019-04-01 8:29 ` [PATCH v4 14/14] CorebootModulePkg/SecCore: Remove .S files for IA32 arch Shenglei Zhang
@ 2019-04-02 3:25 ` Ma, Maurice
0 siblings, 0 replies; 18+ messages in thread
From: Ma, Maurice @ 2019-04-02 3:25 UTC (permalink / raw)
To: Zhang, Shenglei; +Cc: Agyeman, Prince, You, Benjamin, edk2-devel@lists.01.org
Looks good to me!
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
Thanks
Maurice
> -----Original Message-----
> From: Zhang, Shenglei
> Sent: Monday, April 1, 2019 1:30
> To: edk2-devel@lists.01.org
> Cc: Ma, Maurice <maurice.ma@intel.com>; Agyeman, Prince
> <prince.agyeman@intel.com>; You, Benjamin <benjamin.you@intel.com>
> Subject: [PATCH v4 14/14] CorebootModulePkg/SecCore: Remove .S files for
> IA32 arch
>
> .nasm file has been added for X86 arch. .S assembly code is not required any
> more.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1594
>
> Cc: Maurice Ma <maurice.ma@intel.com>
> Cc: Prince Agyeman <prince.agyeman@intel.com>
> Cc: Benjamin You <benjamin.you@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
> CorebootModulePkg/SecCore/Ia32/SecEntry.S | 74 ---------------------
> CorebootModulePkg/SecCore/Ia32/Stack.S | 78 -----------------------
> 2 files changed, 152 deletions(-)
> delete mode 100644 CorebootModulePkg/SecCore/Ia32/SecEntry.S
> delete mode 100644 CorebootModulePkg/SecCore/Ia32/Stack.S
>
> diff --git a/CorebootModulePkg/SecCore/Ia32/SecEntry.S
> b/CorebootModulePkg/SecCore/Ia32/SecEntry.S
> deleted file mode 100644
> index 3a3f76ed6b..0000000000
> --- a/CorebootModulePkg/SecCore/Ia32/SecEntry.S
> +++ /dev/null
> @@ -1,74 +0,0 @@
> -#------------------------------------------------------------------------------
> -#
> -# Copyright (c) 2013, Intel Corporation. All rights reserved.<BR> -# This
> program and the accompanying materials -# are licensed and made available
> under the terms and conditions of the BSD License -# which accompanies this
> distribution. The full text of the license may be found at -#
> http://opensource.org/licenses/bsd-license.php.
> -#
> -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> EITHER EXPRESS OR IMPLIED.
> -#
> -# Module Name:
> -#
> -# SecEntry.S
> -#
> -# Abstract:
> -#
> -# This is the code that begins in protected mode.
> -# It will transfer the control to pei core.
> -#
> -#------------------------------------------------------------------------------
> -
> -ASM_GLOBAL ASM_PFX(SecStartup)
> -
> -# Pcds
> -ASM_GLOBAL ASM_PFX(PcdGet32 (PcdPayloadFdMemBase))
> -
> -#
> -# SecCore Entry Point
> -#
> -# Processor is in flat protected mode
> -#
> -# @param[in] EAX Initial value of the EAX register (BIST: Built-in Self Test)
> -# @param[in] DI 'BP': boot-strap processor, or 'AP': application processor
> -# @param[in] EBP Pointer to the start of the Boot Firmware Volume
> -#
> -# @return None This routine does not return
> -#
> -ASM_GLOBAL ASM_PFX(_ModuleEntryPoint)
> -ASM_PFX(_ModuleEntryPoint):
> - #
> - # Disable all the interrupts
> - #
> - cli
> -
> - #
> - # Construct the temporary memory at 0x80000, length 0x10000
> - #
> - movl $(BASE_512KB + SIZE_64KB), %esp
> -
> - #
> - # Pass BFV into the PEI Core
> - #
> - pushl ASM_PFX(PcdGet32 (PcdPayloadFdMemBase))
> -
> - #
> - # Pass stack base into the PEI Core
> - #
> - pushl $BASE_512KB
> -
> - #
> - # Pass stack size into the PEI Core
> - #
> - pushl $SIZE_64KB
> -
> - #
> - # Pass Control into the PEI Core
> - #
> - call SecStartup
> -
> - #
> - # Never return to here
> - #
> - jmp .
> diff --git a/CorebootModulePkg/SecCore/Ia32/Stack.S
> b/CorebootModulePkg/SecCore/Ia32/Stack.S
> deleted file mode 100644
> index 6a8e0e4b15..0000000000
> --- a/CorebootModulePkg/SecCore/Ia32/Stack.S
> +++ /dev/null
> @@ -1,78 +0,0 @@
> -#------------------------------------------------------------------------------
> -#
> -# Copyright (c) 2013, Intel Corporation. All rights reserved.<BR> -# This
> program and the accompanying materials -# are licensed and made available
> under the terms and conditions of the BSD License -# which accompanies this
> distribution. The full text of the license may be found at -#
> http://opensource.org/licenses/bsd-license.php.
> -#
> -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
> BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND,
> EITHER EXPRESS OR IMPLIED.
> -#
> -# Abstract:
> -#
> -# Switch the stack from temporary memory to permanent memory.
> -#
> -#------------------------------------------------------------------------------
> -
> -
> -#------------------------------------------------------------------------------
> -# VOID
> -# EFIAPI
> -# SecSwitchStack (
> -# UINT32 TemporaryMemoryBase,
> -# UINT32 PermenentMemoryBase
> -# )#
> -#------------------------------------------------------------------------------
> -ASM_GLOBAL ASM_PFX (SecSwitchStack)
> -ASM_PFX(SecSwitchStack):
> - #
> - # Save standard registers so they can be used to change stack
> - #
> - pushl %eax
> - pushl %ebx
> - pushl %ecx
> - pushl %edx
> -
> - #
> - # !!CAUTION!! this function address's is pushed into stack after
> - # migration of whole temporary memory, so need save it to permanent
> - # memory at first!
> - #
> - movl 20(%esp), %ebx # Save the first parameter
> - movl 24(%esp), %ecx # Save the second parameter
> -
> - #
> - # Save this function's return address into permanent memory at first.
> - # Then, Fixup the esp point to permanent memory
> - #
> - movl %esp, %eax
> - subl %ebx, %eax
> - addl %ecx, %eax
> - movl 0(%esp), %edx # copy pushed register's value to permanent
> memory
> - movl %edx, 0(%eax)
> - movl 4(%esp), %edx
> - movl %edx, 4(%eax)
> - movl 8(%esp), %edx
> - movl %edx, 8(%eax)
> - movl 12(%esp), %edx
> - movl %edx, 12(%eax)
> - movl 16(%esp), %edx # Update this function's return address into
> permanent memory
> - movl %edx, 16(%eax)
> - movl %eax, %esp # From now, esp is pointed to permanent memory
> -
> - #
> - # Fixup the ebp point to permanent memory
> - #
> - movl %ebp, %eax
> - subl %ebx, %eax
> - addl %ecx, %eax
> - movl %eax, %ebp # From now, ebp is pointed to permanent
> memory
> -
> - popl %edx
> - popl %ecx
> - popl %ebx
> - popl %eax
> - ret
> -
> -
> --
> 2.18.0.windows.1
^ permalink raw reply [flat|nested] 18+ messages in thread