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