/src/edk2/MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.c
Line | Count | Source |
1 | | /** @file |
2 | | UEFI Runtime Services Table Library. |
3 | | |
4 | | This library instance retrieve EFI_RUNTIME_SERVICES pointer from EFI system table |
5 | | in library's constructor. |
6 | | |
7 | | Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR> |
8 | | SPDX-License-Identifier: BSD-2-Clause-Patent |
9 | | |
10 | | **/ |
11 | | |
12 | | #include <Uefi.h> |
13 | | #include <Library/DebugLib.h> |
14 | | |
15 | | EFI_RUNTIME_SERVICES *gRT = NULL; |
16 | | |
17 | | /** |
18 | | The constructor function caches the pointer of Runtime Services Table. |
19 | | |
20 | | The constructor function caches the pointer of Runtime Services Table. |
21 | | It will ASSERT() if the pointer of Runtime Services Table is NULL. |
22 | | It will always return EFI_SUCCESS. |
23 | | |
24 | | @param ImageHandle The firmware allocated handle for the EFI image. |
25 | | @param SystemTable A pointer to the EFI System Table. |
26 | | |
27 | | @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. |
28 | | |
29 | | **/ |
30 | | EFI_STATUS |
31 | | EFIAPI |
32 | | UefiRuntimeServicesTableLibConstructor ( |
33 | | IN EFI_HANDLE ImageHandle, |
34 | | IN EFI_SYSTEM_TABLE *SystemTable |
35 | | ) |
36 | 0 | { |
37 | | // |
38 | | // Cache pointer to the EFI Runtime Services Table |
39 | | // |
40 | 0 | gRT = SystemTable->RuntimeServices; |
41 | 0 | ASSERT (gRT != NULL); |
42 | 0 | return EFI_SUCCESS; |
43 | 0 | } |