]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.c
b7795e6a3c0c1b903c358ce46dfdbeb8200a2205
[mirror_edk2.git] / MdePkg / Library / UefiBootServicesTableLib / UefiBootServicesTableLib.c
1 /** @file
2 UEFI Boot Services Table Library.
3
4 Copyright (c) 2006 - 2007, Intel Corporation<BR>
5 All rights reserved. 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 Module Name: UefiBootServicesTableLib.c
14
15 **/
16
17 //
18 // Include common header file for this module.
19 //
20 #include "CommonHeader.h"
21
22 EFI_HANDLE gImageHandle = NULL;
23 EFI_SYSTEM_TABLE *gST = NULL;
24 EFI_BOOT_SERVICES *gBS = NULL;
25
26 /**
27 The constructor function caches the pointer of Boot Services Table.
28
29 The constructor function caches the pointer of Boot Services Table through System Table.
30 It will ASSERT() if the pointer of System Table is NULL.
31 It will ASSERT() if the pointer of Boot Services Table is NULL.
32 It will always return EFI_SUCCESS.
33
34 @param ImageHandle The firmware allocated handle for the EFI image.
35 @param SystemTable A pointer to the EFI System Table.
36
37 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
38
39 **/
40 EFI_STATUS
41 EFIAPI
42 UefiBootServicesTableLibConstructor (
43 IN EFI_HANDLE ImageHandle,
44 IN EFI_SYSTEM_TABLE *SystemTable
45 )
46 {
47 //
48 // Cache the Image Handle
49 //
50 gImageHandle = ImageHandle;
51 ASSERT (gImageHandle != NULL);
52
53 //
54 // Cache pointer to the EFI System Table
55 //
56 gST = SystemTable;
57 ASSERT (gST != NULL);
58
59 //
60 // Cache pointer to the EFI Boot Services Table
61 //
62 gBS = SystemTable->BootServices;
63 ASSERT (gBS != NULL);
64
65 return EFI_SUCCESS;
66 }