]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c
MdePkg UefiLib: Make the event empty function public
[mirror_edk2.git] / MdePkg / Library / UefiApplicationEntryPoint / ApplicationEntryPoint.c
... / ...
CommitLineData
1/** @file\r
2 Entry point library instance to a UEFI application.\r
3\r
4Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
5This 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
15#include <Uefi.h>\r
16#include <Library/UefiApplicationEntryPoint.h>\r
17#include <Library/BaseLib.h>\r
18#include <Library/DebugLib.h>\r
19#include <Library/UefiBootServicesTableLib.h>\r
20\r
21\r
22/**\r
23 Entry point to UEFI Application.\r
24\r
25 This function is the entry point for a UEFI Application. This function must call\r
26 ProcessLibraryConstructorList(), ProcessModuleEntryPointList(), and ProcessLibraryDestructorList().\r
27 The return value from ProcessModuleEntryPointList() is returned.\r
28 If _gUefiDriverRevision is not zero and SystemTable->Hdr.Revision is less than _gUefiDriverRevison,\r
29 then return EFI_INCOMPATIBLE_VERSION.\r
30\r
31 @param ImageHandle The image handle of the UEFI Application.\r
32 @param SystemTable A pointer to the EFI System Table.\r
33\r
34 @retval EFI_SUCCESS The UEFI Application exited normally.\r
35 @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than SystemTable->Hdr.Revision.\r
36 @retval Other Return value from ProcessModuleEntryPointList().\r
37\r
38**/\r
39EFI_STATUS\r
40EFIAPI\r
41_ModuleEntryPoint (\r
42 IN EFI_HANDLE ImageHandle,\r
43 IN EFI_SYSTEM_TABLE *SystemTable\r
44 )\r
45{\r
46 EFI_STATUS Status;\r
47\r
48 if (_gUefiDriverRevision != 0) {\r
49 //\r
50 // Make sure that the EFI/UEFI spec revision of the platform is >= EFI/UEFI spec revision of the application.\r
51 //\r
52 if (SystemTable->Hdr.Revision < _gUefiDriverRevision) {\r
53 return EFI_INCOMPATIBLE_VERSION;\r
54 }\r
55 }\r
56\r
57 //\r
58 // Call constructor for all libraries.\r
59 //\r
60 ProcessLibraryConstructorList (ImageHandle, SystemTable);\r
61\r
62 //\r
63 // Call the module's entry point\r
64 //\r
65 Status = ProcessModuleEntryPointList (ImageHandle, SystemTable);\r
66\r
67 //\r
68 // Process destructor for all libraries.\r
69 //\r
70 ProcessLibraryDestructorList (ImageHandle, SystemTable);\r
71\r
72 //\r
73 // Return the return status code from the driver entry point\r
74 //\r
75 return Status;\r
76}\r
77\r
78\r
79/**\r
80 Invokes the library destructors for all dependent libraries and terminates\r
81 the UEFI Application. \r
82\r
83 This function calls ProcessLibraryDestructorList() and the EFI Boot Service Exit()\r
84 with a status specified by Status.\r
85\r
86 @param Status Status returned by the application that is exiting.\r
87 \r
88**/\r
89VOID\r
90EFIAPI\r
91Exit (\r
92 IN EFI_STATUS Status\r
93 )\r
94\r
95{\r
96 ProcessLibraryDestructorList (gImageHandle, gST);\r
97\r
98 gBS->Exit (gImageHandle, Status, 0, NULL);\r
99}\r
100\r
101\r
102/**\r
103 Required by the EBC compiler and identical in functionality to _ModuleEntryPoint(). \r
104\r
105 @param ImageHandle The image handle of the UEFI Application.\r
106 @param SystemTable A pointer to the EFI System Table.\r
107\r
108 @retval EFI_SUCCESS The UEFI Application exited normally.\r
109 @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than SystemTable->Hdr.Revision.\r
110 @retval Other Return value from ProcessModuleEntryPointList().\r
111\r
112**/\r
113EFI_STATUS\r
114EFIAPI\r
115EfiMain (\r
116 IN EFI_HANDLE ImageHandle,\r
117 IN EFI_SYSTEM_TABLE *SystemTable\r
118 )\r
119{\r
120 return _ModuleEntryPoint (ImageHandle, SystemTable);\r
121}\r