mirror of
https://github.com/reactos/reactos.git
synced 2025-06-26 18:39:44 +00:00
modified lib/pseh/framebased-gcchack.c
modified lib/pseh/i386/framebased-gcchack.S For some reason, "call _RtlUnwind@16" is being linked as "call 0" (very likely a linker bug). Reimplementing _SEH2GlobalUnwind in C and taking the address of RtlUnwind from C code seems to work Annotate functions implemented in assembler with .func/.endfunc, so the symbols are more correct svn path=/trunk/; revision=38208
This commit is contained in:
parent
aaf7ad6a2b
commit
e5a9f1615f
2 changed files with 42 additions and 25 deletions
|
@ -38,7 +38,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern _SEH2Registration_t * __cdecl _SEH2CurrentRegistration(void);
|
extern _SEH2Registration_t * __cdecl _SEH2CurrentRegistration(void);
|
||||||
extern void _SEH2GlobalUnwind(void *);
|
|
||||||
|
|
||||||
extern int __SEH2Except(void *, void *);
|
extern int __SEH2Except(void *, void *);
|
||||||
extern void __SEH2Finally(void *, void *);
|
extern void __SEH2Finally(void *, void *);
|
||||||
|
@ -50,6 +49,24 @@ extern void __cdecl __SEH2LeaveFrame(void);
|
||||||
extern int __cdecl __SEH2FrameHandler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *);
|
extern int __cdecl __SEH2FrameHandler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *);
|
||||||
extern int __cdecl __SEH2NestedHandler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *);
|
extern int __cdecl __SEH2NestedHandler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *);
|
||||||
|
|
||||||
|
FORCEINLINE
|
||||||
|
void _SEH2GlobalUnwind(void * target)
|
||||||
|
{
|
||||||
|
__asm__ __volatile__
|
||||||
|
(
|
||||||
|
"push %%ebp\n"
|
||||||
|
"push $0\n"
|
||||||
|
"push $0\n"
|
||||||
|
"push $Return%=\n"
|
||||||
|
"push %[target]\n"
|
||||||
|
"call %c[RtlUnwind]\n"
|
||||||
|
"Return%=: pop %%ebp\n" :
|
||||||
|
:
|
||||||
|
[target] "g" (target), [RtlUnwind] "g" (&RtlUnwind) :
|
||||||
|
"eax", "ebx", "ecx", "edx", "esi", "edi", "flags", "memory"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
FORCEINLINE
|
FORCEINLINE
|
||||||
int _SEH2Except(_SEH2Frame_t * frame, volatile _SEH2TryLevel_t * trylevel)
|
int _SEH2Except(_SEH2Frame_t * frame, volatile _SEH2TryLevel_t * trylevel)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,11 +21,14 @@
|
||||||
.text
|
.text
|
||||||
.intel_syntax noprefix
|
.intel_syntax noprefix
|
||||||
|
|
||||||
|
.func _SEH2CurrentRegistration
|
||||||
.globl __SEH2CurrentRegistration
|
.globl __SEH2CurrentRegistration
|
||||||
__SEH2CurrentRegistration:
|
__SEH2CurrentRegistration:
|
||||||
mov eax, [fs:0]
|
mov eax, [fs:0]
|
||||||
ret
|
ret
|
||||||
|
.endfunc
|
||||||
|
|
||||||
|
.func __SEH2EnterFrame
|
||||||
.globl ___SEH2EnterFrame
|
.globl ___SEH2EnterFrame
|
||||||
___SEH2EnterFrame:
|
___SEH2EnterFrame:
|
||||||
mov eax, [esp+4]
|
mov eax, [esp+4]
|
||||||
|
@ -33,24 +36,39 @@ ___SEH2EnterFrame:
|
||||||
mov [eax], ecx
|
mov [eax], ecx
|
||||||
mov [fs:0], eax
|
mov [fs:0], eax
|
||||||
ret
|
ret
|
||||||
|
.endfunc
|
||||||
|
|
||||||
|
.func __SEH2LeaveFrame
|
||||||
.globl ___SEH2LeaveFrame
|
.globl ___SEH2LeaveFrame
|
||||||
___SEH2LeaveFrame:
|
___SEH2LeaveFrame:
|
||||||
mov eax, [fs:0]
|
mov eax, [fs:0]
|
||||||
mov eax, [eax]
|
mov eax, [eax]
|
||||||
mov [fs:0], eax
|
mov [fs:0], eax
|
||||||
ret
|
ret
|
||||||
|
.endfunc
|
||||||
|
|
||||||
|
.func __SEH2Handle
|
||||||
.globl ___SEH2Handle
|
.globl ___SEH2Handle
|
||||||
___SEH2Handle:
|
___SEH2Handle:
|
||||||
mov eax, [esp+4]
|
mov eax, [esp+4]
|
||||||
mov ebp, [esp+8]
|
mov ebp, [esp+8]
|
||||||
mov esp, [esp+12]
|
mov esp, [esp+12]
|
||||||
jmp eax
|
jmp eax
|
||||||
|
.endfunc
|
||||||
|
|
||||||
|
.func __SEH2Except
|
||||||
.globl ___SEH2Except
|
.globl ___SEH2Except
|
||||||
.globl ___SEH2Finally
|
|
||||||
___SEH2Except:
|
___SEH2Except:
|
||||||
|
mov eax, [esp+4]
|
||||||
|
mov ecx, [esp+8]
|
||||||
|
|
||||||
|
call eax
|
||||||
|
|
||||||
|
ret
|
||||||
|
.endfunc
|
||||||
|
|
||||||
|
.func __SEH2Finally
|
||||||
|
.globl ___SEH2Finally
|
||||||
___SEH2Finally:
|
___SEH2Finally:
|
||||||
mov eax, [esp+4]
|
mov eax, [esp+4]
|
||||||
mov ecx, [esp+8]
|
mov ecx, [esp+8]
|
||||||
|
@ -58,30 +76,9 @@ ___SEH2Finally:
|
||||||
call eax
|
call eax
|
||||||
|
|
||||||
ret
|
ret
|
||||||
|
.endfunc
|
||||||
|
|
||||||
.globl __SEH2GlobalUnwind
|
.func __SEH2FrameHandler
|
||||||
__SEH2GlobalUnwind:
|
|
||||||
|
|
||||||
.extern _RtlUnwind@16
|
|
||||||
|
|
||||||
push ebx
|
|
||||||
mov ebx, [esp+8]
|
|
||||||
push esi
|
|
||||||
push edi
|
|
||||||
|
|
||||||
push 0 // ReturnValue
|
|
||||||
push 0 // ExceptionRecord
|
|
||||||
push .RestoreRegisters // TargetIp
|
|
||||||
push ebx // TargetFrame
|
|
||||||
call _RtlUnwind@16
|
|
||||||
|
|
||||||
.RestoreRegisters:
|
|
||||||
pop edi
|
|
||||||
pop esi
|
|
||||||
pop ebx
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
.globl ___SEH2FrameHandler
|
.globl ___SEH2FrameHandler
|
||||||
___SEH2FrameHandler:
|
___SEH2FrameHandler:
|
||||||
|
|
||||||
|
@ -89,7 +86,9 @@ ___SEH2FrameHandler:
|
||||||
|
|
||||||
cld
|
cld
|
||||||
jmp __SEH2FrameHandler
|
jmp __SEH2FrameHandler
|
||||||
|
.endfunc
|
||||||
|
|
||||||
|
.func __SEH2NestedHandler
|
||||||
.globl ___SEH2NestedHandler
|
.globl ___SEH2NestedHandler
|
||||||
___SEH2NestedHandler:
|
___SEH2NestedHandler:
|
||||||
|
|
||||||
|
@ -97,5 +96,6 @@ ___SEH2NestedHandler:
|
||||||
|
|
||||||
cld
|
cld
|
||||||
jmp __SEH2NestedHandler
|
jmp __SEH2NestedHandler
|
||||||
|
.endfunc
|
||||||
|
|
||||||
// EOF
|
// EOF
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue