* _SEH3$_RegisterFrame[WithNonVolatiles](
* PSEH3$_REGISTRATION_FRAME RegistrationFrame<eax>,
* PSEH3$_SCOPE_TABLE ScopeTable<edx>,
- * PVOID AllocaFrame);
+ * PVOID AllocaFrame<ecx>);
*/
.global __SEH3$_RegisterFrameWithNonVolatiles
__SEH3$_RegisterFrameWithNonVolatiles:
/* Safe the return address */
mov ebx, [esp]
mov [eax + SEH3_REGISTRATION_FRAME_ReturnAddress], ebx
+ mov ebx, [eax + SEH3_REGISTRATION_FRAME_Ebx]
.global __SEH3$_RegisterFrameWithStackLayout
__SEH3$_RegisterFrameWithStackLayout:
* __attribute__((regparm(3)))
* __attribute__((returns_twice))
* _SEH3$_RegisterTryLevel[WithNonVolatiles](
- * PSEH3$_REGISTRATION_FRAME RegistrationFrame<edx>,
- * PSEH3$_SCOPE_TABLE ScopeTable<eax>,
- * PVOID AllocaFrame);
+ * PSEH3$_REGISTRATION_FRAME RegistrationFrame<eax>,
+ * PSEH3$_SCOPE_TABLE ScopeTable<edx>,
+ * PVOID AllocaFrame<ecx>);
*/
.global __SEH3$_RegisterTryLevelWithNonVolatiles
__SEH3$_RegisterTryLevelWithNonVolatiles:
push esi
push edi
+ /* Save the registration frame pointer */
+ push eax
+
/* Load the non-volatiles from the registration invocation */
mov ebx, [eax + SEH3_REGISTRATION_FRAME_Ebx]
mov esi, [eax + SEH3_REGISTRATION_FRAME_Esi]
sub ecx, [eax + SEH3_REGISTRATION_FRAME_Esp]
/* Put the return address on the stack */
- push offset __SEH3$_InvokeEmbeddedFilterReturn
+ push offset __SEH3$_InvokeEmbeddedFilterReturnClang
/* Save the current stack pointer in the AllocaFrame member */
mov [eax + SEH3_REGISTRATION_FRAME_AllocaFrame], esp
inc eax
jmp edx
+ /* We return to this label with a cleaned up stack */
+__SEH3$_InvokeEmbeddedFilterReturnClang:
+
+ /* Restore the registration frame pointer */
+ pop ecx
+
+ /* Save the non-volatiles back in the registration frame */
+ mov [ecx + SEH3_REGISTRATION_FRAME_Ebx], ebx
+ mov [ecx + SEH3_REGISTRATION_FRAME_Esi], esi
+ mov [ecx + SEH3_REGISTRATION_FRAME_Edi], edi
+ mov [ecx + SEH3_REGISTRATION_FRAME_Ebp], ebp
+
+ /* Restore the current non-volatiles */
+ pop edi
+ pop esi
+ pop ebx
+ pop ebp
+
+ ret
+
.global __SEH3$_InvokeEmbeddedFilter
__SEH3$_InvokeEmbeddedFilter: