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