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