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