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