* Throughout, use __try/__except/__endtry blocks, rather than myfault
handler. * cygtls.cc (_cygtls::remove): Accommodate the fact that pathbufs has been moved from _local_storage to _cygtls. * cygtls.h (class tls_pathbuf): Add comment to hint to gendef usage of counters. Change type of counters to uint32_t for clarity. Remove _cygtls as friend class. (struct _local_storage): Move pathbufs from here... (struct _cygtls): ...to here, allowing to access it from _sigbe. (class san): Only define on 32 bit. Remove errno, _c_cnt and _w_cnt members. (san::setup): Drop parameter. Don't initialize removed members. (san::leave): Don't set removed members. (class myfault): Only define on 32 bit. (myfault::faulted): Only keep implementation not taking any parameter. Drop argument in call to sebastian.setup. (__try/__leave/__except/__endtry): Implement to support real SEH. For now stick to SJLJ on 32 bit. * dcrt0.cc (dll_crt0_0): Drop 64 bit call to exception::install_myfault_handler. * exception.h (exception_handler): Define with EXCEPTION_DISPOSITION as return type. (PDISPATCHER_CONTEXT): Define as void * on 32 bit. Define as pointer to _DISPATCHER_CONTEXT on 64 bit. (class exception): Define separately for 32 and 64 bit. (exception::myfault): Add handler for myfault SEH handling on 64 bit. (exception::exception): Fix mangled method name to account for change in type of last parameter. (exception::install_myfault_handler): Remove. * exceptions.cc (exception::myfault_handle): Remove. (exception::myfault): New SEH handler for 64 bit. * gendef (_sigbe): Set tls_pathbuf counters to 0 explicitely when returning to the caller. * ntdll.h: Move a comment to a better place. (struct _SCOPE_TABLE): Define on 64 bit. * thread.cc (verifyable_object_isvalid): Remove gcc 4.7 workaround. * tls_pbuf.cc (tls_pbuf): Fix to accommodate new place of pathbufs. (tls_pathbuf::destroy): Change type of loop variables to uint32_t. * tls_pbuf.h (class tmp_pathbuf): Change type of buffer counters to uint32_t. Accommodate new place of pathbufs. * tlsoffsets.h: Regenerate. * tlsoffsets64.h: Regenerate.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/perl
|
||||
# Copyright 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011, 2012, 2013
|
||||
# Copyright 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011, 2012, 2013, 2014
|
||||
# Red Hat, Inc.
|
||||
#
|
||||
# This file is part of Cygwin.
|
||||
@@ -181,6 +181,8 @@ _sigbe: # return here after cygwin syscall
|
||||
movq -8(%r11),%r11 # get return address from signal stack
|
||||
decl $tls::incyg(%r10)
|
||||
decl $tls::stacklock(%r10) # release lock
|
||||
leaq $tls::pathbufs(%r10),%r10 # Address of tls_pathbufs
|
||||
movq \$0,(%r10) # Set c_cnt and w_cnt to 0
|
||||
jmp *%r11 # "return" to caller
|
||||
.seh_endproc
|
||||
|
||||
@@ -366,7 +368,7 @@ stabilize_sig_stack:
|
||||
movq %gs:8,%r12
|
||||
1: movl \$1,%r10d
|
||||
xchgl %r10d,$tls::stacklock(%r12)
|
||||
movl %r10d,$tls::spinning(%r12) # flag if we are waiting for lock
|
||||
movl %r10d,$tls::spinning(%r12) # flag if we are waiting for lock
|
||||
testl %r10d,%r10d
|
||||
jz 2f
|
||||
pause
|
||||
@@ -374,14 +376,14 @@ stabilize_sig_stack:
|
||||
2: incl $tls::incyg(%r12)
|
||||
cmpl \$0,$tls::sig(%r12)
|
||||
jz 3f
|
||||
decl $tls::stacklock(%r12) # unlock
|
||||
movq \$$tls::start_offset,%rcx # point to beginning
|
||||
addq %r12,%rcx # of tls block
|
||||
decl $tls::stacklock(%r12) # unlock
|
||||
movq \$$tls::start_offset,%rcx # point to beginning
|
||||
addq %r12,%rcx # of tls block
|
||||
call _ZN7_cygtls19call_signal_handlerEv
|
||||
jmp 1b
|
||||
3: decl $tls::incyg(%r12)
|
||||
addq \$0x20,%rsp
|
||||
movq %r12,%r11 # return tls addr in r11
|
||||
movq %r12,%r11 # return tls addr in r11
|
||||
popq %r12
|
||||
ret
|
||||
.seh_endproc
|
||||
@@ -393,13 +395,13 @@ EOF
|
||||
__sigfe_maybe:
|
||||
pushl %ebx
|
||||
pushl %edx
|
||||
movl %fs:4,%ebx # location of bottom of stack
|
||||
addl \$$tls::initialized,%ebx # where we will be looking
|
||||
cmpl %ebx,%esp # stack loc > than tls
|
||||
jge 0f # yep. we don't have a tls.
|
||||
subl \$$tls::initialized,%ebx # where we will be looking
|
||||
movl %fs:4,%ebx # location of bottom of stack
|
||||
addl \$$tls::initialized,%ebx # where we will be looking
|
||||
cmpl %ebx,%esp # stack loc > than tls
|
||||
jge 0f # yep. we don't have a tls.
|
||||
subl \$$tls::initialized,%ebx # where we will be looking
|
||||
movl $tls::initialized(%ebx),%eax
|
||||
cmpl \$0xc763173f,%eax # initialized?
|
||||
cmpl \$0xc763173f,%eax # initialized?
|
||||
je 1f
|
||||
0: popl %edx
|
||||
popl %ebx
|
||||
@@ -408,43 +410,46 @@ __sigfe_maybe:
|
||||
__sigfe:
|
||||
pushl %ebx
|
||||
pushl %edx
|
||||
movl %fs:4,%ebx # location of bottom of stack
|
||||
1: movl \$1,%eax # potential lock value
|
||||
xchgl %eax,$tls::stacklock(%ebx) # see if we can grab it
|
||||
movl %eax,$tls::spinning(%ebx) # flag if we are waiting for lock
|
||||
testl %eax,%eax # it will be zero
|
||||
jz 2f # if so
|
||||
call _yield # should be a short-time thing, so
|
||||
jmp 1b # sleep and loop
|
||||
2: movl \$4,%eax # have the lock, now increment the
|
||||
xadd %eax,$tls::stackptr(%ebx) # stack pointer and get pointer
|
||||
leal __sigbe,%edx # new place to return to
|
||||
xchgl %edx,12(%esp) # exchange with real return value
|
||||
movl %edx,(%eax) # store real return value on alt stack
|
||||
movl %fs:4,%ebx # location of bottom of stack
|
||||
1: movl \$1,%eax # potential lock value
|
||||
xchgl %eax,$tls::stacklock(%ebx) # see if we can grab it
|
||||
movl %eax,$tls::spinning(%ebx) # flag if we are waiting for lock
|
||||
testl %eax,%eax # it will be zero
|
||||
jz 2f # if so
|
||||
call _yield # should be a short-time thing, so
|
||||
jmp 1b # sleep and loop
|
||||
2: movl \$4,%eax # have the lock, now increment the
|
||||
xadd %eax,$tls::stackptr(%ebx) # stack pointer and get pointer
|
||||
leal __sigbe,%edx # new place to return to
|
||||
xchgl %edx,12(%esp) # exchange with real return value
|
||||
movl %edx,(%eax) # store real return value on alt stack
|
||||
incl $tls::incyg(%ebx)
|
||||
decl $tls::stacklock(%ebx) # remove lock
|
||||
popl %edx # restore saved value
|
||||
decl $tls::stacklock(%ebx) # remove lock
|
||||
popl %edx # restore saved value
|
||||
popl %ebx
|
||||
ret
|
||||
|
||||
.global __sigbe
|
||||
__sigbe: # return here after cygwin syscall
|
||||
pushl %eax # don't clobber
|
||||
pushl %ebx # tls pointer
|
||||
1: movl %fs:4,%ebx # address of bottom of tls
|
||||
movl \$1,%eax # potential lock value
|
||||
xchgl %eax,$tls::stacklock(%ebx) # see if we can grab it
|
||||
movl %eax,$tls::spinning(%ebx) # flag if we are waiting for lock
|
||||
testl %eax,%eax # it will be zero
|
||||
jz 2f # if so
|
||||
call _yield # sleep
|
||||
jmp 1b # and loop
|
||||
2: movl \$-4,%eax # now decrement aux stack
|
||||
xadd %eax,$tls::stackptr(%ebx) # and get pointer
|
||||
movl -4(%eax),%eax # get return address from signal stack
|
||||
xchgl %eax,4(%esp) # swap return address with saved eax
|
||||
__sigbe: # return here after cygwin syscall
|
||||
pushl %eax # don't clobber
|
||||
pushl %ebx # tls pointer
|
||||
1: movl %fs:4,%ebx # address of bottom of tls
|
||||
movl \$1,%eax # potential lock value
|
||||
xchgl %eax,$tls::stacklock(%ebx) # see if we can grab it
|
||||
movl %eax,$tls::spinning(%ebx) # flag if we are waiting for lock
|
||||
testl %eax,%eax # it will be zero
|
||||
jz 2f # if so
|
||||
call _yield # sleep
|
||||
jmp 1b # and loop
|
||||
2: movl \$-4,%eax # now decrement aux stack
|
||||
xadd %eax,$tls::stackptr(%ebx) # and get pointer
|
||||
movl -4(%eax),%eax # get return address from signal stack
|
||||
xchgl %eax,4(%esp) # swap return address with saved eax
|
||||
decl $tls::incyg(%ebx)
|
||||
decl $tls::stacklock(%ebx) # release lock
|
||||
decl $tls::stacklock(%ebx) # release lock
|
||||
leal $tls::pathbufs(%ebx),%ebx # Address of tls_pathbufs
|
||||
movl \$0,(%ebx) # Set c_cnt to 0
|
||||
movl \$0,4(%ebx) # Set w_cnt to 0
|
||||
popl %ebx
|
||||
ret
|
||||
|
||||
|
Reference in New Issue
Block a user