From a8ff971524f55118babf06e19f21a357a1e09952 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Wed, 20 Aug 2008 09:15:34 +0000 Subject: Cleanup Cpu library class and CpuLib instance and BaseLib instance; and add comments for the confused logic in IfrSupportLib instance. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5694 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Library/BaseLib/Ia32/CpuSleep.S | 34 ------------------ MdePkg/Library/BaseLib/Ia32/CpuSleep.asm | 39 --------------------- MdePkg/Library/BaseLib/Ia32/CpuSleep.c | 38 -------------------- MdePkg/Library/BaseLib/X64/CpuSleep.S | 34 ------------------ MdePkg/Library/BaseLib/X64/CpuSleep.asm | 37 -------------------- MdePkg/Library/CpuLib/CpuLib.inf | 6 +--- MdePkg/Library/CpuLib/Ia32/CpuPause.S | 34 ------------------ MdePkg/Library/CpuLib/Ia32/CpuPause.asm | 40 ---------------------- MdePkg/Library/CpuLib/Ia32/CpuPause.c | 36 ------------------- MdePkg/Library/CpuLib/Ipf/CpuPause.s | 25 -------------- MdePkg/Library/CpuLib/X64/CpuPause.S | 34 ------------------ MdePkg/Library/CpuLib/X64/CpuPause.asm | 37 -------------------- MdePkg/Library/HiiLib/HiiLib.c | 3 ++ .../Library/IfrSupportLib/UefiIfrOpCodeCreation.c | 36 +++++++++++++++++++ 14 files changed, 40 insertions(+), 393 deletions(-) delete mode 100644 MdePkg/Library/BaseLib/Ia32/CpuSleep.S delete mode 100644 MdePkg/Library/BaseLib/Ia32/CpuSleep.asm delete mode 100644 MdePkg/Library/BaseLib/Ia32/CpuSleep.c delete mode 100644 MdePkg/Library/BaseLib/X64/CpuSleep.S delete mode 100644 MdePkg/Library/BaseLib/X64/CpuSleep.asm delete mode 100644 MdePkg/Library/CpuLib/Ia32/CpuPause.S delete mode 100644 MdePkg/Library/CpuLib/Ia32/CpuPause.asm delete mode 100644 MdePkg/Library/CpuLib/Ia32/CpuPause.c delete mode 100644 MdePkg/Library/CpuLib/Ipf/CpuPause.s delete mode 100644 MdePkg/Library/CpuLib/X64/CpuPause.S delete mode 100644 MdePkg/Library/CpuLib/X64/CpuPause.asm (limited to 'MdePkg/Library') diff --git a/MdePkg/Library/BaseLib/Ia32/CpuSleep.S b/MdePkg/Library/BaseLib/Ia32/CpuSleep.S deleted file mode 100644 index ac39e8fcba..0000000000 --- a/MdePkg/Library/BaseLib/Ia32/CpuSleep.S +++ /dev/null @@ -1,34 +0,0 @@ -#------------------------------------------------------------------------------ ; -# Copyright (c) 2006, Intel Corporation -# All rights reserved. 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.Asm -# -# Abstract: -# -# CpuSleep function -# -# Notes: -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(CpuSleep) - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# CpuSleep ( -# VOID -# ); -#------------------------------------------------------------------------------ -ASM_PFX(CpuSleep): - hlt - ret diff --git a/MdePkg/Library/BaseLib/Ia32/CpuSleep.asm b/MdePkg/Library/BaseLib/Ia32/CpuSleep.asm deleted file mode 100644 index 8a779f7017..0000000000 --- a/MdePkg/Library/BaseLib/Ia32/CpuSleep.asm +++ /dev/null @@ -1,39 +0,0 @@ -;------------------------------------------------------------------------------ ; -; Copyright (c) 2006, Intel Corporation -; All rights reserved. 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.Asm -; -; Abstract: -; -; CpuSleep function -; -; Notes: -; -;------------------------------------------------------------------------------ - - .386 - .model flat,C - .code - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; CpuSleep ( -; VOID -; ); -;------------------------------------------------------------------------------ -CpuSleep PROC - hlt - ret -CpuSleep ENDP - - END diff --git a/MdePkg/Library/BaseLib/Ia32/CpuSleep.c b/MdePkg/Library/BaseLib/Ia32/CpuSleep.c deleted file mode 100644 index 8861e3369d..0000000000 --- a/MdePkg/Library/BaseLib/Ia32/CpuSleep.c +++ /dev/null @@ -1,38 +0,0 @@ -/** @file - CpuSleep function. - - Copyright (c) 2006 - 2007, Intel Corporation
- All rights reserved. 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. - -**/ - -// -// Include common header file for this module. -// - - -/** - Places the CPU in a sleep state until an interrupt is received. - - Places the CPU in a sleep state until an interrupt is received. If interrupts - are disabled prior to calling this function, then the CPU will be placed in a - sleep state indefinitely. - -**/ -VOID -EFIAPI -CpuSleep ( - VOID - ) -{ - _asm { - hlt - } -} - diff --git a/MdePkg/Library/BaseLib/X64/CpuSleep.S b/MdePkg/Library/BaseLib/X64/CpuSleep.S deleted file mode 100644 index 658cb1aeff..0000000000 --- a/MdePkg/Library/BaseLib/X64/CpuSleep.S +++ /dev/null @@ -1,34 +0,0 @@ -#------------------------------------------------------------------------------ ; -# Copyright (c) 2006, Intel Corporation -# All rights reserved. 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 -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(CpuSleep) -ASM_PFX(CpuSleep): - hlt - ret diff --git a/MdePkg/Library/BaseLib/X64/CpuSleep.asm b/MdePkg/Library/BaseLib/X64/CpuSleep.asm deleted file mode 100644 index b2c4907032..0000000000 --- a/MdePkg/Library/BaseLib/X64/CpuSleep.asm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ ; -; Copyright (c) 2006, Intel Corporation -; All rights reserved. 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.Asm -; -; Abstract: -; -; CpuSleep function -; -; Notes: -; -;------------------------------------------------------------------------------ - - .code - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; CpuSleep ( -; VOID -; ); -;------------------------------------------------------------------------------ -CpuSleep PROC - hlt - ret -CpuSleep ENDP - - END diff --git a/MdePkg/Library/CpuLib/CpuLib.inf b/MdePkg/Library/CpuLib/CpuLib.inf index 13e660dfb6..70981a780a 100644 --- a/MdePkg/Library/CpuLib/CpuLib.inf +++ b/MdePkg/Library/CpuLib/CpuLib.inf @@ -43,7 +43,7 @@ Ia32/CpuFlushTlb.S | GCC [Sources.X64] - X64/CpuFlushTlb.asm + X64/CpuFlushTlb.asm X64/CpuSleep.asm X64/CpuSleep.S | GCC @@ -62,7 +62,3 @@ [LibraryClasses.Ipf] PalCallLib - - -[Pcd.common] - diff --git a/MdePkg/Library/CpuLib/Ia32/CpuPause.S b/MdePkg/Library/CpuLib/Ia32/CpuPause.S deleted file mode 100644 index 5fef9c8d5c..0000000000 --- a/MdePkg/Library/CpuLib/Ia32/CpuPause.S +++ /dev/null @@ -1,34 +0,0 @@ -#------------------------------------------------------------------------------ ; -# Copyright (c) 2006, Intel Corporation -# All rights reserved. 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: -# -# CpuPause.Asm -# -# Abstract: -# -# CpuPause function -# -# Notes: -# -#------------------------------------------------------------------------------ - -.globl ASM_PFX(CpuPause) - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# CpuPause ( -# VOID -# ); -#------------------------------------------------------------------------------ -ASM_PFX(CpuPause): - pause - ret diff --git a/MdePkg/Library/CpuLib/Ia32/CpuPause.asm b/MdePkg/Library/CpuLib/Ia32/CpuPause.asm deleted file mode 100644 index 4c7135fc9c..0000000000 --- a/MdePkg/Library/CpuLib/Ia32/CpuPause.asm +++ /dev/null @@ -1,40 +0,0 @@ -;------------------------------------------------------------------------------ ; -; Copyright (c) 2006, Intel Corporation -; All rights reserved. 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: -; -; CpuPause.Asm -; -; Abstract: -; -; CpuPause function -; -; Notes: -; -;------------------------------------------------------------------------------ - - .686 - .model flat,C - .xmm - .code - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; CpuPause ( -; VOID -; ); -;------------------------------------------------------------------------------ -CpuPause PROC - pause - ret -CpuPause ENDP - - END diff --git a/MdePkg/Library/CpuLib/Ia32/CpuPause.c b/MdePkg/Library/CpuLib/Ia32/CpuPause.c deleted file mode 100644 index c62503ae10..0000000000 --- a/MdePkg/Library/CpuLib/Ia32/CpuPause.c +++ /dev/null @@ -1,36 +0,0 @@ -/** @file - CpuPause function. - - Copyright (c) 2006 - 2007, Intel Corporation
- All rights reserved. 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. - -**/ - - -/** - Places the CPU in a pause state until an interrupt is - received. - - Places the CPU in a pause state until an interrupt is - received. If interrupts are disabled prior to calling this - function, then the CPU will be placed in a pause state - indefinitely. - -**/ -VOID -EFIAPI -CpuPause ( - VOID - ) -{ - _asm { - pause - } -} - diff --git a/MdePkg/Library/CpuLib/Ipf/CpuPause.s b/MdePkg/Library/CpuLib/Ipf/CpuPause.s deleted file mode 100644 index f52692f438..0000000000 --- a/MdePkg/Library/CpuLib/Ipf/CpuPause.s +++ /dev/null @@ -1,25 +0,0 @@ -/// @file -/// CpuPause() function for Itanium-based architecture. -/// -/// Copyright (c) 2006, Intel Corporation -/// All rights reserved. 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: CpuPause.s -/// -/// - -.auto -.text - -.proc CpuPause -.type CpuPause, @function -CpuPause:: - hint @pause - br.ret.sptk.many b0 -.endp diff --git a/MdePkg/Library/CpuLib/X64/CpuPause.S b/MdePkg/Library/CpuLib/X64/CpuPause.S deleted file mode 100644 index f71fdec354..0000000000 --- a/MdePkg/Library/CpuLib/X64/CpuPause.S +++ /dev/null @@ -1,34 +0,0 @@ -#------------------------------------------------------------------------------ ; -# Copyright (c) 2006, Intel Corporation -# All rights reserved. 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: -# -# CpuPause.S -# -# Abstract: -# -# CpuPause function -# -# Notes: -# -#------------------------------------------------------------------------------ - - -#------------------------------------------------------------------------------ -# VOID -# EFIAPI -# CpuPause ( -# VOID -# ); -#------------------------------------------------------------------------------ -.global ASM_PFX(CpuPause) -ASM_PFX(CpuPause): - pause - ret diff --git a/MdePkg/Library/CpuLib/X64/CpuPause.asm b/MdePkg/Library/CpuLib/X64/CpuPause.asm deleted file mode 100644 index d16da37712..0000000000 --- a/MdePkg/Library/CpuLib/X64/CpuPause.asm +++ /dev/null @@ -1,37 +0,0 @@ -;------------------------------------------------------------------------------ ; -; Copyright (c) 2006, Intel Corporation -; All rights reserved. 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: -; -; CpuPause.Asm -; -; Abstract: -; -; CpuPause function -; -; Notes: -; -;------------------------------------------------------------------------------ - - .code - -;------------------------------------------------------------------------------ -; VOID -; EFIAPI -; CpuPause ( -; VOID -; ); -;------------------------------------------------------------------------------ -CpuPause PROC - pause - ret -CpuPause ENDP - - END diff --git a/MdePkg/Library/HiiLib/HiiLib.c b/MdePkg/Library/HiiLib/HiiLib.c index 81a7241cc9..db9112026f 100644 --- a/MdePkg/Library/HiiLib/HiiLib.c +++ b/MdePkg/Library/HiiLib/HiiLib.c @@ -119,6 +119,9 @@ InternalHiiLibPreparePackages ( // for (Index = 0; Index < NumberOfPackages; Index++) { PackageArray = (UINT8 *) VA_ARG (Marker, VOID *); + // + // CopyMem is used for UINT32 to cover the unaligned address access. + // CopyMem (&PackageLength, PackageArray, sizeof (UINT32)); PackageLength -= sizeof (UINT32); PackageArray += sizeof (UINT32); diff --git a/MdePkg/Library/IfrSupportLib/UefiIfrOpCodeCreation.c b/MdePkg/Library/IfrSupportLib/UefiIfrOpCodeCreation.c index b4cba7843b..afbfcfca2a 100644 --- a/MdePkg/Library/IfrSupportLib/UefiIfrOpCodeCreation.c +++ b/MdePkg/Library/IfrSupportLib/UefiIfrOpCodeCreation.c @@ -127,6 +127,9 @@ CreateEndOpCode ( End.Header.Scope = 0; LocalBuffer = (UINT8 *) Data->Data + Data->Offset; + // + // CopyMem is used for EFI_IFR_END to cover the unaligned address access. + // CopyMem (LocalBuffer, &End, sizeof (EFI_IFR_END)); Data->Offset += sizeof (EFI_IFR_END); @@ -174,6 +177,9 @@ CreateDefaultOpCode ( CopyMem (&Default.Value, Value, sizeof(EFI_IFR_TYPE_VALUE)); LocalBuffer = (UINT8 *) Data->Data + Data->Offset; + // + // CopyMem is used for EFI_IFR_DEFAULT to cover the unaligned address access. + // CopyMem (LocalBuffer, &Default, sizeof (EFI_IFR_DEFAULT)); Data->Offset += sizeof (EFI_IFR_DEFAULT); @@ -230,6 +236,9 @@ CreateActionOpCode ( Action.QuestionConfig = QuestionConfig; LocalBuffer = (UINT8 *) Data->Data + Data->Offset; + // + // CopyMem is used for EFI_IFR_ACTION to cover the unaligned address access. + // CopyMem (LocalBuffer, &Action, sizeof (EFI_IFR_ACTION)); Data->Offset += sizeof (EFI_IFR_ACTION); @@ -276,6 +285,9 @@ CreateSubTitleOpCode ( Subtitle.Flags = Flags; LocalBuffer = (UINT8 *) Data->Data + Data->Offset; + // + // CopyMem is used for EFI_IFR_SUBTITLE to cover the unaligned address access. + // CopyMem (LocalBuffer, &Subtitle, sizeof (EFI_IFR_SUBTITLE)); Data->Offset += sizeof (EFI_IFR_SUBTITLE); @@ -321,6 +333,9 @@ CreateTextOpCode ( Text.TextTwo = TextTwo; LocalBuffer = (UINT8 *) Data->Data + Data->Offset; + // + // CopyMem is used for EFI_IFR_TEXT to cover the unaligned address access. + // CopyMem (LocalBuffer, &Text, sizeof (EFI_IFR_TEXT)); Data->Offset += sizeof (EFI_IFR_TEXT); @@ -377,6 +392,9 @@ CreateGotoOpCode ( Goto.FormId = FormId; LocalBuffer = (UINT8 *) Data->Data + Data->Offset; + // + // CopyMem is used for EFI_IFR_REF to cover the unaligned address access. + // CopyMem (LocalBuffer, &Goto, sizeof (EFI_IFR_REF)); Data->Offset += sizeof (EFI_IFR_REF); @@ -429,6 +447,9 @@ CreateOneOfOptionOpCode ( OneOfOption.Type = Type; LocalBuffer = (UINT8 *) Data->Data + Data->Offset; + // + // CopyMem is used for EFI_IFR_ONF_OF_OPTION to cover the unaligned address access. + // CopyMem (LocalBuffer, &OneOfOption, sizeof (EFI_IFR_ONE_OF_OPTION)); Data->Offset += sizeof (EFI_IFR_ONE_OF_OPTION); } @@ -500,6 +521,9 @@ CreateOneOfOpCode ( ZeroMem ((VOID *) &OneOf.data, sizeof (MINMAXSTEP_DATA)); LocalBuffer = (UINT8 *) Data->Data + Data->Offset; + // + // CopyMem is used for EFI_IFR_ONF_OF to cover the unaligned address access. + // CopyMem (LocalBuffer, &OneOf, sizeof (EFI_IFR_ONE_OF)); Data->Offset += sizeof (EFI_IFR_ONE_OF); @@ -583,6 +607,9 @@ CreateOrderedListOpCode ( OrderedList.Flags = OrderedListFlags; LocalBuffer = (UINT8 *) Data->Data + Data->Offset; + // + // CopyMem is used for EFI_IFR_ORDERED_LIST to cover the unaligned address access. + // CopyMem (LocalBuffer, &OrderedList, sizeof (EFI_IFR_ORDERED_LIST)); Data->Offset += sizeof (EFI_IFR_ORDERED_LIST); @@ -648,6 +675,9 @@ CreateCheckBoxOpCode ( CheckBox.Flags = CheckBoxFlags; LocalBuffer = (UINT8 *) Data->Data + Data->Offset; + // + // CopyMem is used for EFI_IFR_CHECKBOX to cover the unaligned address access. + // CopyMem (LocalBuffer, &CheckBox, sizeof (EFI_IFR_CHECKBOX)); Data->Offset += sizeof (EFI_IFR_CHECKBOX); @@ -748,6 +778,9 @@ CreateNumericOpCode ( CopyMem (&Numeric.data, &MinMaxStep, sizeof (MINMAXSTEP_DATA)); LocalBuffer = (UINT8 *) Data->Data + Data->Offset; + // + // CopyMem is used for EFI_IFR_NUMERIC to cover the unaligned address access. + // CopyMem (LocalBuffer, &Numeric, sizeof (EFI_IFR_NUMERIC)); Data->Offset += sizeof (EFI_IFR_NUMERIC); @@ -823,6 +856,9 @@ CreateStringOpCode ( String.Flags = StringFlags; LocalBuffer = (UINT8 *) Data->Data + Data->Offset; + // + // CopyMem is used for EFI_IFR_STRING to cover the unaligned address access. + // CopyMem (LocalBuffer, &String, sizeof (EFI_IFR_STRING)); Data->Offset += sizeof (EFI_IFR_STRING); -- cgit v1.2.3