4 my $tls_offsets = shift;
9 if (!defined($in) || !defined($out) || !defined($sigfe)) {
10 die "usage: $0 deffile.in cygtls.h deffile.def sigfe.s\n";
15 open(IN, $in) or die "$0: couldn't open \"$in\" - $!\n";
19 last if /^\s*exports\s*$/i;
36 if (s/\s+NOSIGFE\s*$//) {
37 } elsif (s/ SIGFE$//) {
38 my $func = (split(' '))[2];
39 $sigfe{$func} = '_sigfe_' . $func;
42 my ($func, $sigfe) = m%^\s*(\S+)(?:\s+((?:NO)?SIGR?FE))?$%o;
43 if (defined($sigfe) && $sigfe =~ /^NO/o) {
47 $_ = '_' . lc($sigfe) . '_' . $func;
49 $_ = $func . ' = ' . $_;
52 s/(\S)\s+(\S)/$1 $2/go;
55 push(@out, $_ . "\n");
59 my ($alias, $func) = /^(\S+) = (\S+)\s*$/o;
60 $_ = $alias . ' = ' . $sigfe{$func} . "\n"
61 if defined($func) && $sigfe{$func};
63 open(OUT, '>', $out) or die "$0: couldn't open \"$out\" - $!\n";
64 print OUT @top, @data, @out;
67 open(SIGFE, '>', $sigfe) or die "$0: couldn't open sigfe file \"$sigfe\" - $!\n";
69 for my $k (sort keys %sigfe) {
70 print SIGFE fefunc($k, $sigfe{$k});
75 my $func = '_' . shift;
79 .extern _siglist_index
88 if (!$main::first++) {
89 $res = <<EOF . longjmp () . $res;
92 .stabs "_sigfe:F(0,1)",36,0,0,__sigbe
97 lock cmpxchg %eax,$tls::stacklock(%edx)
100 call _low_priority_sleep
103 xadd %eax,$tls::stackptr(%edx)
104 decl $tls::stacklock(%edx)
112 .stabs "_sigbe:F(0,1)",36,0,0,__sigbe
118 lock cmpxchg %eax,$tls::stacklock(%edx)
121 call _low_priority_sleep
124 xadd %eax,$tls::stackptr(%edx)
130 .global __ZN11_threadinfo3popEv
131 __ZN11_threadinfo3popEv:
135 xadd %ebx,$tls::pstackptr(%edx)
138 decl $tls::pstacklock(%edx)
142 .global __ZN11_threadinfo4lockEi
143 __ZN11_threadinfo4lockEi:
147 lock cmpxchg %eax,$tls::pstacklock(%ebx)
152 call _low_priority_sleep
158 .global __ZN11_threadinfo6unlockEv
159 __ZN11_threadinfo6unlockEv:
160 decl $tls::pstacklock(%eax)
164 .stabs "sigreturn:F(0,1)",36,0,0,_sigreturn
166 addl \$4,%esp # Remove argument
167 call _set_process_mask\@4
171 cmpl \$0,$tls::sig(%ebx) # Did a signal come in?
172 jnz 3f # Yes, if non-zero
174 1: popl %edx # saved errno
175 testl %edx,%edx # Is it < 0
176 jl 2f # yup. ignore it
177 movl $tls::errno_addr(%ebx),%eax
190 .stabs "sigdelayed:F(0,1)",36,0,0,_sigdelayed
202 pushl $tls::saved_errno(%ebx) # saved errno
203 3: pushl $tls::oldmask(%ebx) # oldmask
204 pushl $tls::sig(%ebx) # signal argument
207 call _reset_signal_arrived\@0
208 pushl $tls::func(%ebx) # signal func
209 pushl $tls::newmask(%ebx) # newmask - eaten by set_process_mask
211 call _set_process_mask\@4
212 cmpl \$0,$tls::threadkill(%ebx)#pthread_kill signal?
213 jnz 4f #yes. Callee clears signal number
214 movl \$0,$tls::sig(%ebx) # zero the signal number as a
215 # flag to the signal handler thread
216 # that it is ok to set up sigsave
253 leal ($tls::stack)(%eax),%edx
254 movl %edx,($tls::stackptr)(%eax)