]> git.proxmox.com Git - mirror_edk2.git/blob - InOsEmuPkg/Library/DxeEmuLib/DxeEmuLib.c
79e9fbc1eee0711026212823150f81ac1da58368
[mirror_edk2.git] / InOsEmuPkg / Library / DxeEmuLib / DxeEmuLib.c
1 /*++ @file
2
3 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
4 Portions copyright (c) 2011, Apple Inc. All rights reserved.
5 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 **/
14
15 #include <PiDxe.h>
16
17 #include <Library/DebugLib.h>
18 #include <Library/HobLib.h>
19 #include <Library/EmuThunkLib.h>
20
21 #include <Protocol/EmuThunk.h>
22
23
24 EMU_THUNK_PROTOCOL *gEmuThunk = NULL;
25
26
27 /**
28 The constructor function caches the pointer of EMU Thunk protocol.
29
30 @param ImageHandle The firmware allocated handle for the EFI image.
31 @param SystemTable A pointer to the EFI System Table.
32
33 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
34
35 **/
36 EFI_STATUS
37 EFIAPI
38 DxeEmuLibConstructor (
39 IN EFI_HANDLE ImageHandle,
40 IN EFI_SYSTEM_TABLE *SystemTable
41 )
42 {
43 EFI_HOB_GUID_TYPE *GuidHob;
44
45 GuidHob = GetFirstGuidHob (&gEmuThunkProtocolGuid);
46 ASSERT (GuidHob != NULL);
47
48 gEmuThunk = (EMU_THUNK_PROTOCOL *)(*(UINTN *)(GET_GUID_HOB_DATA (GuidHob)));
49 ASSERT (gEmuThunk != NULL);
50
51 return EFI_SUCCESS;
52 }