3 Copyright (c) 2006 - 2009, Intel Corporation
4 Portions copyright (c) 2008-2010 Apple Inc. All rights reserved.
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #include <Library/PeCoffLib.h>
20 #include <Library/BaseLib.h>
21 #include <Library/DebugLib.h>
22 #include <Library/BaseMemoryLib.h>
23 #include <Library/PeCoffExtraActionLib.h>
24 #include <Library/SerialPortLib.h>
25 #include <Library/PrintLib.h>
37 Ptr
= AsciiStrStr (Name
, "/cygdrive/");
42 Len
= AsciiStrLen (Ptr
);
44 // convert "/cygdrive" to spaces
45 for (Index
= 0; Index
< 9; Index
++) {
53 // switch path seperators
54 for (Index
= 11; Index
< Len
; Index
++) {
55 if (Ptr
[Index
] == '/') {
63 Performs additional actions after a PE/COFF image has been loaded and relocated.
65 If ImageContext is NULL, then ASSERT().
67 @param ImageContext Pointer to the image context structure that describes the
68 PE/COFF image that has already been loaded and relocated.
73 PeCoffLoaderRelocateImageExtraAction (
74 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
79 AsciiSPrint (Buffer
, sizeof(Buffer
), "load /a /ni /np %a &0x%08x\n", ImageContext
->PdbPointer
, (UINTN
)(ImageContext
->ImageAddress
+ ImageContext
->SizeOfHeaders
));
80 DeCygwinIfNeeded (&Buffer
[16]);
82 SerialPortWrite ((UINT8
*) Buffer
, AsciiStrLen (Buffer
));
88 Performs additional actions just before a PE/COFF image is unloaded. Any resources
89 that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed.
91 If ImageContext is NULL, then ASSERT().
93 @param ImageContext Pointer to the image context structure that describes the
94 PE/COFF image that is being unloaded.
99 PeCoffLoaderUnloadImageExtraAction (
100 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT
*ImageContext
105 AsciiSPrint (Buffer
, sizeof(Buffer
), "unload symbols_only %a", ImageContext
->PdbPointer
);
106 DeCygwinIfNeeded (Buffer
);
108 SerialPortWrite ((UINT8
*) Buffer
, AsciiStrLen (Buffer
));