diff options
author | Jan Vorlicek <janvorli@microsoft.com> | 2016-12-10 10:52:34 +0300 |
---|---|---|
committer | Jan Vorlicek <janvorli@microsoft.com> | 2016-12-10 10:52:34 +0300 |
commit | 5c3855f690cb5cae7c7877e350814792fc55eb10 (patch) | |
tree | 9d068c46a48448570a4dc64ddf9c1a7449777e93 /src/Native/Runtime/i386 | |
parent | 7f209e8c88359a4e8e756aa385ed71e950569154 (diff) |
This change fixes interface dispatch on ARM and x86 in case the RhpCastableObjectDispatchHelper is jumped-to from RhpInterfaceDispatchX functions. The RhpInterfaceDispatchX were not preserving r12 on ARM / eax on x86 that contain the address of the indirection cell, which lead to failures.
The fix is to let RhpCastableObjectDispatchHelper accept the cache entry pointer in r12 / eax instead.
I have also updated the CastableObject.cs based on Fadi Hanna's suggestion so that it can catch the issue this change fixes.
[tfs-changeset: 1641040]
Diffstat (limited to 'src/Native/Runtime/i386')
-rw-r--r-- | src/Native/Runtime/i386/StubDispatch.asm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Native/Runtime/i386/StubDispatch.asm b/src/Native/Runtime/i386/StubDispatch.asm index 775b26fe8..5bfcc00df 100644 --- a/src/Native/Runtime/i386/StubDispatch.asm +++ b/src/Native/Runtime/i386/StubDispatch.asm @@ -73,9 +73,11 @@ _RhpTailCallTLSDispatchCell proc public _RhpTailCallTLSDispatchCell endp _RhpCastableObjectDispatchHelper_TailCalled proc public + push ebp + mov ebp, esp ;; Load the dispatch cell out of the TLS variable GET_TLS_DISPATCH_CELL - jmp _RhpCastableObjectDispatchHelper + jmp _RhpCastableObjectDispatchHelper2 _RhpCastableObjectDispatchHelper_TailCalled endp _RhpCastableObjectDispatchHelper proc public @@ -87,6 +89,11 @@ _RhpCastableObjectDispatchHelper proc public ;; If the initial lookup fails, call into managed under the universal thunk ;; to run the full lookup routine + ;; EAX currently contains the cache block. We need to point it to the + ;; indirection cell using the back pointer in the cache block + mov eax, [eax + OFFSETOF__InterfaceDispatchCache__m_pCell] + +ALTERNATE_ENTRY RhpCastableObjectDispatchHelper2 ;; indirection cell address is in EAX, it will be passed by ;; the universal transition thunk as an argument to RhpCastableObjectResolve push eax |