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/amd64
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/amd64')
-rw-r--r--src/Native/Runtime/amd64/StubDispatch.S5
-rw-r--r--src/Native/Runtime/amd64/StubDispatch.asm24
2 files changed, 29 insertions, 0 deletions
diff --git a/src/Native/Runtime/amd64/StubDispatch.S b/src/Native/Runtime/amd64/StubDispatch.S
index 17cb27ffb..096b59d0a 100644
--- a/src/Native/Runtime/amd64/StubDispatch.S
+++ b/src/Native/Runtime/amd64/StubDispatch.S
@@ -6,6 +6,11 @@
#include <unixasmmacros.inc>
#include <AsmOffsets.inc> // generated by the build from AsmOffsets.cpp
+LEAF_ENTRY RhpCastableObjectDispatch_CommonStub, _TEXT
+ // UNIXTODO: Implement this function
+ int 3
+LEAF_END RhpCastableObjectDispatch_CommonStub, _TEXT
+
LEAF_ENTRY RhpTailCallTLSDispatchCell, _TEXT
// UNIXTODO: Implement this function
int 3
diff --git a/src/Native/Runtime/amd64/StubDispatch.asm b/src/Native/Runtime/amd64/StubDispatch.asm
index 6449739ee..de76fdd13 100644
--- a/src/Native/Runtime/amd64/StubDispatch.asm
+++ b/src/Native/Runtime/amd64/StubDispatch.asm
@@ -15,6 +15,30 @@ EXTERN RhpCastableObjectResolve : PROC
EXTERN t_TLS_DispatchCell:QWORD
EXTERN _tls_index:DWORD
+LEAF_ENTRY RhpCastableObjectDispatch_CommonStub, _TEXT
+ ;; There are arbitrary callers passing arguments with arbitrary signatures.
+ ;; Custom calling convention:
+ ;; r10: pointer to the current thunk's data block (data contains 2 pointer values: context + target pointers)
+
+ mov [rsp + 8], rcx ;; Save rcx in a home scratch location. Pushing the
+ ;; register on the stack will break callstack unwind
+ mov ecx, [_tls_index]
+ mov r11, gs:[_tls_array]
+ mov r11, [r11 + rcx * 8]
+ mov eax, SECTIONREL t_TLS_DispatchCell
+ lea rax, [r11 + rax]
+
+ mov rcx, [rsp + 8] ;; Restore rcx
+
+ ;; store dispatch cell address in thread static
+ mov r11, [r10]
+ mov [rax], r11
+
+ ;; jump to the target
+ mov rax, [r10 + 8]
+ TAILJMP_RAX
+LEAF_END RhpCastableObjectDispatch_CommonStub, _TEXT
+
LEAF_ENTRY RhpTailCallTLSDispatchCell, _TEXT
;; Load the dispatch cell out of the TLS variable
mov rax, gs:[_tls_array]