Revises UMThunkStub unwindable in ARM/Linux (dotnet/coreclr#6788)
authorJonghyun Park <parjong@gmail.com>
Tue, 30 Aug 2016 02:36:51 +0000 (11:36 +0900)
committerJan Kotas <jkotas@microsoft.com>
Tue, 30 Aug 2016 02:36:51 +0000 (19:36 -0700)
In ARM/Linux, UMThunkStub currently pushes r0-r3 and r12 without .pad,
which results in dotnet/coreclr#6787.

This commit revises the prolog and epilog of UMThunkStub to fix 6787.
(In addition, personality routine is addes as ARM64/AMD64 already does.)

Commit migrated from https://github.com/dotnet/coreclr/commit/f4952b4da7e87f825e49907f36f78ceb5cc46e28

src/coreclr/src/vm/arm/asmhelpers.S

index 55bdd9f..5717f39 100644 (file)
@@ -309,10 +309,12 @@ LOCAL_LABEL(LNullThis):
 //
 // r12 = UMEntryThunk*
 //
-        NESTED_ENTRY UMThunkStub,_TEXT,NoHandler
+        NESTED_ENTRY UMThunkStub,_TEXT,UnhandledExceptionHandlerUnix
         PROLOG_PUSH         "{r4,r5,r7,r11,lr}"
-        push                {r0-r3,r12}
-        PROLOG_STACK_SAVE_OFFSET   r7, #28
+        PROLOG_STACK_SAVE_OFFSET   r7, #8
+
+        alloc_stack         4 * 5
+        stm                 sp, {r0-r3,r12}
 
         //GBLA UMThunkStub_HiddenArgOffest // offset of saved UMEntryThunk *
         //GBLA UMThunkStub_StackArgsOffest // offset of original stack args
@@ -378,8 +380,7 @@ LOCAL_LABEL(UMThunkStub_PostCall):
         mov                 r4, 0
         str                 r4, [r5, #Thread__m_fPreemptiveGCDisabled]
 
-        EPILOG_STACK_RESTORE_OFFSET    r7, #28
-        free_stack           4 * 5
+        EPILOG_STACK_RESTORE_OFFSET    r7, #8
         EPILOG_POP           "{r4,r5,r7,r11,pc}"
 
 LOCAL_LABEL(UMThunkStub_DoThreadSetup):