OSDN Git Service

* gendef (sigdelayed): Handle return here rather than going through sigbe to
authorcgf <cgf>
Fri, 5 Mar 2004 19:09:03 +0000 (19:09 +0000)
committercgf <cgf>
Fri, 5 Mar 2004 19:09:03 +0000 (19:09 +0000)
ensure that flags are properly restored.

winsup/cygwin/ChangeLog
winsup/cygwin/gendef

index e403dd6..31876ae 100644 (file)
@@ -1,41 +1,41 @@
+2004-03-05  Christopher Faylor  <cgf@redhat.com>
+
+       * gendef (sigdelayed): Handle return here rather than going through
+       sigbe to ensure that flags are properly restored.
+
 2004-03-04  Thomas Pfaff  <tpfaff@gmx.net>
 
-       * include/pthread.h (PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP):
-       New define.
+       * include/pthread.h (PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP): New
+       define.
        (PTHREAD_NORMAL_MUTEX_INITIALIZER_NP): Ditto.
        (PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP): Ditto.
-       * thread.cc (pthread_mutex::is_good_initializer):
-       Check for all posssible initializers
+       * thread.cc (pthread_mutex::is_good_initializer): Check for all
+       posssible initializers
        (pthread_mutex::is_good_initializer_or_object): Ditto.
        (pthread_mutex::is_good_initializer_or_bad_object): Ditto.
-       (verifyable_object_isvalid): Support up to three static
-       initializers.
+       (verifyable_object_isvalid): Support up to three static initializers.
        (verifyable_object_isvalid (void const *,long)): Remove.
-       (pthread_cond::is_good_initializer_or_bad_object): Remove
-       unneeded objectState var.
-       (pthread_cond::init): Condition remains unchanged when creation
-       has failed.
-       (pthread_rwlock::is_good_initializer_or_bad_object): Remove
-       unneeded objectState var.
-       (pthread_rwlock::init): Rwlock remains unchanged when creation
-       has failed.
-       (pthread_mutex::init): Remove obsolete comment.
-       Mutex remains unchanged when creation has failed. Add support
-       for new initializers.
-       (pthread_mutex_getprioceiling): Do not create mutex,
-       just return ENOSYS.
+       (pthread_cond::is_good_initializer_or_bad_object): Remove unneeded
+       objectState var.
+       (pthread_cond::init): Condition remains unchanged when creation has
+       failed.
+       (pthread_rwlock::is_good_initializer_or_bad_object): Remove unneeded
+       objectState var.
+       (pthread_rwlock::init): Rwlock remains unchanged when creation has
+       failed.
+       (pthread_mutex::init): Remove obsolete comment.  Mutex remains
+       unchanged when creation has failed.  Add support for new initializers.
+       (pthread_mutex_getprioceiling): Do not create mutex, just return
+       ENOSYS.
        (pthread_mutex_lock): Simplify.
        (pthread_mutex_trylock): Remove unneeded local themutex.
-       (pthread_mutex_unlock): Just return EPERM if mutex is not
-       initialized.
-       (pthread_mutex_setprioceiling): Do not create mutex,
-       just return ENOSYS.
-       * thread.h (verifyable_object_isvalid): Support up to three
-       static initializers.
-       (verifyable_object_isvalid (void const *,long)): Remove
-       prototype.
-       (pthread_mutex::init): Add optional initializer to parameter
-       list.
+       (pthread_mutex_unlock): Just return EPERM if mutex is not initialized.
+       (pthread_mutex_setprioceiling): Do not create mutex, just return
+       ENOSYS.
+       * thread.h (verifyable_object_isvalid): Support up to three static
+       initializers.
+       (verifyable_object_isvalid (void const *,long)): Remove prototype.
+       (pthread_mutex::init): Add optional initializer to parameter list.
 
 2004-03-03  Christopher Faylor  <cgf@redhat.com>
 
index 141a4e7..a208cbe 100755 (executable)
@@ -87,7 +87,7 @@ EOF
        $res = <<EOF . longjmp () . $res;
        .text
 
-       .stabs  "_sigfe:F(0,1)",36,0,0,__sigbe
+       .stabs  "_sigfe:F(0,1)",36,0,0,__sigfe
 __sigfe:
        pushl   %ebx
        pushl   %edx
@@ -135,6 +135,72 @@ __sigbe:
        popl    %edx
        ret
 
+       .global _sigreturn
+       .stabs  "sigreturn:F(0,1)",36,0,0,_sigreturn
+_sigreturn:
+       addl    \$4,%esp                                # Remove argument
+       call    _set_process_mask\@4
+
+1:     movl    %fs:4,%edx
+       movl    \$1,%eax                                # potential lock value
+       lock    xchgl %eax,$tls::stacklock(%edx)        # see if we can grab it
+       movl    %eax,$tls::spinning(%edx)               # flag if we are waiting for lock
+       orl     %eax,%eax                               # it will be zero
+       jz      2f                                      #  if so
+       xorl    %eax,%eax                               # nope.  not zero
+       call    _low_priority_sleep                     # sleep
+       jmp     1b                                      #  and loop
+2:     popl    %ebx                                    # saved errno
+       testl   %ebx,%ebx                               # Is it < 0
+       jl      3f                                      # yup.  ignore it
+       movl    $tls::errno_addr(%edx),%eax
+       movl    %ebx,(%eax)
+3:     movl    \$-4,%eax                               # now decrement aux stack
+       xadd    %eax,$tls::stackptr(%edx)               #  and get pointer
+       xorl    %ebp,%ebp
+       xchgl   %ebp,-4(%eax)                           # get return address from signal stack
+       xchgl   %ebp,28(%esp)                           # store real return address
+       decl    $tls::stacklock(%edx)                   # unlock
+
+       popl    %eax
+       popl    %ebx
+       popl    %ecx
+       popl    %edx
+       popl    %edi
+       popl    %esi
+       popf
+       ret
+
+       .global _sigdelayed
+       .stabs  "sigdelayed:F(0,1)",36,0,0,_sigdelayed
+_sigdelayed:
+       pushl   %ebp
+       movl    %esp,%ebp
+       pushf
+       pushl   %esi
+       pushl   %edi
+       pushl   %edx
+       pushl   %ecx
+       pushl   %ebx
+       pushl   %eax
+       movl    %fs:4,%ebx
+       pushl   $tls::saved_errno(%ebx) # saved errno
+3:     pushl   $tls::oldmask(%ebx)     # oldmask
+       pushl   $tls::sig(%ebx)         # signal argument
+       pushl   \$_sigreturn
+
+       call    _reset_signal_arrived\@0
+       pushl   $tls::func(%ebx)        # signal func
+       pushl   $tls::newmask(%ebx)     # newmask - eaten by set_process_mask
+
+       call    _set_process_mask\@4
+       cmpl    \$0,$tls::threadkill(%ebx)#pthread_kill signal?
+       jnz     4f                      #yes.  Callee clears signal number
+       movl    \$0,$tls::sig(%ebx)     # zero the signal number as a
+                                       # flag to the signal handler thread
+                                       # that it is ok to set up sigsave
+4:     ret
+
        .global __ZN7_cygtls3popEv
 __ZN7_cygtls3popEv:
 1:     pushl   %ebx
@@ -191,61 +257,6 @@ stabilize_sig_stack:
        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
-       call    _set_process_mask\@4
-
-       call    stabilize_sig_stack
-
-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    %edi
-       popl    %esi
-       popf
-       decl    $tls::stacklock(%edx)                   # relinquish lock
-       popl    %edx
-       popl    %ebp
-       jmp     __sigbe
-
-       .global _sigdelayed
-       .stabs  "sigdelayed:F(0,1)",36,0,0,_sigdelayed
-_sigdelayed:
-       pushl   %ebp
-       movl    %esp,%ebp
-       pushl   %edx
-       pushf
-       pushl   %esi
-       pushl   %edi
-       pushl   %ecx
-       pushl   %ebx
-       pushl   %eax
-       movl    %fs:4,%ebx
-       pushl   $tls::saved_errno(%ebx) # saved errno
-3:     pushl   $tls::oldmask(%ebx)     # oldmask
-       pushl   $tls::sig(%ebx)         # signal argument
-       pushl   \$_sigreturn
-
-       call    _reset_signal_arrived\@0
-       pushl   $tls::func(%ebx)        # signal func
-       pushl   $tls::newmask(%ebx)     # newmask - eaten by set_process_mask
-
-       call    _set_process_mask\@4
-       cmpl    \$0,$tls::threadkill(%ebx)#pthread_kill signal?
-       jnz     4f                      #yes.  Callee clears signal number
-       movl    \$0,$tls::sig(%ebx)     # zero the signal number as a
-                                       # flag to the signal handler thread
-                                       # that it is ok to set up sigsave
-4:     ret
-
 EOF
     }
     return $res;