* cygtls.h (__ljfault): Declare.

(_cygtls::return_from_fault): Use __ljfault.
* exceptions.cc (set_signal_mask): Revert previous checkin.
* gendef (__sjfault): Split out into a separate function which doesn't bother
with any special signal locking.  routines.
(_ljfault): Return from a __sjfault without bothering with signals.
This commit is contained in:
Christopher Faylor 2005-08-28 23:26:23 +00:00
parent 2241d3fb53
commit c461fbf160
4 changed files with 82 additions and 4 deletions

View File

@ -1,3 +1,12 @@
2005-08-28 Christopher Faylor <cgf@timesys.com>
* cygtls.h (__ljfault): Declare.
(_cygtls::return_from_fault): Use __ljfault.
* exceptions.cc (set_signal_mask): Revert previous checkin.
* gendef (__sjfault): Split out into a separate function which doesn't
bother with any special signal locking. routines.
(_ljfault): Return from a __sjfault without bothering with signals.
2005-08-28 Christopher Faylor <cgf@timesys.com> 2005-08-28 Christopher Faylor <cgf@timesys.com>
* cygtls.h (_local_storage::strerror_buf): Allocate more space. * cygtls.h (_local_storage::strerror_buf): Allocate more space.

View File

@ -148,6 +148,8 @@ typedef struct struct_waitq
#include "cygerrno.h" #include "cygerrno.h"
extern "C" int __sjfault (jmp_buf); extern "C" int __sjfault (jmp_buf);
extern "C" int __ljfault (jmp_buf, int);
/*gentls_offsets*/ /*gentls_offsets*/
typedef __uint32_t __stack_t; typedef __uint32_t __stack_t;
@ -223,7 +225,7 @@ struct _cygtls
{ {
if (_myfault_errno) if (_myfault_errno)
set_errno (_myfault_errno); set_errno (_myfault_errno);
longjmp ((int *) _myfault, 1); __ljfault ((int *) _myfault, 1);
} }
int setup_fault (jmp_buf j, int myerrno) __attribute__ ((always_inline)) int setup_fault (jmp_buf j, int myerrno) __attribute__ ((always_inline))
{ {

View File

@ -978,17 +978,19 @@ set_process_mask_delta ()
extern "C" void __stdcall extern "C" void __stdcall
set_signal_mask (sigset_t newmask, sigset_t& oldmask) set_signal_mask (sigset_t newmask, sigset_t& oldmask)
{ {
if (GetCurrentThreadId () == sigtid)
small_printf ("********* waiting in signal thread\n");
mask_sync.acquire (INFINITE); mask_sync.acquire (INFINITE);
newmask &= ~SIG_NONMASKABLE; newmask &= ~SIG_NONMASKABLE;
sigset_t mask_bits = oldmask & ~newmask; sigset_t mask_bits = oldmask & ~newmask;
sigproc_printf ("oldmask %p, newmask %p, mask_bits %p", oldmask, newmask, sigproc_printf ("oldmask %p, newmask %p, mask_bits %p", oldmask, newmask,
mask_bits); mask_bits);
oldmask = newmask; oldmask = newmask;
mask_sync.release ();
if (mask_bits) if (mask_bits)
sig_dispatch_pending (true); sig_dispatch_pending (true);
else else
sigproc_printf ("not calling sig_dispatch_pending"); sigproc_printf ("not calling sig_dispatch_pending");
mask_sync.release ();
return; return;
} }

View File

@ -272,9 +272,8 @@ EOF
sub longjmp { sub longjmp {
return <<EOF; return <<EOF;
.globl _setjmp, ___sjfault .globl _setjmp
_setjmp: _setjmp:
___sjfault:
pushl %ebp pushl %ebp
movl %esp,%ebp movl %esp,%ebp
pushl %edi pushl %edi
@ -312,6 +311,72 @@ ___sjfault:
leave leave
ret ret
.globl ___sjfault
___sjfault:
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)
popl %edi
movl \$0,%eax
leave
ret
.global ___ljfault
___ljfault:
pushl %ebp
movl %esp,%ebp
movl 8(%ebp),%edi
movl 12(%ebp),%eax
testl %eax,%eax
jne 0f
incl %eax
0: movl %eax,0(%edi)
movl 24(%edi),%ebp
pushfl
popl %ebx
movw 42(%edi),%ax
movw %ax,%ss
movl 28(%edi),%esp
pushl 32(%edi)
pushl %ebx
movw 36(%edi),%ax
movw %ax,%es
movw 40(%edi),%ax
movw %ax,%gs
movl 0(%edi),%eax
movl 4(%edi),%ebx
movl 8(%edi),%ecx
movl 16(%edi),%esi
movl 12(%edi),%edx
movl 20(%edi),%edi
popfl
ret
.globl _longjmp .globl _longjmp
_longjmp: _longjmp:
pushl %ebp pushl %ebp