diff options
author | Christopher Faylor <me@cgf.cx> | 2004-02-18 20:48:38 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2004-02-18 20:48:38 +0000 |
commit | 2d6c4a1a65051b08422c1503ba648e9cee0a0acc (patch) | |
tree | 6522f4939381a9e893e842f0bf0a991275f34a09 | |
parent | a682de34be3a3e6f1270a4b0e1e5288e09140abf (diff) | |
download | cygnal-2d6c4a1a65051b08422c1503ba648e9cee0a0acc.tar.gz cygnal-2d6c4a1a65051b08422c1503ba648e9cee0a0acc.tar.bz2 cygnal-2d6c4a1a65051b08422c1503ba648e9cee0a0acc.zip |
* gendef (stabilize_sig_stack): New function.
(setjmp): Import, add sig stack handling. Store sig stack info.
(longjmp): Call stabilize_sig_stack. Restore sig stack info.
* config/i386/setjmp.c: Remove.
-rw-r--r-- | winsup/cygwin/ChangeLog | 7 | ||||
-rw-r--r-- | winsup/cygwin/config/i386/setjmp.c | 48 | ||||
-rwxr-xr-x | winsup/cygwin/gendef | 61 |
3 files changed, 62 insertions, 54 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index b048677cf..12e69f5ed 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2004-02-18 Christopher Faylor <cgf@redhat.com> + + * gendef (stabilize_sig_stack): New function. + (setjmp): Import, add sig stack handling. Store sig stack info. + (longjmp): Call stabilize_sig_stack. Restore sig stack info. + * config/i386/setjmp.c: Remove. + 2004-02-17 Corinna Vinschen <corinna@vinschen.de> * fork.cc (fork_child): Move fixup_shms_after_fork so that diff --git a/winsup/cygwin/config/i386/setjmp.c b/winsup/cygwin/config/i386/setjmp.c deleted file mode 100644 index 9104c2c83..000000000 --- a/winsup/cygwin/config/i386/setjmp.c +++ /dev/null @@ -1,48 +0,0 @@ -/* setjmp.c - - Copyright 1996, 1998, 1999, 2000, 2001 Red Hat, Inc. - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - -#ifdef __i386__ - -#if 1 -asm(" .globl _setjmp \n" -"_setjmp: \n" -" pushl %ebp \n" -" movl %esp,%ebp \n" -" pushl %edi \n" -" movl 8(%ebp),%edi \n" -" movl %eax,0(%edi) \n" -" movl %ebx,4(%edi) \n" -" movl %ecx,8(%edi) \n" -" movl %edx,12(%edi) \n" -" movl %esi,16(%edi) \n" -" movl -4(%ebp),%eax \n" -" movl %eax,20(%edi) \n" -" movl 0(%ebp),%eax \n" -" movl %eax,24(%edi) \n" -" movl %esp,%eax \n" -" addl $12,%eax \n" -" movl %eax,28(%edi) \n" -" movl 4(%ebp),%eax \n" -" movl %eax,32(%edi) \n" -" movw %es, %ax \n" -" movw %ax, 36(%edi) \n" -" movw %fs, %ax \n" -" movw %ax, 38(%edi) \n" -" movw %gs, %ax \n" -" movw %ax, 40(%edi) \n" -" movw %ss, %ax \n" -" movw %ax, 42(%edi) \n" -" popl %edi \n" -" movl $0,%eax \n" -" leave \n" -" ret \n"); -#endif - -#endif /* __i386__ */ diff --git a/winsup/cygwin/gendef b/winsup/cygwin/gendef index 009c27db1..d46dbb950 100755 --- a/winsup/cygwin/gendef +++ b/winsup/cygwin/gendef @@ -236,9 +236,8 @@ EOF sub longjmp { return <<EOF; - .globl _longjmp - -_longjmp: + .extern __ZN7_cygtls19call_signal_handlerEv +stabilize_sig_stack: 1: movl %fs:4,%edx movl \$1,%eax lock xchgl %eax,$tls::stacklock(%edx) @@ -248,12 +247,63 @@ _longjmp: xorl %eax,%eax call _low_priority_sleep jmp 1b -2: leal ($tls::stack)(%edx),%eax - movl %eax,($tls::stackptr)(%edx) +2: cmpl \$0,$tls::sig(%edx) + jz 3f + decl $tls::stacklock(%edx) + movl %edx,%eax + call __ZN7_cygtls19call_signal_handlerEv + jmp 1b +3: ret + .globl _setjmp +_setjmp: pushl %ebp movl %esp,%ebp + pushl %edi movl 8(%ebp),%edi + movl %eax,0(%edi) + movl %ebx,4(%edi) + movl %ecx,8(%edi) + movl %edx,12(%edi) + movl %esi,16(%edi) + movl -4(%ebp),%eax + movl %eax,20(%edi) + movl 0(%ebp),%eax + movl %eax,24(%edi) + movl %esp,%eax + addl \$12,%eax + movl %eax,28(%edi) + movl 4(%ebp),%eax + movl %eax,32(%edi) + movw %es,%ax + movw %ax,36(%edi) + movw %fs,%ax + movw %ax,38(%edi) + movw %gs,%ax + movw %ax,40(%edi) + movw %ss,%ax + movw %ax,42(%edi) + pushl %edx + call stabilize_sig_stack + movl $tls::stackptr(%edx),%eax # save stack pointer contents + decl $tls::stacklock(%edx) + popl %edx + movl %eax,44(%edi) + popl %edi + movl \$0,%eax + leave + ret + + .globl _longjmp +_longjmp: + pushl %ebp + movl %esp,%ebp + movl 8(%ebp),%edi # address of buffer + call stabilize_sig_stack + movl 44(%edi),%eax # get old signal stack + movl %eax,$tls::stackptr(%edx) # restore + decl $tls::stacklock(%edx) # relinquish lock + movl 12(%ebp),%eax testl %eax,%eax jne 3f @@ -276,7 +326,6 @@ _longjmp: movl 4(%edi),%ebx movl 8(%edi),%ecx movl 16(%edi),%esi - decl $tls::stacklock(%edx) movl 12(%edi),%edx movl 20(%edi),%edi popfl |