Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 21865ee

Browse files
committed
Implement GenericComCallStub
1 parent 5e29b59 commit 21865ee

File tree

5 files changed

+37
-27
lines changed

5 files changed

+37
-27
lines changed

src/coreclr/vm/comtoclrcall.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,6 @@ class ComCallMethodDesc
325325
return -COMMETHOD_PREPAD;
326326
}
327327

328-
static DWORD GetOffsetOfMethodDesc()
329-
{
330-
LIMITED_METHOD_CONTRACT;
331-
return ((DWORD) offsetof(class ComCallMethodDesc, m_pMD));
332-
}
333-
334328
//get call sig
335329
PCCOR_SIGNATURE GetSig(DWORD *pcbSigSize = NULL)
336330
{

src/coreclr/vm/dllimportcallback.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,6 @@ class UMEntryThunk
308308
RETURN m_pMD;
309309
}
310310

311-
static DWORD GetOffsetOfMethodDesc()
312-
{
313-
LIMITED_METHOD_CONTRACT;
314-
return offsetof(class UMEntryThunk, m_pMD);
315-
}
316-
317311
static DWORD GetCodeOffset()
318312
{
319313
LIMITED_METHOD_CONTRACT;

src/coreclr/vm/frames.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,20 +1820,6 @@ class UnmanagedToManagedFrame : public Frame
18201820
return m_pvDatum;
18211821
}
18221822

1823-
static int GetOffsetOfDatum()
1824-
{
1825-
LIMITED_METHOD_CONTRACT;
1826-
return offsetof(UnmanagedToManagedFrame, m_pvDatum);
1827-
}
1828-
1829-
#ifdef TARGET_X86
1830-
static int GetOffsetOfCalleeSavedRegisters()
1831-
{
1832-
LIMITED_METHOD_CONTRACT;
1833-
return offsetof(UnmanagedToManagedFrame, m_calleeSavedRegisters);
1834-
}
1835-
#endif
1836-
18371823
int GetFrameType()
18381824
{
18391825
LIMITED_METHOD_DAC_CONTRACT;

src/coreclr/vm/i386/asmconstants.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ ASMCONSTANTS_C_ASSERT(OFFSETOF__FrameHandlerExRecord__m_pEntryFrame == offsetof(
212212
#define STACK_OVERWRITE_BARRIER_VALUE 0xabcdefab
213213
#endif
214214

215+
#define COMMETHOD_PREPAD_ASM 8
216+
ASMCONSTANTS_C_ASSERT(COMMETHOD_PREPAD_ASM == COMMETHOD_PREPAD)
215217
#endif
216218

217219
#define CLRToCOMCallMethodDesc__m_pCLRToCOMCallInfo DBG_FRE(0x20, 0xC)

src/coreclr/vm/i386/asmhelpers.asm

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ EXTERN _TheUMEntryPrestubWorker@4:PROC
4646

4747
ifdef FEATURE_COMINTEROP
4848
EXTERN _CLRToCOMWorker@8:PROC
49+
EXTERN _COMToCLRWorker@4:PROC
4950
endif
5051

5152
EXTERN _ExternalMethodFixupWorker@16:PROC
@@ -1237,7 +1238,40 @@ _GenericCLRToCOMCallStub@0 proc public
12371238
_GenericCLRToCOMCallStub@0 endp
12381239

12391240
_GenericComCallStub@0 proc public
1240-
int 3
1241+
; push ebp-frame
1242+
push ebp
1243+
mov ebp,esp
1244+
1245+
; save CalleeSavedRegisters
1246+
push ebx
1247+
push esi
1248+
push edi
1249+
1250+
push eax ; datum
1251+
sub esp, 3*4 ; next, vtable, gscookie
1252+
1253+
lea eax, [esp+4]
1254+
1255+
push eax
1256+
call _COMToCLRWorker@4
1257+
1258+
add esp, 3*4
1259+
1260+
; pop the MethodDesc*
1261+
pop ecx
1262+
1263+
; pop CalleeSavedRegisters
1264+
pop edi
1265+
pop esi
1266+
pop ebx
1267+
pop ebp
1268+
1269+
sub ecx, COMMETHOD_PREPAD_ASM
1270+
jmp ecx
1271+
1272+
; This will never be executed. It is just to help out stack-walking logic
1273+
; which disassembles the epilog to unwind the stack.
1274+
ret
12411275

12421276
_GenericComCallStub@0 endp
12431277

0 commit comments

Comments
 (0)