3 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Since the SEC is the only windows program in our emulation we
19 must use a Tiano mechanism to export Win32 APIs to other modules.
20 This is the role of the EFI_WIN_NT_THUNK_PROTOCOL.
22 The mWinNtThunkTable exists so that a change to EFI_WIN_NT_THUNK_PROTOCOL
23 will cause an error in initializing the array if all the member functions
24 are not added. It looks like adding a element to end and not initializing
25 it may cause the table to be initaliized with the members at the end being
26 set to zero. This is bad as jumping to zero will case the NT32 to crash.
28 All the member functions in mWinNtThunkTable are Win32
29 API calls, so please reference Microsoft documentation.
32 gWinNt is a a public exported global that contains the initialized
42 IN UINTN NumberOfBytes
60 IN UINTN NumberOfBytes
77 IN UINTN NumberOfBytes
89 return malloc ((size_t)Size
);
97 if (EfiSystemMemoryRange (Ptr
)) {
98 // If an address range is in the EFI memory map it was alloced via EFI.
99 // So don't free those ranges and let the caller know.
109 IN UINT64 TimerPeriod
,
110 IN EMU_SET_TIMER_CALLBACK Callback
131 SecDisableInterrupt (
139 SecQueryPerformanceFrequency (
143 // Hard code to nanoseconds
144 return 1000000000ULL;
148 SecQueryPerformanceCounter (
159 IN UINT64 Nanoseconds
162 Sleep ((DWORD
)DivU64x32 (Nanoseconds
, 1000000));
187 OUT EFI_TIME_CAPABILITIES
*Capabilities OPTIONAL
200 EMU_THUNK_PROTOCOL gEmuThunkProtocol
= {
209 SecPeCoffGetEntryPoint
,
210 PeCoffLoaderRelocateImageExtraAction
,
211 PeCoffLoaderUnloadImageExtraAction
,
214 SecQueryPerformanceFrequency
,
215 SecQueryPerformanceCounter
,
226 #pragma warning(default : 4996)
227 #pragma warning(default : 4232)