2 Emulator Thunk to abstract OS services from pure EFI code
4 Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
5 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 #include <Library/BaseLib.h>
19 #include <Library/MemoryAllocationLib.h>
22 UINTN gThunkPpiListSize
= 0;
23 EFI_PEI_PPI_DESCRIPTOR
*gThunkPpiList
= NULL
;
27 EFI_PEI_PPI_DESCRIPTOR
*
34 if (gThunkPpiList
== NULL
) {
38 Index
= (gThunkPpiListSize
/sizeof (EFI_PEI_PPI_DESCRIPTOR
)) - 1;
39 gThunkPpiList
[Index
].Flags
|= EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
;
55 gThunkPpiList
= ReallocatePool (
57 gThunkPpiListSize
+ sizeof (EFI_PEI_PPI_DESCRIPTOR
),
60 if (gThunkPpiList
== NULL
) {
61 return EFI_OUT_OF_RESOURCES
;
64 Index
= (gThunkPpiListSize
/sizeof (EFI_PEI_PPI_DESCRIPTOR
));
65 gThunkPpiList
[Index
].Flags
= Flags
;
66 gThunkPpiList
[Index
].Guid
= Guid
;
67 gThunkPpiList
[Index
].Ppi
= Ppi
;
68 gThunkPpiListSize
+= sizeof (EFI_PEI_PPI_DESCRIPTOR
);