summaryrefslogtreecommitdiff
path: root/ArmPkg/Library
diff options
context:
space:
mode:
authorAJFISH <AJFISH@6f19259b-4bc3-4df7-8a09-765794883524>2010-01-14 16:18:02 +0000
committerAJFISH <AJFISH@6f19259b-4bc3-4df7-8a09-765794883524>2010-01-14 16:18:02 +0000
commit62e797a489341b13a095b3cd7c0f7bd9eac12efe (patch)
tree2f75da867ce80104e6d15dc497c2f5edf30fd6ee /ArmPkg/Library
parentc11fa40c4e8124c7dfb8660b67aea1175e91cc13 (diff)
downloadedk2-platforms-62e797a489341b13a095b3cd7c0f7bd9eac12efe.tar.xz
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
Diffstat (limited to 'ArmPkg/Library')
-rw-r--r--ArmPkg/Library/RviPeCoffExtraActionLib/RviPeCoffExtraActionLib.c109
-rw-r--r--ArmPkg/Library/RviPeCoffExtraActionLib/RviPeCoffExtraActionLib.inf45
2 files changed, 154 insertions, 0 deletions
diff --git a/ArmPkg/Library/RviPeCoffExtraActionLib/RviPeCoffExtraActionLib.c b/ArmPkg/Library/RviPeCoffExtraActionLib/RviPeCoffExtraActionLib.c
new file mode 100644
index 0000000000..2e44c629e4
--- /dev/null
+++ b/ArmPkg/Library/RviPeCoffExtraActionLib/RviPeCoffExtraActionLib.c
@@ -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));
+}
diff --git a/ArmPkg/Library/RviPeCoffExtraActionLib/RviPeCoffExtraActionLib.inf b/ArmPkg/Library/RviPeCoffExtraActionLib/RviPeCoffExtraActionLib.inf
new file mode 100644
index 0000000000..947fcf4461
--- /dev/null
+++ b/ArmPkg/Library/RviPeCoffExtraActionLib/RviPeCoffExtraActionLib.inf
@@ -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