2018-08-23 07:02:52 +02:00
|
|
|
/**@file
|
|
|
|
|
2022-11-12 05:00:42 +01:00
|
|
|
Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
|
2020-04-09 05:20:39 +02:00
|
|
|
(C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
|
2019-04-04 01:03:44 +02:00
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
2018-08-23 07:02:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
Module Name:
|
|
|
|
WinHost.h
|
|
|
|
|
|
|
|
Abstract:
|
|
|
|
Include file for Windows Host
|
|
|
|
|
|
|
|
**/
|
2021-12-05 23:53:57 +01:00
|
|
|
|
2018-08-23 07:02:52 +02:00
|
|
|
#ifndef _HOST_H_
|
|
|
|
#define _HOST_H_
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <time.h>
|
|
|
|
#include "WinInclude.h"
|
|
|
|
|
|
|
|
#include <PiPei.h>
|
|
|
|
#include <IndustryStandard/PeImage.h>
|
2018-08-23 07:43:00 +02:00
|
|
|
#include <Guid/FileInfo.h>
|
|
|
|
#include <Guid/FileSystemInfo.h>
|
|
|
|
#include <Guid/FileSystemVolumeLabelInfo.h>
|
2018-08-23 07:02:52 +02:00
|
|
|
#include <Ppi/EmuThunk.h>
|
2022-11-12 05:00:42 +01:00
|
|
|
#include <Ppi/Reset2.h>
|
2018-08-23 07:02:52 +02:00
|
|
|
#include <Protocol/EmuThunk.h>
|
2018-08-23 07:43:00 +02:00
|
|
|
#include <Protocol/SimpleFileSystem.h>
|
2018-08-23 07:02:52 +02:00
|
|
|
|
2018-08-23 09:36:15 +02:00
|
|
|
#include <Protocol/EmuBlockIo.h>
|
|
|
|
#include <Protocol/BlockIo.h>
|
2020-04-09 05:20:39 +02:00
|
|
|
#include <Protocol/EmuSnp.h>
|
2018-08-23 07:02:52 +02:00
|
|
|
|
|
|
|
#include <Library/BaseLib.h>
|
|
|
|
#include <Library/PeCoffLib.h>
|
|
|
|
#include <Library/DebugLib.h>
|
|
|
|
#include <Library/MemoryAllocationLib.h>
|
|
|
|
#include <Library/ThunkPpiList.h>
|
|
|
|
#include <Library/ThunkProtocolList.h>
|
|
|
|
#include <Library/PcdLib.h>
|
|
|
|
#include <Library/PrintLib.h>
|
|
|
|
#include <Library/BaseMemoryLib.h>
|
|
|
|
#include <Library/PeiServicesLib.h>
|
|
|
|
#include <Library/PeCoffExtraActionLib.h>
|
2020-04-09 05:20:39 +02:00
|
|
|
#include <Library/NetLib.h>
|
2018-08-23 07:02:52 +02:00
|
|
|
|
|
|
|
#define TEMPORARY_RAM_SIZE 0x20000
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
VOID *Address;
|
|
|
|
UINTN Size;
|
|
|
|
} NT_FD_INFO;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
EFI_PHYSICAL_ADDRESS Memory;
|
|
|
|
UINT64 Size;
|
|
|
|
} NT_SYSTEM_MEMORY;
|
|
|
|
|
|
|
|
RETURN_STATUS
|
|
|
|
EFIAPI
|
|
|
|
SecPeCoffGetEntryPoint (
|
|
|
|
IN VOID *Pe32Data,
|
|
|
|
IN OUT VOID **EntryPoint
|
|
|
|
);
|
|
|
|
|
|
|
|
VOID
|
|
|
|
SecLoadSecCore (
|
|
|
|
IN UINTN TemporaryRam,
|
|
|
|
IN UINTN TemporaryRamSize,
|
|
|
|
IN VOID *BootFirmwareVolumeBase,
|
|
|
|
IN UINTN BootFirmwareVolumeSize,
|
|
|
|
IN VOID *SecCorePe32File
|
|
|
|
)
|
2021-12-05 23:53:57 +01:00
|
|
|
|
2018-08-23 07:02:52 +02:00
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
This is the service to load the SEC Core from the Firmware Volume
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
TemporaryRam - Memory to use for SEC.
|
|
|
|
TemporaryRamSize - Size of Memory to use for SEC
|
|
|
|
BootFirmwareVolumeBase - Start of the Boot FV
|
|
|
|
SecCorePe32File - SEC Core PE32
|
|
|
|
|
|
|
|
Returns:
|
2020-02-07 02:07:19 +01:00
|
|
|
Success means control is transferred and thus we should never return
|
2018-08-23 07:02:52 +02:00
|
|
|
|
|
|
|
--*/
|
|
|
|
;
|
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
SecWinNtFdAddress (
|
|
|
|
IN UINTN Index,
|
|
|
|
IN OUT EFI_PHYSICAL_ADDRESS *FdBase,
|
|
|
|
IN OUT UINT64 *FdSize
|
|
|
|
)
|
2021-12-05 23:53:57 +01:00
|
|
|
|
2018-08-23 07:02:52 +02:00
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
|
|
|
TODO: Add function description
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
Index - TODO: add argument description
|
|
|
|
FdBase - TODO: add argument description
|
|
|
|
FdSize - TODO: add argument description
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
TODO: add return values
|
|
|
|
|
|
|
|
--*/
|
|
|
|
;
|
|
|
|
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
SecImageRead (
|
|
|
|
IN VOID *FileHandle,
|
|
|
|
IN UINTN FileOffset,
|
|
|
|
IN OUT UINTN *ReadSize,
|
|
|
|
OUT VOID *Buffer
|
|
|
|
)
|
2021-12-05 23:53:57 +01:00
|
|
|
|
2018-08-23 07:02:52 +02:00
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
|
|
|
TODO: Add function description
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
FileHandle - TODO: add argument description
|
|
|
|
FileOffset - TODO: add argument description
|
|
|
|
ReadSize - TODO: add argument description
|
|
|
|
Buffer - TODO: add argument description
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
TODO: add return values
|
|
|
|
|
|
|
|
--*/
|
|
|
|
;
|
|
|
|
|
|
|
|
CHAR16 *
|
|
|
|
AsciiToUnicode (
|
|
|
|
IN CHAR8 *Ascii,
|
|
|
|
IN UINTN *StrLen OPTIONAL
|
|
|
|
)
|
2021-12-05 23:53:57 +01:00
|
|
|
|
2018-08-23 07:02:52 +02:00
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
|
|
|
TODO: Add function description
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
Ascii - TODO: add argument description
|
|
|
|
StrLen - TODO: add argument description
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
TODO: add return values
|
|
|
|
|
|
|
|
--*/
|
|
|
|
;
|
|
|
|
|
|
|
|
UINTN
|
|
|
|
CountSeparatorsInString (
|
|
|
|
IN CONST CHAR16 *String,
|
|
|
|
IN CHAR16 Separator
|
|
|
|
)
|
2021-12-05 23:53:57 +01:00
|
|
|
|
2018-08-23 07:02:52 +02:00
|
|
|
/*++
|
|
|
|
|
|
|
|
Routine Description:
|
|
|
|
|
|
|
|
TODO: Add function description
|
|
|
|
|
|
|
|
Arguments:
|
|
|
|
|
|
|
|
String - TODO: add argument description
|
|
|
|
Separator - TODO: add argument description
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
|
|
|
TODO: add return values
|
|
|
|
|
|
|
|
--*/
|
|
|
|
;
|
|
|
|
|
|
|
|
BOOLEAN
|
|
|
|
EfiSystemMemoryRange (
|
|
|
|
IN VOID *MemoryAddress
|
|
|
|
);
|
2021-12-05 23:53:57 +01:00
|
|
|
|
2018-08-23 07:02:52 +02:00
|
|
|
VOID
|
|
|
|
SecInitializeThunk (
|
|
|
|
VOID
|
|
|
|
);
|
2021-12-05 23:53:57 +01:00
|
|
|
|
2018-08-23 07:02:52 +02:00
|
|
|
extern EMU_THUNK_PROTOCOL gEmuThunkProtocol;
|
2018-08-23 07:33:54 +02:00
|
|
|
extern EMU_IO_THUNK_PROTOCOL mWinNtWndThunkIo;
|
2018-08-23 07:43:00 +02:00
|
|
|
extern EMU_IO_THUNK_PROTOCOL mWinNtFileSystemThunkIo;
|
2018-08-23 09:36:15 +02:00
|
|
|
extern EMU_IO_THUNK_PROTOCOL mWinNtBlockIoThunkIo;
|
2020-04-09 05:20:39 +02:00
|
|
|
extern EMU_IO_THUNK_PROTOCOL mWinNtSnpThunkIo;
|
|
|
|
|
2018-08-29 05:39:06 +02:00
|
|
|
#endif
|