This commit is contained in:
Kenny Kerr 2019-10-08 08:33:26 -07:00
Родитель f088d90071
Коммит 41fcc9c9f2
6 изменённых файлов: 74 добавлений и 11 удалений

8
.gitignore поставляемый
Просмотреть файл

@ -1,7 +1,11 @@
.vscode
.vs
x86
x64
*.user
*_i.c
*_p.c
*.c
build
packages
Debug
Release
Generated Files

59
fast_fwd/x64/thunks.asm Normal file
Просмотреть файл

@ -0,0 +1,59 @@
; AMD64 fast forwarder thunk implementations
; Calling convention: https://docs.microsoft.com/en-us/cpp/build/calling-convention
include ksamd64.inc
extern __guard_check_icall_fptr:QWORD
NESTED_ENTRY InvokeForwarder, _TEXT
; Save enregistered args
push r9
push r8
push rdx
push rcx
END_PROLOGUE
; Create register shadow stack
sub rsp, 4 * 8
; Replace forwarder abi with owner abi
mov rdx, qword ptr[rcx + 8]
mov [rsp + 4 * 8], rdx
; Add offset and index
add rax, qword ptr [rcx + 16]
; Get method address from owner abi vtable
mov rcx, qword ptr [rdx]
mov rax, qword ptr [rcx + rax * 8]
; Verify indirect call target
call [__guard_check_icall_fptr]
; Remove register shadow stack
add rsp, 4 * 8
; Restore method address and args
pop rcx
pop rdx
pop r8
pop r9
; Jump to method
rex_jmp_reg rax
NESTED_END InvokeForwarder, _TEXT
; Define thunks
WINRT_FF_THUNK MACRO i
LEAF_ENTRY winrt_ff_thunk&i, _TEXT, NoPad
mov rax, i
jmp InvokeForwarder
LEAF_END winrt_ff_thunk&i, _TEXT
ENDM
include thunks.inc
END

Просмотреть файл

Просмотреть файл

@ -185,7 +185,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_HAS_AUTO_PTR_ETC;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(OutputPath);..\Composable\Generated Files;..\Component\Generated Files;..\Composable;..\Reflection\Generated Files;..\..\..\..\library</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(OutputPath);..\Composable\Generated Files;..\Component\Generated Files;..\Composable;..\Reflection\Generated Files;..\..\;</AdditionalIncludeDirectories>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<MinimalRebuild>false</MinimalRebuild>
@ -204,7 +204,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>_HAS_AUTO_PTR_ETC;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(OutputPath);..\Composable\Generated Files;..\Component\Generated Files;..\Composable;..\Reflection\Generated Files;..\..\..\..\library</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(OutputPath);..\Composable\Generated Files;..\Component\Generated Files;..\Composable;..\Reflection\Generated Files;..\..\;</AdditionalIncludeDirectories>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<MinimalRebuild>false</MinimalRebuild>
@ -225,7 +225,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_HAS_AUTO_PTR_ETC;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(OutputPath);..\Composable\Generated Files;..\Component\Generated Files;..\Composable;..\Reflection\Generated Files;..\..\..\..\library</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(OutputPath);..\Composable\Generated Files;..\Component\Generated Files;..\Composable;..\Reflection\Generated Files;..\..\;</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DisableSpecificWarnings>4100;4297;4458</DisableSpecificWarnings>
</ClCompile>
@ -244,7 +244,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>_HAS_AUTO_PTR_ETC;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(OutputPath);..\Composable\Generated Files;..\Component\Generated Files;..\Composable;..\Reflection\Generated Files;..\..\..\..\library</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(OutputPath);..\Composable\Generated Files;..\Component\Generated Files;..\Composable;..\Reflection\Generated Files;..\..\;</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<DisableSpecificWarnings>4100;4297;4458</DisableSpecificWarnings>
</ClCompile>

Просмотреть файл

@ -313,7 +313,7 @@
<Midl Include="test_component_fast.idl" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\fast_fwd\fast_fwd.vcxproj">
<ProjectReference Include="..\..\fast_fwd\fast_fwd.vcxproj">
<Project>{a63b3ad1-ab7b-461e-9fff-2447f5bcd459}</Project>
</ProjectReference>
</ItemGroup>

Просмотреть файл

@ -79,7 +79,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(OutputPath);Generated Files;..\..\..\library</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(OutputPath);Generated Files;..\;</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WINRT_DIAGNOSTICS;NOMINMAX;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
@ -99,7 +99,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(OutputPath);Generated Files;..\..\..\library</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(OutputPath);Generated Files;..\;</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WINRT_DIAGNOSTICS;NOMINMAX;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
@ -117,7 +117,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(OutputPath);Generated Files;..\..\..\library</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(OutputPath);Generated Files;..\;</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WINRT_DIAGNOSTICS;NOMINMAX;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
@ -137,7 +137,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(OutputPath);Generated Files;..\..\..\library</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(OutputPath);Generated Files;..\;</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WINRT_DIAGNOSTICS;NOMINMAX;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>