]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c
Removed CommonHeader.h generated file from the MdePkg.
[mirror_edk2.git] / MdePkg / Library / UefiApplicationEntryPoint / ApplicationEntryPoint.c
CommitLineData
e386b444 1/** @file\r
2 Entry point library instance to a UEFI application.\r
3\r
4Copyright (c) 2007, Intel Corporation<BR>\r
5All rights reserved. This program and the accompanying materials\r
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
13**/\r
14\r
c7d265a9 15#include <Uefi.h>\r
c7d265a9 16#include <Library/UefiApplicationEntryPoint.h>\r
17#include <Library/UefiBootServicesTableLib.h>\r
e386b444 18\r
f734a10a 19\r
e386b444 20/**\r
21 Enrty point to UEFI application.\r
22\r
23 @param ImageHandle ImageHandle of the loaded driver.\r
24 @param SystemTable Pointer to the EFI System Table.\r
25\r
26 @retval EFI_SUCCESS One or more of the drivers returned a success code.\r
27 @retval !EFI_SUCESS The return status from the last driver entry point in the list.\r
28\r
29**/\r
30EFI_STATUS\r
31EFIAPI\r
32_ModuleEntryPoint (\r
33 IN EFI_HANDLE ImageHandle,\r
34 IN EFI_SYSTEM_TABLE *SystemTable\r
35 )\r
36{\r
37 EFI_STATUS Status;\r
38\r
39 if (_gUefiDriverRevision != 0) {\r
40 //\r
41 // Make sure that the EFI/UEFI spec revision of the platform is >= EFI/UEFI spec revision of the application.\r
42 //\r
43 if (SystemTable->Hdr.Revision < _gUefiDriverRevision) {\r
44 return EFI_INCOMPATIBLE_VERSION;\r
45 }\r
46 }\r
47\r
48 //\r
49 // Call constructor for all libraries.\r
50 //\r
51 ProcessLibraryConstructorList (ImageHandle, SystemTable);\r
52\r
53 //\r
54 // Call the module's entry point\r
55 //\r
56 Status = ProcessModuleEntryPointList (ImageHandle, SystemTable);\r
57\r
58 //\r
59 // Process destructor for all libraries.\r
60 //\r
61 ProcessLibraryDestructorList (ImageHandle, SystemTable);\r
62\r
63 //\r
64 // Return the return status code from the driver entry point\r
65 //\r
66 return Status;\r
67}\r
68\r
69/**\r
70 Invoke the destuctors of all libraries and call gBS->Exit\r
71 to return control to firmware core.\r
72\r
73 @param Status Status returned by the application that is exiting.\r
74 \r
75 @retval VOID\r
76\r
77**/\r
78VOID\r
79EFIAPI\r
80Exit (\r
81 IN EFI_STATUS Status\r
82 )\r
83\r
84{\r
85 ProcessLibraryDestructorList (gImageHandle, gST);\r
86\r
87 gBS->Exit (gImageHandle, Status, 0, NULL);\r
88}\r
89\r
90/**\r
91 Enrty point wrapper of UEFI Application.\r
92\r
93 @param ImageHandle ImageHandle of the loaded driver.\r
94 @param SystemTable Pointer to the EFI System Table.\r
95\r
96 @retval EFI_SUCCESS One or more of the drivers returned a success code.\r
97 @retval !EFI_SUCESS The return status from the last driver entry point in the list.\r
98\r
99**/\r
100EFI_STATUS\r
101EFIAPI\r
102EfiMain (\r
103 IN EFI_HANDLE ImageHandle,\r
104 IN EFI_SYSTEM_TABLE *SystemTable\r
105 )\r
106{\r
107 return _ModuleEntryPoint (ImageHandle, SystemTable);\r
108}\r