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

MethodEntrypointStubs.asm « amd64 « System.Private.TypeLoader.Native « Native « src - github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f0c212b123f08d9c9397aa6d8e1e7815ddf32515 (plain)
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
;; 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.

LEAF_ENTRY macro Name, Section
    Section segment para 'CODE'
    align   16
    public  Name
    Name    proc
endm

LEAF_END macro Name, Section
    Name    endp
    Section ends
endm

.data

g_methodEntrypointThunk qword 0  ; The method which operates on universal transition
g_universalTransition qword 0 ; The address of Redhawk's UniversalTransition thunk

.code

;  - TAILCALL_RAX: ("jmp rax") should be used for tailcalls, this emits an instruction 
;            sequence which is recognized by the unwinder as a valid epilogue terminator
TAILJMP_RAX TEXTEQU <DB 048h, 0FFh, 0E0h>

PointerSize equ 8

;;
;; __jmpstub__MethodEntrypointStubs_CommonCallingStub(?)
;;  Used when we dynamically need a VTableResolver not pre-generated
;;
;; r10 contains a pointer to a VTableResolverStruct
;;   struct MethodEntryPointStubInfo
;;   {
;;       IntPtr targetCodePointer;
;;       IntPtr MethodEntrypointStructPointer;
;;   };
;;
LEAF_ENTRY __jmpstub__MethodEntrypointStubs_CommonCallingStub, _TEXT
        ;; r10 <- stub info
        mov rax, [r10]
        cmp rax, 0
        je SLOW_PATH
        mov rax, [r10]
        TAILJMP_RAX
SLOW_PATH:
        mov         r11, [r10 + 8]
        mov         r10, g_methodEntrypointThunk
        mov         rax, g_universalTransition
        TAILJMP_RAX
LEAF_END __jmpstub__MethodEntrypointStubs_CommonCallingStub, _TEXT

;; Returns the size of the pre-generated thunks
;; IntPtr MethodEntrypointStubs_SetupPointers(
;;                          IntPtr universalTransition,
;;                          IntPtr methodEntrypointThunk)
;;
LEAF_ENTRY MethodEntrypointStubs_SetupPointers, _TEXT
        mov    g_universalTransition, rcx
        mov    g_methodEntrypointThunk, rdx
        lea    rax, [__jmpstub__MethodEntrypointStubs_CommonCallingStub]
        ret
LEAF_END MethodEntrypointStubs_SetupPointers, _TEXT

end