Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFadi Hanna <fadim@microsoft.com>2016-10-12 03:26:32 +0300
committerFadi Hanna <fadim@microsoft.com>2016-10-12 03:26:32 +0300
commit2ef894946268f7e62e9b69a9a3b7fee8392e07cf (patch)
treebd9826293281c7c84a59793efee3d89779653da4 /src/Native/Runtime/i386
parent6535e406eff0bfd8671dd163683cb5609522f7e9 (diff)
This is a fix to the CastableObject support for methods used in a ldvirtftn opcode (or similar), which end up resolving interface methods using the RhpResolveInterfaceMethod API.
[tfs-changeset: 1632820]
Diffstat (limited to 'src/Native/Runtime/i386')
-rw-r--r--src/Native/Runtime/i386/StubDispatch.asm34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Native/Runtime/i386/StubDispatch.asm b/src/Native/Runtime/i386/StubDispatch.asm
index 037505edc..775b26fe8 100644
--- a/src/Native/Runtime/i386/StubDispatch.asm
+++ b/src/Native/Runtime/i386/StubDispatch.asm
@@ -30,6 +30,40 @@ GET_TLS_DISPATCH_CELL macro
mov eax, [eax + SECTIONREL _t_TLS_DispatchCell]
endm
+SET_TLS_DISPATCH_CELL macro
+ ;; ecx: value to assign to the TLS variable
+ ASSUME fs : NOTHING
+ push eax
+ mov eax, [__tls_index]
+ add eax, eax
+ add eax, eax
+ add eax, fs:[__tls_array]
+ mov eax, [eax]
+ lea eax, [eax + SECTIONREL _t_TLS_DispatchCell]
+ mov [eax],ecx
+ pop eax
+endm
+
+_RhpCastableObjectDispatch_CommonStub proc public
+ ;; There are arbitrary callers passing arguments with arbitrary signatures.
+ ;; Custom calling convention:
+ ;; eax: pointer to the current thunk's data block (data contains 2 pointer values: context + target pointers)
+
+ ;; make some scratch regs
+ push ecx
+
+ ;; store dispatch cell address into the TLS variable
+ mov ecx, [eax]
+ SET_TLS_DISPATCH_CELL
+
+ ;; restore the regs we used
+ pop ecx
+
+ ;; jump to the target
+ mov eax, [eax + 4] ;; eax <- target slot data
+ jmp eax
+_RhpCastableObjectDispatch_CommonStub endp
+
_RhpTailCallTLSDispatchCell proc public
;; Load the dispatch cell out of the TLS variable
GET_TLS_DISPATCH_CELL