]> git.proxmox.com Git - mirror_edk2.git/blame - UnixPkg/Library/DxeUnixPeCoffExtraActionLib/DxeUnixPeCoffExtraActionLib.c
Update the copyright notice format
[mirror_edk2.git] / UnixPkg / Library / DxeUnixPeCoffExtraActionLib / DxeUnixPeCoffExtraActionLib.c
CommitLineData
bac49e77 1/**@file\r
2\r
f9b8ab56
HT
3Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
4Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
5This program and the accompanying materials\r
bac49e77 6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13Module Name:\r
14\r
15 PeiUnixPeCoffExtraActionLib.c\r
16\r
17Abstract:\r
18\r
19 Provides services to perform additional actions to relocate and unload\r
20 PE/Coff image for Unix environment specific purpose such as souce level debug.\r
21 This version only works for DXE phase \r
22\r
23\r
24**/\r
25\r
ccd55824 26#include <PiDxe.h>\r
bac49e77 27#include <UnixDxe.h>\r
28#include <Library/PeCoffLib.h>\r
3980a850 29\r
bac49e77 30#include <Library/BaseLib.h>\r
31#include <Library/DebugLib.h>\r
32#include <Library/HobLib.h>\r
33#include <Library/BaseMemoryLib.h>\r
34#include <Library/PeCoffExtraActionLib.h>\r
35\r
398b646f 36//\r
ccd55824 37\r
398b646f 38// Cache of UnixThunk protocol \r
ccd55824 39\r
398b646f 40//\r
ccd55824 41\r
42EFI_UNIX_THUNK_PROTOCOL *mUnix = NULL;\r
bac49e77 43\r
44\r
45/**\r
46 The constructor function gets the pointer of the WinNT thunk functions\r
47 It will ASSERT() if Unix thunk protocol is not installed.\r
48\r
49 @retval EFI_SUCCESS Unix thunk protocol is found and cached.\r
50\r
51**/\r
52EFI_STATUS\r
53EFIAPI\r
54DxeUnixPeCoffLibExtraActionConstructor (\r
55 IN EFI_HANDLE ImageHandle,\r
56 IN EFI_SYSTEM_TABLE *SystemTable\r
57 )\r
58{\r
398b646f 59 EFI_HOB_GUID_TYPE *GuidHob;\r
60\r
61 //\r
62 // Retrieve UnixThunkProtocol from GUID'ed HOB\r
63 //\r
64 GuidHob = GetFirstGuidHob (&gEfiUnixThunkProtocolGuid);\r
65 ASSERT (GuidHob != NULL);\r
66 mUnix = (EFI_UNIX_THUNK_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));\r
67 ASSERT (mUnix != NULL);\r
68\r
bac49e77 69 return EFI_SUCCESS;\r
70}\r
71\r
72/**\r
6cb6f078 73 Performs additional actions after a PE/COFF image has been loaded and relocated.\r
74\r
75 If ImageContext is NULL, then ASSERT().\r
76\r
77 @param ImageContext Pointer to the image context structure that describes the\r
78 PE/COFF image that has already been loaded and relocated.\r
bac49e77 79\r
80**/\r
81VOID\r
82EFIAPI\r
83PeCoffLoaderRelocateImageExtraAction (\r
84 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext\r
85 )\r
86{\r
ccd55824 87 mUnix->PeCoffRelocateImageExtraAction (ImageContext);\r
398b646f 88 }\r
89\r
90\r
bac49e77 91\r
92/**\r
6cb6f078 93 Performs additional actions just before a PE/COFF image is unloaded. Any resources\r
94 that were allocated by PeCoffLoaderRelocateImageExtraAction() must be freed.\r
95 \r
96 If ImageContext is NULL, then ASSERT().\r
97 \r
98 @param ImageContext Pointer to the image context structure that describes the\r
99 PE/COFF image that is being unloaded.\r
bac49e77 100\r
101**/\r
102VOID\r
103EFIAPI\r
104PeCoffLoaderUnloadImageExtraAction (\r
105 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext\r
106 )\r
107{\r
ccd55824 108 mUnix->PeCoffUnloadImageExtraAction (ImageContext);\r
bac49e77 109}\r