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
68
|
// 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.
#include <AsmOffsets.inc>
#include <unixasmmacros.inc>
.syntax unified
.thumb
//
// RhpPInvoke
//
// IN: R0: address of pinvoke frame
//
// This helper assumes that its callsite is as good to start the stackwalk as the actual PInvoke callsite.
// The codegenerator must treat the callsite of this helper as GC triggering and generate the GC info for it.
// Also, the codegenerator must ensure that there are no live GC references in callee saved registers.
//
NESTED_ENTRY RhpPInvoke, _TEXT, NoHandler
str lr, [r0, #OFFSETOF__PInvokeTransitionFrame__m_RIP]
str r7, [r0, #OFFSETOF__PInvokeTransitionFrame__m_FramePointer]
str sp, [r0, #OFFSETOF__PInvokeTransitionFrame__m_PreservedRegs]
mov r3, #PTFF_SAVE_SP
str r3, [r0, #OFFSETOF__PInvokeTransitionFrame__m_dwFlags]
PROLOG_PUSH "{r5,lr}"
mov r5, r0
// get TLS global variable address
// r0 = GetThread()
INLINE_GETTHREAD
str r0, [r5, #OFFSETOF__PInvokeTransitionFrame__m_pThread]
str r5, [r0, #OFFSETOF__Thread__m_pTransitionFrame]
ldr r3, =C_FUNC(RhpTrapThreads)
ldr r3, [r3]
cbnz r3, LOCAL_LABEL(InvokeRareTrapThread) // TrapThreadsFlags_None = 0
EPILOG_POP "{r5,pc}"
LOCAL_LABEL(InvokeRareTrapThread):
EPILOG_POP "{r5,lr}"
b C_FUNC(RhpWaitForSuspend2)
NESTED_END RhpPInvoke, _TEXT
//
// RhpPInvokeReturn
//
// IN: R0: address of pinvoke frame
//
LEAF_ENTRY RhpPInvokeReturn, _TEXT
ldr r3, [r0, #OFFSETOF__PInvokeTransitionFrame__m_pThread]
mov r2, #0
str r2, [r3, #OFFSETOF__Thread__m_pTransitionFrame]
ldr r3, =C_FUNC(RhpTrapThreads)
ldr r3, [r3]
cbnz r3, LOCAL_LABEL(ReturnRareTrapThread) // TrapThreadsFlags_None = 0
bx lr
LOCAL_LABEL(ReturnRareTrapThread):
// passing transition frame pointer in r0
b C_FUNC(RhpWaitForGC2)
LEAF_END RhpPInvokeReturn, _TEXT
|