2 Entry point library instance to a UEFI application.
4 Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
5 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.
16 #include <Library/UefiApplicationEntryPoint.h>
17 #include <Library/BaseLib.h>
18 #include <Library/DebugLib.h>
19 #include <Library/UefiBootServicesTableLib.h>
23 Entry point to UEFI Application.
25 This function is the entry point for a UEFI Application. This function must call
26 ProcessLibraryConstructorList(), ProcessModuleEntryPointList(), and ProcessLibraryDestructorList().
27 The return value from ProcessModuleEntryPointList() is returned.
28 If _gUefiDriverRevision is not zero and SystemTable->Hdr.Revision is less than _gUefiDriverRevison,
29 then return EFI_INCOMPATIBLE_VERSION.
31 @param ImageHandle The image handle of the UEFI Application.
32 @param SystemTable A pointer to the EFI System Table.
34 @retval EFI_SUCCESS The UEFI Application exited normally.
35 @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than SystemTable->Hdr.Revision.
36 @retval Other Return value from ProcessModuleEntryPointList().
42 IN EFI_HANDLE ImageHandle
,
43 IN EFI_SYSTEM_TABLE
*SystemTable
48 if (_gUefiDriverRevision
!= 0) {
50 // Make sure that the EFI/UEFI spec revision of the platform is >= EFI/UEFI spec revision of the application.
52 if (SystemTable
->Hdr
.Revision
< _gUefiDriverRevision
) {
53 return EFI_INCOMPATIBLE_VERSION
;
58 // Call constructor for all libraries.
60 ProcessLibraryConstructorList (ImageHandle
, SystemTable
);
63 // Call the module's entry point
65 Status
= ProcessModuleEntryPointList (ImageHandle
, SystemTable
);
68 // Process destructor for all libraries.
70 ProcessLibraryDestructorList (ImageHandle
, SystemTable
);
73 // Return the return status code from the driver entry point
80 Invokes the library destructors for all dependent libraries and terminates
83 This function calls ProcessLibraryDestructorList() and the EFI Boot Service Exit()
84 with a status specified by Status.
86 @param Status Status returned by the application that is exiting.
96 ProcessLibraryDestructorList (gImageHandle
, gST
);
98 gBS
->Exit (gImageHandle
, Status
, 0, NULL
);
103 Required by the EBC compiler and identical in functionality to _ModuleEntryPoint().
105 @param ImageHandle The image handle of the UEFI Application.
106 @param SystemTable A pointer to the EFI System Table.
108 @retval EFI_SUCCESS The UEFI Application exited normally.
109 @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than SystemTable->Hdr.Revision.
110 @retval Other Return value from ProcessModuleEntryPointList().
116 IN EFI_HANDLE ImageHandle
,
117 IN EFI_SYSTEM_TABLE
*SystemTable
120 return _ModuleEntryPoint (ImageHandle
, SystemTable
);