VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Library/VariablePolicyLib/VariablePolicyExtraInitRuntimeDxe.c@ 95057

最後變更 在這個檔案從95057是 89983,由 vboxsync 提交於 4 年 前

Devices/EFI: Merge edk-stable202105 and openssl 1.1.1j and make it build, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 2.3 KB
 
1/** @file -- VariablePolicyExtraInitRuntimeDxe.c
2This file contains extra init and deinit routines that register and unregister
3VariableAddressChange callbacks.
4
5Copyright (c) Microsoft Corporation.
6SPDX-License-Identifier: BSD-2-Clause-Patent
7
8**/
9
10#include <Library/UefiBootServicesTableLib.h>
11#include <Library/UefiRuntimeServicesTableLib.h>
12
13extern EFI_GET_VARIABLE mGetVariableHelper;
14extern UINT8 *mPolicyTable;
15STATIC BOOLEAN mIsVirtualAddrConverted;
16STATIC EFI_EVENT mVariablePolicyLibVirtualAddressChangeEvent = NULL;
17
18/**
19 For the RuntimeDxe version of this lib, convert internal pointer addresses to virtual addresses.
20
21 @param[in] Event Event whose notification function is being invoked.
22 @param[in] Context The pointer to the notification function's context, which
23 is implementation-dependent.
24**/
25STATIC
26VOID
27EFIAPI
28VariablePolicyLibVirtualAddressCallback (
29 IN EFI_EVENT Event,
30 IN VOID *Context
31 )
32{
33 gRT->ConvertPointer (0, (VOID **)&mPolicyTable);
34 gRT->ConvertPointer (0, (VOID **)&mGetVariableHelper);
35 mIsVirtualAddrConverted = TRUE;
36}
37
38
39/**
40 An extra init hook that enables the RuntimeDxe library instance to
41 register VirtualAddress change callbacks. Among other things.
42
43 @retval EFI_SUCCESS Everything is good. Continue with init.
44 @retval Others Uh... don't continue.
45
46**/
47EFI_STATUS
48VariablePolicyExtraInit (
49 VOID
50 )
51{
52 return gBS->CreateEventEx (EVT_NOTIFY_SIGNAL,
53 TPL_NOTIFY,
54 VariablePolicyLibVirtualAddressCallback,
55 NULL,
56 &gEfiEventVirtualAddressChangeGuid,
57 &mVariablePolicyLibVirtualAddressChangeEvent);
58}
59
60
61/**
62 An extra deinit hook that enables the RuntimeDxe library instance to
63 register VirtualAddress change callbacks. Among other things.
64
65 @retval EFI_SUCCESS Everything is good. Continue with deinit.
66 @retval Others Uh... don't continue.
67
68**/
69EFI_STATUS
70VariablePolicyExtraDeinit (
71 VOID
72 )
73{
74 EFI_STATUS Status;
75
76 Status = EFI_SUCCESS;
77 if (mIsVirtualAddrConverted) {
78 Status = gBS->CloseEvent (mVariablePolicyLibVirtualAddressChangeEvent);
79 }
80 else {
81 Status = EFI_SUCCESS;
82 }
83
84 return Status;
85}
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette