From 2c3b5ec562c7b43a73424e1be25e2053d1edfe4f Mon Sep 17 00:00:00 2001 From: lgao4 Date: Wed, 14 Mar 2007 02:02:43 +0000 Subject: Clean up the gBS sevice (CopyMem, SetMem, AllocatePool, FreePool) with the corresponding APIs defined in Mde library class for these modules. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2456 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/DebugSupport/Dxe/DebugSupport.c | 4 ++-- .../Universal/DebugSupport/Dxe/DebugSupport.msa | 24 ++++++++++++-------- .../DebugSupport/Dxe/Ia32/plDebugSupport.c | 19 ++++++++-------- .../DebugSupport/Dxe/ipf/plDebugSupport.c | 26 +++++++++++----------- .../DebugSupport/Dxe/x64/plDebugSupport.c | 21 +++++++++-------- 5 files changed, 49 insertions(+), 45 deletions(-) (limited to 'EdkModulePkg/Universal/DebugSupport') diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.c b/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.c index 118e9b7979..a0ec6c5934 100644 --- a/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.c +++ b/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.c @@ -96,12 +96,12 @@ Returns: EFI_OPEN_PROTOCOL_GET_PROTOCOL ); if (Status == EFI_SUCCESS && DebugSupportProtocolPtr->Isa == EFI_ISA) { - gBS->FreePool (HandlePtr); + FreePool (HandlePtr); Status = EFI_ALREADY_STARTED; goto ErrExit; } } while (NumHandles > 0); - gBS->FreePool (HandlePtr); + FreePool (HandlePtr); } // diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.msa b/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.msa index 01b61af697..5c14254a0c 100644 --- a/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.msa +++ b/EdkModulePkg/Universal/DebugSupport/Dxe/DebugSupport.msa @@ -7,7 +7,7 @@ 1.0 Component description file for DebugSupport module. This driver installs DebugSupport protocol for the selected processor. - Copyright (c) 2006, Intel Corporation + 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 @@ -17,35 +17,38 @@ FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052 - IA32 X64 IPF EBC + IA32 X64 IPF false DebugSupport - + DebugLib + Recommended libary Instance is PeiDxeDebugLibReportStatusCode instance in MdePkg. UefiDriverEntryPoint - + BaseMemoryLib + Recommended libary Instance is DxeMemoryLib instance in MdePkg. - + MemoryAllocationLib + Recommended libary Instance is DxeMemoryAllocationLib instance in MdePkg. UefiBootServicesTableLib - + BaseLib DebugSupport.c DebugSupport.dxs - Ia32/AsmFuncs.asm - Ia32/AsmFuncs.S + Ia32/AsmFuncs.asm + Ia32/AsmFuncs.S Ia32/plDebugSupport.h Ia32/plDebugSupport.c ipf/AsmFuncs.s @@ -60,11 +63,14 @@ - gEfiDebugSupportProtocolGuid + If the debug support protocol for this processor type is not + already installed, this protocol will be installed. Otherwise, it will + be not installed again. + gEfiLoadedImageProtocolGuid diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.c b/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.c index 289158216c..270a158b79 100644 --- a/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.c +++ b/EdkModulePkg/Universal/DebugSupport/Dxe/Ia32/plDebugSupport.c @@ -45,16 +45,15 @@ Returns: --*/ { - EFI_STATUS Status; UINT8 *StubCopy; // // First, allocate a new buffer and copy the stub code into it // - Status = gBS->AllocatePool (EfiBootServicesData, StubSize, Stub); - if (Status == EFI_SUCCESS) { + *Stub = AllocatePool (StubSize); + if (*Stub != NULL) { StubCopy = *Stub; - gBS->CopyMem (StubCopy, InterruptEntryStub, StubSize); + CopyMem (StubCopy, InterruptEntryStub, StubSize); // // Next fixup the stub code for this vector @@ -78,9 +77,11 @@ Returns: // fixup the jump target to point to the common entry // *(UINT32 *) &StubCopy[0x0e] = (UINT32) CommonIdtEntry - (UINT32) &StubCopy[StubSize]; + + return EFI_SUCCESS; } - return Status; + return EFI_OUT_OF_RESOURCES; } STATIC @@ -144,20 +145,18 @@ Arguments: Returns: EFI_SUCCESS - Other values are passed through from FreePool --*/ { BOOLEAN OldIntFlagState; - EFI_STATUS Status; OldIntFlagState = WriteInterruptFlag (0); WriteIdt (ExceptionType, &(IdtEntryTable[ExceptionType].OrigDesc)); - Status = gBS->FreePool ((VOID *) (UINTN) IdtEntryTable[ExceptionType].StubEntry); + FreePool ((VOID *) (UINTN) IdtEntryTable[ExceptionType].StubEntry); ZeroMem (&IdtEntryTable[ExceptionType], sizeof (IDT_ENTRY)); WriteInterruptFlag (OldIntFlagState); - return (Status); + return EFI_SUCCESS; } #endif @@ -405,7 +404,7 @@ Returns: ManageIdtEntryTable (NULL, ExceptionType); } - gBS->FreePool (IdtEntryTable); + FreePool (IdtEntryTable); return EFI_SUCCESS; } diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.c b/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.c index 513d71f62f..ca2a1e83d2 100644 --- a/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.c +++ b/EdkModulePkg/Universal/DebugSupport/Dxe/ipf/plDebugSupport.c @@ -107,7 +107,7 @@ Returns: --*/ { - gBS->SetMem (IvtEntryTable, sizeof (IvtEntryTable), 0); + SetMem (IvtEntryTable, sizeof (IvtEntryTable), 0); ExternalInterruptCount = 0; return EFI_SUCCESS; } @@ -298,7 +298,7 @@ Returns: // // re-init IvtEntryTable // - gBS->SetMem (&IvtEntryTable[ExceptionType], sizeof (IVT_ENTRY), 0); + SetMem (&IvtEntryTable[ExceptionType], sizeof (IVT_ENTRY), 0); } } else { // @@ -356,15 +356,15 @@ Returns: // // copy original bundles from IVT to IvtEntryTable so we can restore them later // - gBS->CopyMem ( - IvtEntryTable[ExceptionType].OrigBundles, - B0Ptr, - sizeof (BUNDLE) * NUM_BUNDLES_IN_STUB - ); + CopyMem ( + IvtEntryTable[ExceptionType].OrigBundles, + B0Ptr, + sizeof (BUNDLE) * NUM_BUNDLES_IN_STUB + ); // // insert new B0 // - gBS->CopyMem (B0Ptr, NewBundles, sizeof (BUNDLE) * NUM_BUNDLES_IN_STUB); + CopyMem (B0Ptr, NewBundles, sizeof (BUNDLE) * NUM_BUNDLES_IN_STUB); // // fixup IVT entry so it stores its index and whether or not to chain... @@ -406,11 +406,11 @@ Returns: // // restore original bundles in IVT // - gBS->CopyMem ( - B0Ptr, - IvtEntryTable[ExceptionType].OrigBundles, - sizeof (BUNDLE) * NUM_BUNDLES_IN_STUB - ); + CopyMem ( + B0Ptr, + IvtEntryTable[ExceptionType].OrigBundles, + sizeof (BUNDLE) * NUM_BUNDLES_IN_STUB + ); InstructionCacheFlush (B0Ptr, 5); } diff --git a/EdkModulePkg/Universal/DebugSupport/Dxe/x64/plDebugSupport.c b/EdkModulePkg/Universal/DebugSupport/Dxe/x64/plDebugSupport.c index b3580a42fa..6fb4cdb542 100644 --- a/EdkModulePkg/Universal/DebugSupport/Dxe/x64/plDebugSupport.c +++ b/EdkModulePkg/Universal/DebugSupport/Dxe/x64/plDebugSupport.c @@ -44,16 +44,15 @@ Returns: --*/ { - EFI_STATUS Status; UINT8 *StubCopy; // // First, allocate a new buffer and copy the stub code into it // - Status = gBS->AllocatePool (EfiBootServicesData, StubSize, Stub); - if (Status == EFI_SUCCESS) { + *Stub = AllocatePool (StubSize); + if (*Stub != NULL) { StubCopy = *Stub; - gBS->CopyMem (StubCopy, InterruptEntryStub, StubSize); + CopyMem (StubCopy, InterruptEntryStub, StubSize); // // Next fixup the stub code for this vector @@ -75,9 +74,11 @@ Returns: // fixup the jump target to point to the common entry // *(UINT32 *) &StubCopy[0x3] = (UINT32)((UINTN) CommonIdtEntry - (UINTN) &StubCopy[StubSize]); + + return EFI_SUCCESS; } - return Status; + return EFI_OUT_OF_RESOURCES; } STATIC @@ -142,20 +143,18 @@ Arguments: Returns: EFI_SUCCESS - Other values are passed through from FreePool --*/ { BOOLEAN OldIntFlagState; - EFI_STATUS Status; - + OldIntFlagState = WriteInterruptFlag (0); WriteIdt (ExceptionType, &(IdtEntryTable[ExceptionType].OrigDesc)); - Status = gBS->FreePool ((VOID *) (UINTN) IdtEntryTable[ExceptionType].StubEntry); + FreePool ((VOID *) (UINTN) IdtEntryTable[ExceptionType].StubEntry); ZeroMem (&IdtEntryTable[ExceptionType], sizeof (IDT_ENTRY)); WriteInterruptFlag (OldIntFlagState); - return (Status); + return EFI_SUCCESS; } EFI_STATUS @@ -401,7 +400,7 @@ Returns: ManageIdtEntryTable (NULL, ExceptionType); } - gBS->FreePool (IdtEntryTable); + FreePool (IdtEntryTable); return EFI_SUCCESS; } -- cgit v1.2.3