diff options
author | Alex Ionescu <aionescu@gmail.com> | 2017-11-06 17:36:23 +0300 |
---|---|---|
committer | Alex Ionescu <aionescu@gmail.com> | 2017-11-06 17:36:23 +0300 |
commit | a44424d9a8e8756d1deeb8fdb8dc6aeef99b5d57 (patch) | |
tree | 2336e3828d8111d585a0ab20a1ae6e7a77876718 | |
parent | 6ca25d46717cdce217cc2cea1cc49a05a102deac (diff) |
Properly support building for UEFI vs NT with VisualUefi
Refactor all project files/settings to support dual build. User should
set EDK_PATH to their checked out copy of VisualUefi.
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | nt/nt.default.props | 11 | ||||
-rw-r--r-- | nt/nt.props | 16 | ||||
-rw-r--r-- | nt/shvos.c | 2 | ||||
-rw-r--r-- | shv.sln | 19 | ||||
-rw-r--r-- | shv.vcxproj | 72 | ||||
-rw-r--r-- | shv.vcxproj.filters | 38 | ||||
-rw-r--r-- | uefi/shvos.c | 4 | ||||
-rw-r--r-- | uefi/uefi.default.props | 23 | ||||
-rw-r--r-- | uefi/uefi.props | 60 |
10 files changed, 146 insertions, 107 deletions
@@ -1,6 +1,2 @@ -*.opendb -shv.sdf -x64/Optimized -*.suo -*.user -*.db
\ No newline at end of file +x64 +.vs
\ No newline at end of file diff --git a/nt/nt.default.props b/nt/nt.default.props new file mode 100644 index 0000000..6e9979a --- /dev/null +++ b/nt/nt.default.props @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="Configuration"> + <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> + <ConfigurationType>Driver</ConfigurationType> + <DriverType>WDM</DriverType> + <UseDebugLibraries>false</UseDebugLibraries> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> +</Project> diff --git a/nt/nt.props b/nt/nt.props new file mode 100644 index 0000000..8b2485a --- /dev/null +++ b/nt/nt.props @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <ItemDefinitionGroup> + <ClCompile> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <OmitFramePointers>true</OmitFramePointers> + <BufferSecurityCheck>false</BufferSecurityCheck> + <ControlFlowGuard>false</ControlFlowGuard> + </ClCompile> + <Link> + <EntryPointSymbol>DriverEntry</EntryPointSymbol> + </Link> + </ItemDefinitionGroup> +</Project> @@ -22,7 +22,7 @@ Environment: #include <ntifs.h> #include <stdarg.h> -#include "shv_x.h" +#include "..\shv_x.h" #pragma warning(disable:4221) #pragma warning(disable:4204) @@ -1,20 +1,25 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.24720.0 +# Visual Studio 15 +VisualStudioVersion = 15.0.26823.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleVisor", "shv.vcxproj", "{4C048BB2-7E8D-43BF-B29D-942461275023}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shv", "shv.vcxproj", "{4C048BB2-7E8D-43BF-B29D-942461275023}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Optimized|x64 = Optimized|x64 + UEFI|x64 = UEFI|x64 + Windows NT|x64 = Windows NT|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4C048BB2-7E8D-43BF-B29D-942461275023}.Optimized|x64.ActiveCfg = Optimized|x64 - {4C048BB2-7E8D-43BF-B29D-942461275023}.Optimized|x64.Build.0 = Optimized|x64 - {4C048BB2-7E8D-43BF-B29D-942461275023}.Optimized|x64.Deploy.0 = Optimized|x64 + {4C048BB2-7E8D-43BF-B29D-942461275023}.UEFI|x64.ActiveCfg = UEFI|x64 + {4C048BB2-7E8D-43BF-B29D-942461275023}.UEFI|x64.Build.0 = UEFI|x64 + {4C048BB2-7E8D-43BF-B29D-942461275023}.Windows NT|x64.ActiveCfg = NT|x64 + {4C048BB2-7E8D-43BF-B29D-942461275023}.Windows NT|x64.Build.0 = NT|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {638D3E2C-5547-469D-B2E2-43ED56005273} + EndGlobalSection EndGlobal diff --git a/shv.vcxproj b/shv.vcxproj index 83c4c65..2ed08b7 100644 --- a/shv.vcxproj +++ b/shv.vcxproj @@ -1,69 +1,41 @@ <?xml version="1.0" encoding="utf-8"?> <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Optimized|x64"> - <Configuration>Optimized</Configuration> + <ProjectConfiguration Include="NT|x64"> + <Configuration>NT</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="UEFI|x64"> + <Configuration>UEFI</Configuration> <Platform>x64</Platform> </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> + <Keyword>Win32Proj</Keyword> <ProjectGuid>{4C048BB2-7E8D-43BF-B29D-942461275023}</ProjectGuid> - <TemplateGuid>{497e31cb-056b-4f31-abb8-447fd55ee5a5}</TemplateGuid> - <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> - <MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion> - <Configuration>Debug</Configuration> - <Platform Condition="'$(Platform)' == ''">Win32</Platform> - <RootNamespace>HyperPlatform</RootNamespace> - <ProjectName>SimpleVisor</ProjectName> <WindowsTargetPlatformVersion>$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion> </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Label="Configuration"> - <TargetVersion>WindowsV6.3</TargetVersion> - <UseDebugLibraries>false</UseDebugLibraries> - <PlatformToolset>WindowsKernelModeDriver10.0</PlatformToolset> - <ConfigurationType>Driver</ConfigurationType> - <DriverType>WDM</DriverType> - <DriverTargetPlatform>Desktop</DriverTargetPlatform> - </PropertyGroup> + <Import Project="$(Configuration)\$(Configuration).default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)'=='UEFI'"> + <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" /> + </ImportGroup> + <Import Project="$(Configuration)\$(Configuration).props" /> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)'=='UEFI'"> + <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> + </ImportGroup> <PropertyGroup> - <EnableInf2cat>false</EnableInf2cat> + <IncludePath>$(IncludePath);$(VC_IncludePath)</IncludePath> </PropertyGroup> - <ItemDefinitionGroup> - <ClCompile> - <Optimization>Full</Optimization> - <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> - <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> - <OmitFramePointers>true</OmitFramePointers> - <WholeProgramOptimization>true</WholeProgramOptimization> - <MultiProcessorCompilation>true</MultiProcessorCompilation> - <BufferSecurityCheck>false</BufferSecurityCheck> - <ControlFlowGuard>false</ControlFlowGuard> - </ClCompile> - <Link /> - <Link> - <AdditionalDependencies>$(KernelBufferOverflowLib);$(DDK_LIB_PATH)ntoskrnl.lib;$(DDK_LIB_PATH)hal.lib;$(DDK_LIB_PATH)wmilib.lib</AdditionalDependencies> - <EntryPointSymbol>DriverEntry</EntryPointSymbol> - <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> - <Profile>false</Profile> - <MergeSections>_TEXT=.text;_PAGE=PAGE</MergeSections> - <AdditionalOptions>/ALIGN:0x10 %(AdditionalOptions)</AdditionalOptions> - <GenerateDebugInformation>Debug</GenerateDebugInformation> - <ProfileGuidedDatabase /> - <Driver>NotSet</Driver> - </Link> - </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="shv.c" /> <ClCompile Include="shvutil.c" /> <ClCompile Include="shvvmx.c" /> <ClCompile Include="shvvmxhv.c" /> <ClCompile Include="shvvp.c" /> - <ClCompile Include="nt\shvos.c" /> - <ClCompile Include="uefi\shvos.c"> - <ExcludedFromBuild>true</ExcludedFromBuild> - </ClCompile> + <ClCompile Include="$(Configuration)\shvos.c"/> </ItemGroup> <ItemGroup> <ClInclude Include="shv.h" /> @@ -73,12 +45,6 @@ </ItemGroup> <ItemGroup> <MASM Include="shvvmxhvx64.asm" /> - <MASM Include="nt\shvosx64.asm" /> - <MASM Include="uefi\shvosx64.asm"> - <ExcludedFromBuild>true</ExcludedFromBuild> - </MASM> + <MASM Include="$(Configuration)\shvosx64.asm"/> </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> </Project>
\ No newline at end of file diff --git a/shv.vcxproj.filters b/shv.vcxproj.filters deleted file mode 100644 index 6e2914c..0000000 --- a/shv.vcxproj.filters +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <ClCompile Include="shv.c" /> - <ClCompile Include="shvutil.c" /> - <ClCompile Include="shvvmx.c" /> - <ClCompile Include="shvvmxhv.c" /> - <ClCompile Include="shvvp.c" /> - <ClCompile Include="nt\shvos.c"> - <Filter>NT</Filter> - </ClCompile> - <ClCompile Include="uefi\shvos.c"> - <Filter>UEFI</Filter> - </ClCompile> - </ItemGroup> - <ItemGroup> - <ClInclude Include="shv.h" /> - <ClInclude Include="ntint.h" /> - <ClInclude Include="shv_x.h" /> - <ClInclude Include="vmx.h" /> - </ItemGroup> - <ItemGroup> - <Filter Include="NT"> - <UniqueIdentifier>{dbe9fd1c-cc57-4f03-a093-03b3312ec3ac}</UniqueIdentifier> - </Filter> - <Filter Include="UEFI"> - <UniqueIdentifier>{1bdf620e-c034-447a-bf4f-c9e7004a2328}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <MASM Include="nt\shvosx64.asm"> - <Filter>NT</Filter> - </MASM> - <MASM Include="uefi\shvosx64.asm"> - <Filter>UEFI</Filter> - </MASM> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/uefi/shvos.c b/uefi/shvos.c index db19f21..6a8afa9 100644 --- a/uefi/shvos.c +++ b/uefi/shvos.c @@ -49,8 +49,8 @@ Environment: // // External SimpleVisor Headers // -#include "ntint.h" -#include "shv_x.h" +#include "..\ntint.h" +#include "..\shv_x.h" // // We run on any UEFI Specification diff --git a/uefi/uefi.default.props b/uefi/uefi.default.props new file mode 100644 index 0000000..c651b7b --- /dev/null +++ b/uefi/uefi.default.props @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup Label="UserMacros"> + <EDK_PATH>C:\Users\aione\Documents\GitHub\VisualUefi\edk2</EDK_PATH> + </PropertyGroup> + <PropertyGroup> + <IncludePath>$(EDK_PATH)\MdePkg\Include;$(EDK_PATH)\MdePkg\Include\X64;$(EDK_PATH)\ShellPkg\Include;$(EDK_PATH)\CryptoPkg\Include</IncludePath> + <LibraryPath>$(EDK_PATH)\..\EDK-II\$(Platform)\Release</LibraryPath> + </PropertyGroup> + <PropertyGroup Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v141</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <ItemGroup> + <BuildMacro Include="EDK_PATH"> + <Value>$(EDK_PATH)</Value> + </BuildMacro> + </ItemGroup> +</Project> diff --git a/uefi/uefi.props b/uefi/uefi.props new file mode 100644 index 0000000..2841656 --- /dev/null +++ b/uefi/uefi.props @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ImportGroup Label="PropertySheets" /> + <PropertyGroup> + <GenerateManifest /> + <TargetExt>.efi</TargetExt> + </PropertyGroup> + <ItemDefinitionGroup> + <ClCompile> + <WholeProgramOptimization>true</WholeProgramOptimization> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <Optimization>MinSpace</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <OmitFramePointers>true</OmitFramePointers> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <ExceptionHandling>SyncCThrow</ExceptionHandling> + <BufferSecurityCheck>false</BufferSecurityCheck> + <ControlFlowGuard>false</ControlFlowGuard> + <FunctionLevelLinking>true</FunctionLevelLinking> + <ForcedIncludeFiles>$(EDK_PATH)\..\EDK-II\BaseLib\vshacks.h</ForcedIncludeFiles> + <CallingConvention /> + <TreatWChar_tAsBuiltInType /> + <StringPooling>true</StringPooling> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <ForceConformanceInForLoopScope /> + <AdditionalOptions>/Gs32768 %(AdditionalOptions)</AdditionalOptions> + <ErrorReporting /> + <FloatingPointModel /> + </ClCompile> + <Link> + <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> + <AdditionalDependencies>UefiHiiLib.lib;UefiHiiServicesLib.lib;UefiSortLib.lib;UefiShellLib.lib;GlueLib.lib;BaseLib.lib;BaseDebugPrintErrorLevelLib.lib;BasePrintLib.lib;UefiLib.lib;UefiBootServicesTableLib.lib;UefiRuntimeServicesTableLib.lib;UefiDevicePathLibDevicePathProtocol.lib;UefiDebugLibConOut.lib;UefiMemoryLib.lib;UefiMemoryAllocationLib.lib;BaseSynchronizationLib.lib;UefiFileHandleLib.lib;UefiApplicationEntryPoint.lib</AdditionalDependencies> + <GenerateDebugInformation>DebugFastLink</GenerateDebugInformation> + <SubSystem>EFI Application</SubSystem> + <Driver>Driver</Driver> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding /> + <LinkTimeCodeGeneration>UseFastLinkTimeCodeGeneration</LinkTimeCodeGeneration> + <BaseAddress>0</BaseAddress> + <SectionAlignment>32</SectionAlignment> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <RandomizedBaseAddress /> + <DataExecutionPrevention /> + <ManifestFile /> + <AllowIsolation /> + <EnableUAC /> + <UACExecutionLevel /> + <UACUIAccess /> + <TypeLibraryResourceID /> + <AdditionalOptions>/OPT:ICF=10 /IGNORE:4001 /IGNORE:4254 %(AdditionalOptions)</AdditionalOptions> + <MergeSections>.rdata=.data</MergeSections> + <SpecifySectionAttributes>.xdata,D</SpecifySectionAttributes> + <LinkErrorReporting /> + <ProfileGuidedDatabase /> + <EntryPointSymbol>EfiMain</EntryPointSymbol> + </Link> + </ItemDefinitionGroup> +</Project>
\ No newline at end of file |