diff options
author | Christopher Faylor <me@cgf.cx> | 2004-03-04 05:31:14 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2004-03-04 05:31:14 +0000 |
commit | 08b0a057eb40204cd187e898b272b09eaec47391 (patch) | |
tree | 244fcc9699a7ba0f390e51c1b75a6f43d7776725 | |
parent | 13a47bd66a97e146afef8b6f92bbbefbbf956a1b (diff) | |
download | newlib-08b0a057eb40204cd187e898b272b09eaec47391.zip newlib-08b0a057eb40204cd187e898b272b09eaec47391.tar.gz newlib-08b0a057eb40204cd187e898b272b09eaec47391.tar.bz2 |
* gendef (sigreturn): Call stabilize_sig_stack to ensure that there are no
pending signals. Restore edx later.
(sigdelayed): Save edx earlier.
* malloc_wrapper.cc (malloc_init): Add some more debugging output.
-rw-r--r-- | winsup/cygwin/ChangeLog | 8 | ||||
-rw-r--r-- | winsup/cygwin/exceptions.cc | 1 | ||||
-rwxr-xr-x | winsup/cygwin/gendef | 66 | ||||
-rw-r--r-- | winsup/cygwin/malloc_wrapper.cc | 11 | ||||
-rw-r--r-- | winsup/cygwin/wait.cc | 2 |
5 files changed, 50 insertions, 38 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 7ae7a43..3bb4821 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,11 @@ +2004-03-03 Christopher Faylor <cgf@redhat.com> + + * gendef (sigreturn): Call stabilize_sig_stack to ensure that there are + no pending signals. Restore edx later. + (sigdelayed): Save edx earlier. + + * malloc_wrapper.cc (malloc_init): Add some more debugging output. + 2004-03-02 Corinna Vinschen <corinna@vinschen.de> * fhandler_raw.cc (fhandler_dev_raw::raw_read): When reading with diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 94163fd..45d840a 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -1200,4 +1200,5 @@ reset_signal_arrived () { (void) ResetEvent (signal_arrived); sigproc_printf ("reset signal_arrived"); +if (_my_tls.stackptr > _my_tls.stack) debug_printf ("stackptr[-1] %p", _my_tls.stackptr[-1]); } diff --git a/winsup/cygwin/gendef b/winsup/cygwin/gendef index 14c9f67..141a4e7 100755 --- a/winsup/cygwin/gendef +++ b/winsup/cygwin/gendef @@ -128,8 +128,8 @@ __sigbe: 2: movl \$-4,%eax # now decrement aux stack xadd %eax,$tls::stackptr(%edx) # and get pointer xorl %ebx,%ebx - xchgl %ebx,-4(%eax) # - xchgl %ebx,8(%esp) + xchgl %ebx,-4(%eax) # get return address from signal stack + xchgl %ebx,8(%esp) # restore ebx/real return address decl $tls::stacklock(%edx) # release lock popl %eax popl %edx @@ -172,29 +172,47 @@ __ZN7_cygtls6lockedEv: movl $tls::pstacklock(%eax),%eax ret + .extern __ZN7_cygtls19call_signal_handlerEv +stabilize_sig_stack: +1: movl %fs:4,%edx + movl \$1,%eax + lock xchgl %eax,$tls::stacklock(%edx) + movl %eax,$tls::spinning(%edx) # flag if we are waiting for lock + orl %eax,%eax + jz 2f + xorl %eax,%eax + call _low_priority_sleep + jmp 1b +2: cmpl \$0,$tls::sig(%edx) + jz 3f + decl $tls::stacklock(%edx) # unlock + movl \$-$tls::sizeof__cygtls,%eax # point to beginning + addl %edx,%eax # of tls block + call __ZN7_cygtls19call_signal_handlerEv + jmp 1b +3: ret + .global _sigreturn .stabs "sigreturn:F(0,1)",36,0,0,_sigreturn _sigreturn: - addl \$4,%esp # Remove argument + addl \$4,%esp # Remove argument call _set_process_mask\@4 - movl %fs:4,%ebx - -# cmpl \$0,$tls::sig(%ebx) # Did a signal come in? -# jnz 3f # Yes, if non-zero + call stabilize_sig_stack -1: popl %edx # saved errno - testl %edx,%edx # Is it < 0 - jl 2f # yup. ignore it - movl $tls::errno_addr(%ebx),%eax - movl %edx,(%eax) +1: popl %ebx # saved errno + testl %ebx,%ebx # Is it < 0 + jl 2f # yup. ignore it + movl $tls::errno_addr(%edx),%eax + movl %ebx,(%eax) 2: popl %eax popl %ebx popl %ecx - popl %edx popl %edi popl %esi popf + decl $tls::stacklock(%edx) # relinquish lock + popl %edx popl %ebp jmp __sigbe @@ -203,10 +221,10 @@ _sigreturn: _sigdelayed: pushl %ebp movl %esp,%ebp + pushl %edx pushf pushl %esi pushl %edi - pushl %edx pushl %ecx pushl %ebx pushl %eax @@ -236,26 +254,6 @@ EOF sub longjmp { return <<EOF; - .extern __ZN7_cygtls19call_signal_handlerEv -stabilize_sig_stack: -1: movl %fs:4,%edx - movl \$1,%eax - lock xchgl %eax,$tls::stacklock(%edx) - movl %eax,$tls::spinning(%edx) # flag if we are waiting for lock - orl %eax,%eax - jz 2f - xorl %eax,%eax - call _low_priority_sleep - jmp 1b -2: cmpl \$0,$tls::sig(%edx) - jz 3f - decl $tls::stacklock(%edx) # unlock - movl \$-$tls::sizeof__cygtls,%eax # point to beginning - addl %edx,%eax # of tls block - call __ZN7_cygtls19call_signal_handlerEv - jmp 1b -3: ret - .globl _setjmp _setjmp: pushl %ebp diff --git a/winsup/cygwin/malloc_wrapper.cc b/winsup/cygwin/malloc_wrapper.cc index 04d4f66..179b91b 100644 --- a/winsup/cygwin/malloc_wrapper.cc +++ b/winsup/cygwin/malloc_wrapper.cc @@ -255,15 +255,20 @@ malloc_init () new_muto (mallock); #ifndef MALLOC_DEBUG - /* Check if mallock is provided by application. If so, redirect all + /* Check if malloc is provided by application. If so, redirect all calls to malloc/free/realloc to application provided. This may happen if some other dll calls cygwin's malloc, but main code provides its own malloc */ if (!user_data->forkee) { user_data->free (user_data->malloc (16)); - if (!export_malloc_called) - use_internal_malloc = 0; + if (export_malloc_called) + malloc_printf ("using internal malloc"); + else + { + use_internal_malloc = 0; + malloc_printf ("using external malloc"); + } } #endif } diff --git a/winsup/cygwin/wait.cc b/winsup/cygwin/wait.cc index d92a329..789a7f3 100644 --- a/winsup/cygwin/wait.cc +++ b/winsup/cygwin/wait.cc @@ -72,7 +72,7 @@ wait4 (int intpid, int *status, int options, struct rusage *r) w->options = options; w->rusage = r; sigproc_printf ("calling proc_subproc, pid %d, options %d", - w->pid, w->options); + w->pid, w->options); if (!proc_subproc (PROC_WAIT, (DWORD) w)) { set_errno (ENOSYS); |