mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-28 08:04:07 +02:00
Fix GCC build bug and add a debug library to dump load and unload commands into the RVI debugger window.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9752 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
c11fa40c4e
commit
62e797a489
@ -43,6 +43,7 @@
|
|||||||
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
|
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
|
||||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||||
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
|
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
|
||||||
|
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
|
||||||
|
|
||||||
SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf
|
SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf
|
||||||
UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
|
UncachedMemoryAllocationLib|ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
|
||||||
@ -82,6 +83,7 @@
|
|||||||
ArmPkg/Library/SemihostLib/SemihostLib.inf
|
ArmPkg/Library/SemihostLib/SemihostLib.inf
|
||||||
ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
|
ArmPkg/Library/UncachedMemoryAllocationLib/UncachedMemoryAllocationLib.inf
|
||||||
ArmPkg/Library/DebugUncachedMemoryAllocationLib/DebugUncachedMemoryAllocationLib.inf
|
ArmPkg/Library/DebugUncachedMemoryAllocationLib/DebugUncachedMemoryAllocationLib.inf
|
||||||
|
ArmPkg/Library/RviPeCoffExtraActionLib/RviPeCoffExtraActionLib.inf
|
||||||
|
|
||||||
ArmPkg/Drivers/CpuDxe/CpuDxe.inf
|
ArmPkg/Drivers/CpuDxe/CpuDxe.inf
|
||||||
ArmPkg/Drivers/DebugSupportDxe/DebugSupportDxe.inf
|
ArmPkg/Drivers/DebugSupportDxe/DebugSupportDxe.inf
|
||||||
|
@ -149,6 +149,8 @@ PeCoffGetSizeOfHeaders (
|
|||||||
SizeOfHeaders = sizeof (EFI_TE_IMAGE_HEADER) + (UINTN)Hdr.Te->BaseOfCode - (UINTN)Hdr.Te->StrippedSize;
|
SizeOfHeaders = sizeof (EFI_TE_IMAGE_HEADER) + (UINTN)Hdr.Te->BaseOfCode - (UINTN)Hdr.Te->StrippedSize;
|
||||||
} else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
|
} else if (Hdr.Pe32->Signature == EFI_IMAGE_NT_SIGNATURE) {
|
||||||
SizeOfHeaders = Hdr.Pe32->OptionalHeader.SizeOfHeaders;
|
SizeOfHeaders = Hdr.Pe32->OptionalHeader.SizeOfHeaders;
|
||||||
|
} else {
|
||||||
|
SizeOfHeaders = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SizeOfHeaders;
|
return SizeOfHeaders;
|
||||||
@ -177,7 +179,7 @@ GetImageName (
|
|||||||
if (DebugTable->NormalImage != NULL) {
|
if (DebugTable->NormalImage != NULL) {
|
||||||
if ((DebugTable->NormalImage->ImageInfoType == EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) &&
|
if ((DebugTable->NormalImage->ImageInfoType == EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) &&
|
||||||
(DebugTable->NormalImage->LoadedImageProtocolInstance != NULL)) {
|
(DebugTable->NormalImage->LoadedImageProtocolInstance != NULL)) {
|
||||||
if ((Address >= DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase) &&
|
if ((Address >= (CHAR8 *)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase) &&
|
||||||
(Address <= ((CHAR8 *)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase + DebugTable->NormalImage->LoadedImageProtocolInstance->ImageSize))) {
|
(Address <= ((CHAR8 *)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase + DebugTable->NormalImage->LoadedImageProtocolInstance->ImageSize))) {
|
||||||
*ImageBase = (UINT32)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase;
|
*ImageBase = (UINT32)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase;
|
||||||
*PeCoffSizeOfHeaders = PeCoffGetSizeOfHeaders ((VOID *)(UINTN)*ImageBase);
|
*PeCoffSizeOfHeaders = PeCoffGetSizeOfHeaders ((VOID *)(UINTN)*ImageBase);
|
||||||
|
109
ArmPkg/Library/RviPeCoffExtraActionLib/RviPeCoffExtraActionLib.c
Normal file
109
ArmPkg/Library/RviPeCoffExtraActionLib/RviPeCoffExtraActionLib.c
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
/**@file
|
||||||
|
|
||||||
|
Copyright (c) 2006 - 2009, Intel Corporation
|
||||||
|
Portions copyright (c) 2008-2010 Apple Inc. All rights reserved.
|
||||||
|
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 <PiDxe.h>
|
||||||
|
#include <Library/PeCoffLib.h>
|
||||||
|
|
||||||
|
#include <Library/BaseLib.h>
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/BaseMemoryLib.h>
|
||||||
|
#include <Library/PeCoffExtraActionLib.h>
|
||||||
|
#include <Library/SerialPortLib.h>
|
||||||
|
#include <Library/PrintLib.h>
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DeCygwinIfNeeded (
|
||||||
|
IN CHAR8 *Name
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CHAR8 *Ptr;
|
||||||
|
UINTN Index;
|
||||||
|
UINTN Len;
|
||||||
|
|
||||||
|
Ptr = AsciiStrStr (Name, "/cygdrive/");
|
||||||
|
if (Ptr == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Len = AsciiStrLen (Ptr);
|
||||||
|
|
||||||
|
// convert "/cygdrive" to spaces
|
||||||
|
for (Index = 0; Index < 9; Index++) {
|
||||||
|
Ptr[Index] = ' ';
|
||||||
|
}
|
||||||
|
|
||||||
|
// convert /c to c:
|
||||||
|
Ptr[9] = Ptr[10];
|
||||||
|
Ptr[10] = ':';
|
||||||
|
|
||||||
|
// switch path seperators
|
||||||
|
for (Index = 11; Index < Len; Index++) {
|
||||||
|
if (Ptr[Index] == '/') {
|
||||||
|
Ptr[Index] = '\\' ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Performs additional actions after a PE/COFF image has been loaded and relocated.
|
||||||
|
|
||||||
|
If ImageContext is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param ImageContext Pointer to the image context structure that describes the
|
||||||
|
PE/COFF image that has already been loaded and relocated.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
PeCoffLoaderRelocateImageExtraAction (
|
||||||
|
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CHAR8 Buffer[256];
|
||||||
|
|
||||||
|
AsciiSPrint (Buffer, sizeof(Buffer), "load /a /ni /np %a &0x%08x\n", ImageContext->PdbPointer, (UINTN)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders));
|
||||||
|
DeCygwinIfNeeded (&Buffer[16]);
|
||||||
|
|
||||||
|
SerialPortWrite ((UINT8 *) Buffer, AsciiStrLen (Buffer));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Performs additional actions just before a PE/COFF image is unloaded. Any resources
|
||||||
|
that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed.
|
||||||
|
|
||||||
|
If ImageContext is NULL, then ASSERT().
|
||||||
|
|
||||||
|
@param ImageContext Pointer to the image context structure that describes the
|
||||||
|
PE/COFF image that is being unloaded.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
PeCoffLoaderUnloadImageExtraAction (
|
||||||
|
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||||
|
)
|
||||||
|
{
|
||||||
|
CHAR8 Buffer[256];
|
||||||
|
|
||||||
|
AsciiSPrint (Buffer, sizeof(Buffer), "unload symbols_only %a", ImageContext->PdbPointer);
|
||||||
|
DeCygwinIfNeeded (Buffer);
|
||||||
|
|
||||||
|
SerialPortWrite ((UINT8 *) Buffer, AsciiStrLen (Buffer));
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
#/** @file
|
||||||
|
# PeCoff extra action libary for DXE phase that run Unix emulator.
|
||||||
|
#
|
||||||
|
# Lib to provide memory journal status code reporting Routines
|
||||||
|
# Copyright (c) 2007 - 2010, Intel Corporation
|
||||||
|
# Portiions copyright (c) 2010 Apple, Inc. All rights reserved.
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#**/
|
||||||
|
|
||||||
|
[Defines]
|
||||||
|
INF_VERSION = 0x00010005
|
||||||
|
BASE_NAME = RviUnixPeCoffExtraActionLib
|
||||||
|
FILE_GUID = 5EDEB7E7-EA55-4E92-8216-335AC98A3B11
|
||||||
|
MODULE_TYPE = DXE_DRIVER
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
LIBRARY_CLASS = PeCoffExtraActionLib|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER UEFI_DRIVER
|
||||||
|
EDK_RELEASE_VERSION = 0x00020000
|
||||||
|
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = ARM
|
||||||
|
#
|
||||||
|
|
||||||
|
[Sources.common]
|
||||||
|
RviPeCoffExtraActionLib.c
|
||||||
|
|
||||||
|
[Packages]
|
||||||
|
MdePkg/MdePkg.dec
|
||||||
|
ArmPkg/ArmPkg.dec
|
||||||
|
|
||||||
|
[LibraryClasses]
|
||||||
|
DebugLib
|
||||||
|
HobLib
|
||||||
|
BaseMemoryLib
|
||||||
|
SerialLib
|
Loading…
x
Reference in New Issue
Block a user