* 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.
This commit is contained in:
parent
13a47bd66a
commit
08b0a057eb
|
@ -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
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
call stabilize_sig_stack
|
||||
|
||||
# cmpl \$0,$tls::sig(%ebx) # Did a signal come in?
|
||||
# jnz 3f # Yes, if non-zero
|
||||
|
||||
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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue