e386b444 |
1 | /** @file\r |
9095d37b |
2 | This library retrieve the EFI_BOOT_SERVICES pointer from EFI system table in\r |
bf295af2 |
3 | library's constructor.\r |
e386b444 |
4 | \r |
9095d37b |
5 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
19388d29 |
6 | This program and the accompanying materials\r |
e386b444 |
7 | are licensed and made available under the terms and conditions of the BSD License\r |
8 | which accompanies this distribution. The full text of the license may be found at\r |
2fc59a00 |
9 | http://opensource.org/licenses/bsd-license.php.\r |
e386b444 |
10 | \r |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r |
13 | \r |
e386b444 |
14 | **/\r |
15 | \r |
c892d846 |
16 | \r |
60c93673 |
17 | #include <Uefi.h>\r |
c892d846 |
18 | \r |
c7d265a9 |
19 | #include <Library/UefiBootServicesTableLib.h>\r |
20 | #include <Library/DebugLib.h>\r |
e386b444 |
21 | \r |
22 | EFI_HANDLE gImageHandle = NULL;\r |
23 | EFI_SYSTEM_TABLE *gST = NULL;\r |
24 | EFI_BOOT_SERVICES *gBS = NULL;\r |
25 | \r |
26 | /**\r |
27 | The constructor function caches the pointer of Boot Services Table.\r |
9095d37b |
28 | \r |
e386b444 |
29 | The constructor function caches the pointer of Boot Services Table through System Table.\r |
30 | It will ASSERT() if the pointer of System Table is NULL.\r |
31 | It will ASSERT() if the pointer of Boot Services Table is NULL.\r |
32 | It will always return EFI_SUCCESS.\r |
33 | \r |
34 | @param ImageHandle The firmware allocated handle for the EFI image.\r |
35 | @param SystemTable A pointer to the EFI System Table.\r |
36 | \r |
37 | @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.\r |
38 | \r |
39 | **/\r |
40 | EFI_STATUS\r |
41 | EFIAPI\r |
42 | UefiBootServicesTableLibConstructor (\r |
43 | IN EFI_HANDLE ImageHandle,\r |
44 | IN EFI_SYSTEM_TABLE *SystemTable\r |
45 | )\r |
46 | {\r |
47 | //\r |
48 | // Cache the Image Handle\r |
49 | //\r |
50 | gImageHandle = ImageHandle;\r |
51 | ASSERT (gImageHandle != NULL);\r |
52 | \r |
53 | //\r |
54 | // Cache pointer to the EFI System Table\r |
55 | //\r |
56 | gST = SystemTable;\r |
57 | ASSERT (gST != NULL);\r |
58 | \r |
59 | //\r |
60 | // Cache pointer to the EFI Boot Services Table\r |
61 | //\r |
62 | gBS = SystemTable->BootServices;\r |
63 | ASSERT (gBS != NULL);\r |
64 | \r |
65 | return EFI_SUCCESS;\r |
66 | }\r |