diff options
author | sergey ignatov <sergign60@mail.ru> | 2017-06-29 01:13:47 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2017-06-29 01:13:47 +0300 |
commit | 947887294d5f28dee9736dc1c744663a79b502c4 (patch) | |
tree | 77605eb0dff8c58a69dd623ce23c0a07a128ad1b /src/Native/Runtime/arm | |
parent | e17c3aab649fffcb76027c7a0c89a3aaded27a6b (diff) |
[arm tizen] first variant of RhpInvoke & RhpInvokeReturn (#3993)
Diffstat (limited to 'src/Native/Runtime/arm')
-rw-r--r-- | src/Native/Runtime/arm/PInvoke.S | 72 |
1 files changed, 53 insertions, 19 deletions
diff --git a/src/Native/Runtime/arm/PInvoke.S b/src/Native/Runtime/arm/PInvoke.S index df6e3ba59..aa7574ec3 100644 --- a/src/Native/Runtime/arm/PInvoke.S +++ b/src/Native/Runtime/arm/PInvoke.S @@ -3,39 +3,73 @@ // See the LICENSE file in the project root for more information. #include <unixasmmacros.inc> +#include <AsmOffsets.inc> .syntax unified .thumb -#ifdef _DEBUG -.rodata -AssertMsg: .asciz "__FILE__:%s: %s is not implemented\n" -FileName: .asciz "PInvoke.S" -RhpPInvokeName: .asciz "RhpPInvoke" -RhpPInvokeReturnName: .asciz "RhpPInvokeReturn" +.macro INLINE_GET_TLS_VAR Var, trashReg + ldr r0, =\Var(tlsgd) + bl __tls_get_addr@PLT + ldr \trashReg, =\Var(gottpoff) + add r0, \trashReg +.endmacro -.text -.macro GEN_ASSERT_FUNC func - GEN_ASSERT AssertMsg, FileName, \func -.endm -#endif - -// TODO: Implement Arm support +.macro INLINE_GETTHREAD trashReg + // Inlined version of call C_FUNC(RhpGetThread) + INLINE_GET_TLS_VAR tls_CurrentThread, \trashReg +.endmacro // // 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 -#ifdef _DEBUG - GEN_ASSERT_FUNC RhpPInvokeName -#endif + PROLOG_PUSH "{r4-r7,lr}" + + str lr, [r0, #OFFSETOF__PInvokeTransitionFrame__m_RIP] + str r7, [r0, #OFFSETOF__PInvokeTransitionFrame__m_FramePointer] + str sp, [r0, #OFFSETOF__PInvokeTransitionFrame__m_PreservedRegs] + + mov r5, r0 + // R0 = GetThread(), R6 - Trash Register + INLINE_GETTHREAD r6 + str r0, [r5, #OFFSETOF__PInvokeTransitionFrame__m_pThread] + str r5, [r0, #OFFSETOF__Thread__m_pTransitionFrame] + + ldr r6, =C_FUNC(RhpTrapThreads) + ldr r6, [r6] + cbnz r6, LOCAL_LABEL(InvokeRareTrapThread) + + EPILOG_POP "{r4-r7,pc}" + +LOCAL_LABEL(InvokeRareTrapThread): + b C_FUNC(RhpWaitForSuspend2) NESTED_END RhpPInvoke, _TEXT // // RhpPInvokeReturn // +// IN: R0: address of pinvoke frame +// LEAF_ENTRY RhpPInvokeReturn, _TEXT -#ifdef _DEBUG - GEN_ASSERT_FUNC RhpPInvokeReturnName -#endif + 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) + + bx lr + +LOCAL_LABEL(ReturnRareTrapThread): + // passing transition frame pointer in r0 + b C_FUNC(RhpWaitForGC2) LEAF_END RhpPInvokeReturn, _TEXT |