This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
externalmethodfixupthunk.S
100 lines (65 loc) · 3.32 KB
/
externalmethodfixupthunk.S
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
;
.intel_syntax noprefix
#include "unixasmmacros.inc"
#include "asmconstants.h"
//============================================================================================
// EXTERN_C VOID __stdcall ExternalMethodFixupStub()
NESTED_ENTRY ExternalMethodFixupStub, _TEXT, NoHandler
PROLOG_WITH_TRANSITION_BLOCK 0, 8, rsi, 0, 0
lea rdi, [rsp + __PWTB_TransitionBlock] // pTransitionBlock
sub rsi, 5 // pThunk
mov rdx, 0 // sectionIndex
mov rcx, 0 // pModule
call C_FUNC(ExternalMethodFixupWorker)
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
PATCH_LABEL ExternalMethodFixupPatchLabel
TAILJMP_RAX
NESTED_END ExternalMethodFixupStub, _TEXT
#ifdef FEATURE_READYTORUN
NESTED_ENTRY DelayLoad_MethodCall, _TEXT, NoHandler
PROLOG_WITH_TRANSITION_BLOCK 0, 0x10, rdx, rcx, 0
lea rdi, [rsp + __PWTB_TransitionBlock] // pTransitionBlock
mov rsi, rax // pIndirection
call C_FUNC(ExternalMethodFixupWorker)
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
// Share the patch label
jmp C_FUNC(ExternalMethodFixupPatchLabel)
NESTED_END DelayLoad_MethodCall, _TEXT
//============================================================================================
.macro DYNAMICHELPER frameFlags, suffix
NESTED_ENTRY DelayLoad_Helper\suffix, _TEXT, NoHandler
PROLOG_WITH_TRANSITION_BLOCK 0, 0x10, rdx, rcx, 0
mov r8, \frameFlags
lea rdi, [rsp + __PWTB_TransitionBlock] // pTransitionBlock
mov rsi, rax // pIndirection
call C_FUNC(DynamicHelperWorker)
test rax,rax
jnz LOCAL_LABEL(TailCallDelayLoad_Helper\suffix)
// The result is stored in the argument area of the transition block
mov rax, [rsp + __PWTB_TransitionBlock + OFFSETOF__TransitionBlock__m_argumentRegisters]
EPILOG_WITH_TRANSITION_BLOCK_RETURN
LOCAL_LABEL(TailCallDelayLoad_Helper\suffix):
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
TAILJMP_RAX
NESTED_END DelayLoad_Helper\suffix, _TEXT
.endm
DYNAMICHELPER DynamicHelperFrameFlags_Default
DYNAMICHELPER DynamicHelperFrameFlags_ObjectArg, _Obj
DYNAMICHELPER (DynamicHelperFrameFlags_ObjectArg | DynamicHelperFrameFlags_ObjectArg2), _ObjObj
#endif // FEATURE_READYTORUN
#ifdef FEATURE_PREJIT
//============================================================================================
// EXTERN_C VOID __stdcall VirtualMethodFixupStub()
NESTED_ENTRY VirtualMethodFixupStub, _TEXT, NoHandler
PROLOG_WITH_TRANSITION_BLOCK 0, 8, rsi, 0, 0
lea rdi, [rsp + __PWTB_TransitionBlock] // pTransitionBlock
sub rsi, 5 // pThunk
call C_FUNC(VirtualMethodFixupWorker)
EPILOG_WITH_TRANSITION_BLOCK_TAILCALL
PATCH_LABEL VirtualMethodFixupPatchLabel
TAILJMP_RAX
NESTED_END VirtualMethodFixupStub, _TEXT
#endif // FEATURE_PREJIT