Publish the files
This commit is contained in:
51
Builds/MiniVisor.sln
Normal file
51
Builds/MiniVisor.sln
Normal file
@@ -0,0 +1,51 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.28729.10
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{35DE61DD-9D91-4B1A-B082-8C80ED644749}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
..\.editorconfig = ..\.editorconfig
|
||||
..\.gitattributes = ..\.gitattributes
|
||||
..\.gitignore = ..\.gitignore
|
||||
..\LICENSE = ..\LICENSE
|
||||
PreLinkEvent.py = PreLinkEvent.py
|
||||
..\README.md = ..\README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MiniVisor", "..\Sources\MiniVisor.vcxproj", "{B94B175C-8D18-47E2-800C-1AFBAAC7AC73}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Platform", "Platform", "{3C22D872-3490-4292-A646-A6DFDA461CED}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EFI", "EFI", "{278A0532-B8F9-4F76-AB0A-946AD377B07A}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Platform\EFI\locate_image_base.py = Platform\EFI\locate_image_base.py
|
||||
Platform\EFI\MiniVisorDxe.inf = Platform\EFI\MiniVisorDxe.inf
|
||||
Platform\EFI\MiniVisorPkg.dec = Platform\EFI\MiniVisorPkg.dec
|
||||
Platform\EFI\MiniVisorPkg.dsc = Platform\EFI\MiniVisorPkg.dsc
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Release|x64 = Release|x64
|
||||
UEFI|x64 = UEFI|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B94B175C-8D18-47E2-800C-1AFBAAC7AC73}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B94B175C-8D18-47E2-800C-1AFBAAC7AC73}.Debug|x64.Build.0 = Debug|x64
|
||||
{B94B175C-8D18-47E2-800C-1AFBAAC7AC73}.Release|x64.ActiveCfg = Release|x64
|
||||
{B94B175C-8D18-47E2-800C-1AFBAAC7AC73}.Release|x64.Build.0 = Release|x64
|
||||
{B94B175C-8D18-47E2-800C-1AFBAAC7AC73}.UEFI|x64.ActiveCfg = UEFI|x64
|
||||
{B94B175C-8D18-47E2-800C-1AFBAAC7AC73}.UEFI|x64.Build.0 = UEFI|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{3C22D872-3490-4292-A646-A6DFDA461CED} = {35DE61DD-9D91-4B1A-B082-8C80ED644749}
|
||||
{278A0532-B8F9-4F76-AB0A-946AD377B07A} = {3C22D872-3490-4292-A646-A6DFDA461CED}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {FF5CF53A-DB6B-415D-9F6C-135AFA73B8FB}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
2572
Builds/Minivisor.doxyfile
Normal file
2572
Builds/Minivisor.doxyfile
Normal file
File diff suppressed because it is too large
Load Diff
94
Builds/Platform/EFI/MiniVisorDxe.inf
Normal file
94
Builds/Platform/EFI/MiniVisorDxe.inf
Normal file
@@ -0,0 +1,94 @@
|
||||
[Defines]
|
||||
INF_VERSION = 1.27
|
||||
BASE_NAME = MiniVisorDxe
|
||||
FILE_GUID = 503682AC-F01E-4D10-AAE3-BE5A90A563E7
|
||||
MODULE_TYPE = DXE_RUNTIME_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
ENTRY_POINT = DriverEntry
|
||||
UNLOAD_IMAGE = DriverUnload
|
||||
|
||||
[Sources]
|
||||
../../../Sources/Platform/EFI/EfiAsm.asm
|
||||
../../../Sources/Platform/EFI/EfiAsm.h
|
||||
../../../Sources/Platform/EFI/EfiBitmap.c
|
||||
../../../Sources/Platform/EFI/EfiBitmap.h
|
||||
../../../Sources/Platform/EFI/EfiCommon.h
|
||||
../../../Sources/Platform/EFI/EfiHostInitialization.c
|
||||
../../../Sources/Platform/EFI/EfiHostInitialization.h
|
||||
../../../Sources/Platform/EFI/EfiLogger.c
|
||||
../../../Sources/Platform/EFI/EfiLogger.h
|
||||
../../../Sources/Platform/EFI/EfiPlatform.c
|
||||
../../../Sources/Platform/EFI/EfiPlatform.h
|
||||
../../../Sources/ExtendedPageTables.c
|
||||
../../../Sources/ExtendedPageTables.h
|
||||
../../../Sources/HostMain.c
|
||||
../../../Sources/HostMain.h
|
||||
#../../../Sources/HostNesting.c
|
||||
../../../Sources/HostNesting.h
|
||||
../../../Sources/HostUtils.c
|
||||
../../../Sources/HostUtils.h
|
||||
../../../Sources/HostVmcall.c
|
||||
../../../Sources/HostVmcall.h
|
||||
../../../Sources/Logger.h
|
||||
../../../Sources/MemoryAccess.c
|
||||
../../../Sources/MemoryAccess.h
|
||||
../../../Sources/MemoryManager.c
|
||||
../../../Sources/MemoryManager.h
|
||||
../../../Sources/MemoryType.c
|
||||
../../../Sources/MemoryType.h
|
||||
../../../Sources/MiniVisor.c
|
||||
../../../Sources/MiniVisor.h
|
||||
../../../Sources/Platform.h
|
||||
../../../Sources/Utils.c
|
||||
../../../Sources/Utils.h
|
||||
../../../Sources/Ia32.h
|
||||
../../../Sources/Asm.asm
|
||||
../../../Sources/Asm.h
|
||||
../../../Sources/Common.h
|
||||
../../../Sources/ia32-doc/out/ia32.h
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MiniVisorPkg/Builds/Platform/EFI/MiniVisorPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
UefiDriverEntryPoint
|
||||
UefiLib
|
||||
DevicePathLib
|
||||
SynchronizationLib
|
||||
MemoryAllocationLib
|
||||
PrintLib
|
||||
|
||||
[Protocols]
|
||||
gEfiLoadedImageProtocolGuid ## CONSUMES
|
||||
gEfiMpServiceProtocolGuid ## CONSUMES
|
||||
|
||||
[Guids]
|
||||
gEfiEventExitBootServicesGuid ## CONSUMES
|
||||
gEfiEventVirtualAddressChangeGuid ## CONSUMES
|
||||
|
||||
[Depex]
|
||||
TRUE
|
||||
|
||||
[BuildOptions.common.DXE_RUNTIME_DRIVER]
|
||||
# Detect use of deprecated interfaces if any.
|
||||
MSFT:*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES
|
||||
|
||||
# Remove DebugLib library instances (ASSERT and such) from the RELEASE binary.
|
||||
# https://github.com/tianocore-docs/edk2-UefiDriverWritersGuide/blob/master/31_testing_and_debugging_uefi_drivers/314_debugging_code_statements/3141_configuring_debuglib_with_edk_ii.md
|
||||
MSFT:RELEASE_*_*_CC_FLAGS = -D MDEPKG_NDEBUG
|
||||
|
||||
# EDK2 default defines /ALIGN:32, which is way too small for and causes link
|
||||
# error. Reset to the default value.
|
||||
MSFT:*_*_*_DLINK_FLAGS = /ALIGN:4096 /DEBUG
|
||||
|
||||
# By default, certain meta-data in the PE header is zeroed out to increase
|
||||
# compression ratio. Some of those information can be helpful for a debugger,
|
||||
# for example, to reconstruct stack trace. Leave it for such cases. See also,
|
||||
# https://edk2-docs.gitbooks.io/edk-ii-basetools-user-guides/content/GenFw.html
|
||||
MSFT:*_*_X64_GENFW_FLAGS = --keepexceptiontable --keepzeropending --keepoptionalheader
|
||||
|
||||
# Finally, note that the RELEASE build will generate excessively large binary
|
||||
# file. To avoid this open the Conf/tools_def.txt, locate the below line,
|
||||
# RELEASE_VS2019_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4001 /IGNORE:4281 /IGNORE:4254 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:X64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.rdata=.data
|
||||
# then, remove "/MERGE:.rdata=.data".
|
||||
9
Builds/Platform/EFI/MiniVisorPkg.dec
Normal file
9
Builds/Platform/EFI/MiniVisorPkg.dec
Normal file
@@ -0,0 +1,9 @@
|
||||
[Defines]
|
||||
DEC_SPECIFICATION = 1.27
|
||||
PACKAGE_NAME = MiniVisorPkg
|
||||
PACKAGE_GUID = 6BFA833B-A9DF-490D-AF7E-7F92A80E3F9A
|
||||
PACKAGE_VERSION = 1.00
|
||||
|
||||
[Includes]
|
||||
../../../Sources
|
||||
../../../Sources/Platform/EFI
|
||||
51
Builds/Platform/EFI/MiniVisorPkg.dsc
Normal file
51
Builds/Platform/EFI/MiniVisorPkg.dsc
Normal file
@@ -0,0 +1,51 @@
|
||||
[Defines]
|
||||
DSC_SPECIFICATION = 1.28
|
||||
PLATFORM_NAME = MiniVisor
|
||||
PLATFORM_GUID = C5ACE17D-FD90-44F7-847C-693ED2B8BEF9
|
||||
PLATFORM_VERSION = 1.00
|
||||
OUTPUT_DIRECTORY = Build/MiniVisor
|
||||
SUPPORTED_ARCHITECTURES = X64
|
||||
BUILD_TARGETS = DEBUG|RELEASE|NOOPT
|
||||
SKUID_IDENTIFIER = DEFAULT
|
||||
|
||||
[LibraryClasses]
|
||||
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
|
||||
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
|
||||
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
||||
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
|
||||
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
|
||||
CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
|
||||
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
|
||||
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
|
||||
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
|
||||
DevicePathLib|MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevicePathProtocol.inf
|
||||
!if $(TARGET) == RELEASE
|
||||
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
|
||||
!else
|
||||
!ifdef $(DEBUG_ON_SERIAL_PORT)
|
||||
IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsicSev.inf
|
||||
SerialPortLib|PcAtChipsetPkg/Library/SerialIoLib/SerialIoLib.inf
|
||||
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
|
||||
!else
|
||||
DebugLib|MdePkg/Library/UefiDebugLibConOut/UefiDebugLibConOut.inf
|
||||
!endif
|
||||
!endif
|
||||
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
|
||||
|
||||
[LibraryClasses.common.DXE_RUNTIME_DRIVER]
|
||||
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
|
||||
BaseMemoryLib|MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
|
||||
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
|
||||
|
||||
[PcdsFixedAtBuild]
|
||||
# Define DEBUG_ERROR | DEBUG_VERBOSE | DEBUG_INFO | DEBUG_WARN to enable
|
||||
# logging at those levels. Also, define DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED
|
||||
# and such. Assertion failure will call CpuDeadLoop.
|
||||
# https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Debugging
|
||||
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80400042
|
||||
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2f
|
||||
|
||||
[Components]
|
||||
MiniVisorPkg/Builds/Platform/EFI/MiniVisorDxe.inf
|
||||
13
Builds/Platform/EFI/locate_image_base.py
Normal file
13
Builds/Platform/EFI/locate_image_base.py
Normal file
@@ -0,0 +1,13 @@
|
||||
current_page_base = idaapi.get_reg_val('rip') & (~0xfff)
|
||||
offset = 0
|
||||
while idc.read_dbg_word(current_page_base - offset) != 0x5a4d:
|
||||
offset += 0x1000
|
||||
|
||||
image_base = current_page_base - offset
|
||||
print(
|
||||
f'Base found at 0x{image_base:02X}. To load symbols, go [File] menu >'
|
||||
f' Load file > PDB file..., then set,\n'
|
||||
f' Input file: the PDB file, for example, C:\\edk2\\MiniVisorPkg\\Builds\\x64\\UEFI\\MiniVisorDxe.pdb\n'
|
||||
f' Address: 0x{image_base:02X}\n'
|
||||
f'and hit [OK], and then, [Yes].'
|
||||
)
|
||||
66
Builds/Platform/Windows/DumpActiveLogs.js
Normal file
66
Builds/Platform/Windows/DumpActiveLogs.js
Normal file
@@ -0,0 +1,66 @@
|
||||
/*!
|
||||
@file DumpActiveLogs.js
|
||||
|
||||
@brief Implements the DumpActiveLogs function which dumps buffered log entries.
|
||||
|
||||
@author Satoshi Tanda
|
||||
|
||||
@copyright Copyright (c) 2019 - , Satoshi Tanda. All rights reserved.
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
function initializeScript()
|
||||
{
|
||||
return [new host.apiVersionSupport(1, 3)];
|
||||
}
|
||||
|
||||
function invokeScript()
|
||||
{
|
||||
//
|
||||
// Insert your script content here. This method will be called whenever the script is
|
||||
// invoked from a client.
|
||||
//
|
||||
// See the following for more details:
|
||||
//
|
||||
// https://aka.ms/JsDbgExt
|
||||
//
|
||||
}
|
||||
|
||||
const log = x => host.diagnostics.debugLog(x + "\n");
|
||||
const u64 = x => host.memory.readMemoryValues(x, 1, 8)[0];
|
||||
const sizeof = x => host.evaluateExpression("sizeof(" + x + ")");
|
||||
const str = (x) => host.memory.readString(x);
|
||||
const strn = (x, y) => host.memory.readString(x, y);
|
||||
|
||||
/**
|
||||
* Returns an array of arrays of log entries where 0=ProcessName, 1=FunctionName,
|
||||
* and 2=LogMessage.
|
||||
*
|
||||
* Example:
|
||||
* kd> .scriptload C:\edk2\MiniVisorPkg\Builds\Platform\Windows\DumpActiveLogs.js
|
||||
* kd> dx Debugger.State.Scripts.DumpActiveLogs.Contents.DumpActiveLogs(),0xffff
|
||||
*/
|
||||
function DumpActiveLogs()
|
||||
{
|
||||
let addr = host.getModuleSymbolAddress("MiniVisor", "g_Logger");
|
||||
let context = host.createPointerObject(u64(addr), "MiniVisor", "LOGGER_CONTEXT*");
|
||||
let entriesBase = context.PairedLogBuffer.ActiveLogBuffer.LogEntries;
|
||||
|
||||
let logs = [];
|
||||
host.diagnostics.debugLog("Collecting buffered log entries.");
|
||||
for (let offset = 0; offset < context.PairedLogBuffer.ActiveLogBuffer.NextLogOffset; /**/)
|
||||
{
|
||||
let entry = host.createPointerObject(entriesBase.address.add(offset),
|
||||
"MiniVisor",
|
||||
"_DEBUG_LOG_ENTRY*");
|
||||
logs.push([
|
||||
str(entry.ProcessName),
|
||||
str(entry.FunctionName),
|
||||
strn(entry.LogMessage, entry.LogMessageLength),
|
||||
]);
|
||||
offset += sizeof("_DEBUG_LOG_ENTRY") - 1 + entry.LogMessageLength;
|
||||
host.diagnostics.debugLog(".");
|
||||
}
|
||||
host.diagnostics.debugLog("\n");
|
||||
return logs;
|
||||
}
|
||||
30
Builds/PreLinkEvent.py
Normal file
30
Builds/PreLinkEvent.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
def main():
|
||||
path = sys.argv[1]
|
||||
out_dir = sys.argv[2]
|
||||
|
||||
lib_files = []
|
||||
for root, _, files in os.walk(path):
|
||||
for file in files:
|
||||
if '.lib' in file:
|
||||
lib_files.append(os.path.join(root, file))
|
||||
|
||||
if not os.path.exists(out_dir):
|
||||
os.mkdir(out_dir)
|
||||
for lib_file in lib_files:
|
||||
shutil.copy(lib_file, out_dir)
|
||||
|
||||
print(
|
||||
'If you see link error, rebuild the project with the EDK2 build command'
|
||||
' and try again. If you still see error, try updating dependencies.\n'
|
||||
'To do so, open the project properties, "Linker" > "Input", and update'
|
||||
' "Additional Dependencies" with the following:'
|
||||
)
|
||||
print(' ' + ';'.join([os.path.basename(lib_file) for lib_file in lib_files]))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user