2003-11-28 21:55:59 +01:00
|
|
|
#!/usr/bin/perl
|
2012-08-15 19:07:47 +02:00
|
|
|
# Copyright 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc.
|
2006-03-01 21:20:22 +01:00
|
|
|
#
|
|
|
|
# This file is part of Cygwin.
|
|
|
|
#
|
|
|
|
# This software is a copyrighted work licensed under the terms of the
|
|
|
|
# Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
# details.
|
|
|
|
#
|
2003-11-28 21:55:59 +01:00
|
|
|
use strict;
|
2009-06-28 20:23:35 +02:00
|
|
|
sub cleanup(@);
|
|
|
|
|
2003-11-28 21:55:59 +01:00
|
|
|
my $in = shift;
|
|
|
|
my $tls_offsets = shift;
|
|
|
|
my $out = shift;
|
|
|
|
my $sigfe = shift;
|
|
|
|
|
|
|
|
$main::first = 0;
|
|
|
|
if (!defined($in) || !defined($out) || !defined($sigfe)) {
|
|
|
|
die "usage: $0 deffile.in cygtls.h deffile.def sigfe.s\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
require $tls_offsets;
|
|
|
|
|
|
|
|
open(IN, $in) or die "$0: couldn't open \"$in\" - $!\n";
|
|
|
|
my @top = ();
|
|
|
|
while (<IN>) {
|
2009-06-28 20:23:35 +02:00
|
|
|
push(@top, cleanup $_);
|
2012-08-15 19:29:58 +02:00
|
|
|
last if /^\s*exports$/i;
|
2003-11-28 21:55:59 +01:00
|
|
|
}
|
2009-06-28 20:23:35 +02:00
|
|
|
my @in = cleanup <IN>;
|
2003-11-28 21:55:59 +01:00
|
|
|
close(IN);
|
|
|
|
|
|
|
|
my %sigfe = ();
|
|
|
|
my @data = ();
|
|
|
|
my @nosigfuncs = ();
|
2009-04-09 23:02:53 +02:00
|
|
|
my @text = ();
|
2003-11-28 21:55:59 +01:00
|
|
|
for (@in) {
|
2009-04-09 23:02:53 +02:00
|
|
|
chomp;
|
2012-08-15 19:29:58 +02:00
|
|
|
s/\s+DATA$//o and do {
|
2009-04-09 23:02:53 +02:00
|
|
|
push @data, $_;
|
2003-11-28 21:55:59 +01:00
|
|
|
next;
|
|
|
|
};
|
|
|
|
if (/=/o) {
|
|
|
|
if (s/\s+NOSIGFE\s*$//) {
|
2006-03-13 00:57:05 +01:00
|
|
|
# nothing
|
2012-08-15 19:29:58 +02:00
|
|
|
} elsif (s/\s+SIGFE(_MAYBE)?$//) {
|
2006-03-13 00:57:05 +01:00
|
|
|
my $func = (split(' '))[2];
|
|
|
|
my $maybe = lc $1 . '_';
|
|
|
|
$sigfe{$func} = '_sigfe' . $maybe . $func;
|
2003-11-28 21:55:59 +01:00
|
|
|
}
|
|
|
|
} else {
|
2006-03-13 00:57:05 +01:00
|
|
|
my ($func, $sigfe) = m%^\s*(\S+)(?:\s+((?:NO)?SIGFE(?:_MAYBE)?))?$%o;
|
2003-11-28 21:55:59 +01:00
|
|
|
if (defined($sigfe) && $sigfe =~ /^NO/o) {
|
|
|
|
$_ = $func;
|
|
|
|
} else {
|
|
|
|
$sigfe ||= 'sigfe';
|
|
|
|
$_ = '_' . lc($sigfe) . '_' . $func;
|
|
|
|
$sigfe{$func} = $_;
|
|
|
|
$_ = $func . ' = ' . $_;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
s/(\S)\s+(\S)/$1 $2/go;
|
|
|
|
s/(\S)\s+$/$1/o;
|
|
|
|
s/^\s+(\S)/$1/o;
|
2009-04-09 23:02:53 +02:00
|
|
|
push @text, $_;
|
2003-11-28 21:55:59 +01:00
|
|
|
}
|
|
|
|
|
2009-04-09 23:02:53 +02:00
|
|
|
for (@text) {
|
2012-08-15 19:29:58 +02:00
|
|
|
my ($alias, $func) = /^(\S+)\s+=\s+(\S+)\s*$/o;
|
2009-04-09 23:02:53 +02:00
|
|
|
$_ = $alias . ' = ' . $sigfe{$func}
|
2003-11-28 21:55:59 +01:00
|
|
|
if defined($func) && $sigfe{$func};
|
|
|
|
}
|
2009-04-09 23:02:53 +02:00
|
|
|
|
2003-11-28 21:55:59 +01:00
|
|
|
open(OUT, '>', $out) or die "$0: couldn't open \"$out\" - $!\n";
|
2009-04-09 23:02:53 +02:00
|
|
|
push @top, (map {$_ . " DATA\n"} @data), (map {$_ . "\n"} @text);
|
|
|
|
print OUT @top;
|
2003-11-28 21:55:59 +01:00
|
|
|
close OUT;
|
|
|
|
|
|
|
|
open(SIGFE, '>', $sigfe) or die "$0: couldn't open sigfe file \"$sigfe\" - $!\n";
|
|
|
|
|
|
|
|
for my $k (sort keys %sigfe) {
|
|
|
|
print SIGFE fefunc($k, $sigfe{$k});
|
|
|
|
}
|
|
|
|
close SIGFE;
|
|
|
|
|
|
|
|
sub fefunc {
|
|
|
|
my $func = '_' . shift;
|
|
|
|
my $fe = '_' . shift;
|
2006-03-13 00:57:05 +01:00
|
|
|
my $sigfe_func = ($fe =~ /^(.*)$func/)[0];
|
2003-11-28 21:55:59 +01:00
|
|
|
my $extra;
|
|
|
|
my $res = <<EOF;
|
|
|
|
.extern $func
|
|
|
|
.global $fe
|
|
|
|
$fe:
|
|
|
|
pushl \$$func
|
2006-03-13 00:57:05 +01:00
|
|
|
jmp $sigfe_func
|
2003-11-28 21:55:59 +01:00
|
|
|
|
|
|
|
EOF
|
|
|
|
if (!$main::first++) {
|
|
|
|
$res = <<EOF . longjmp () . $res;
|
|
|
|
.text
|
|
|
|
|
2006-03-13 00:57:05 +01:00
|
|
|
__sigfe_maybe:
|
|
|
|
pushl %ebx
|
|
|
|
pushl %edx
|
|
|
|
movl %fs:4,%ebx # location of bottom of stack
|
2006-06-02 02:09:50 +02:00
|
|
|
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
|
2006-03-13 00:57:05 +01:00
|
|
|
movl $tls::initialized(%ebx),%eax
|
|
|
|
cmpl \$0xc763173f,%eax # initialized?
|
|
|
|
je 1f
|
2006-06-02 02:09:50 +02:00
|
|
|
0: popl %edx
|
2006-03-13 00:57:05 +01:00
|
|
|
popl %ebx
|
2006-03-13 05:26:57 +01:00
|
|
|
ret
|
2006-03-13 00:57:05 +01:00
|
|
|
|
2003-11-28 21:55:59 +01:00
|
|
|
__sigfe:
|
2004-02-12 04:01:58 +01:00
|
|
|
pushl %ebx
|
2003-11-28 21:55:59 +01:00
|
|
|
pushl %edx
|
2004-03-12 03:07:39 +01:00
|
|
|
movl %fs:4,%ebx # location of bottom of stack
|
|
|
|
1: movl \$1,%eax # potential lock value
|
2010-07-18 22:10:22 +02:00
|
|
|
xchgl %eax,$tls::stacklock(%ebx) # see if we can grab it
|
2004-03-12 03:07:39 +01:00
|
|
|
movl %eax,$tls::spinning(%ebx) # flag if we are waiting for lock
|
2004-03-07 05:57:47 +01:00
|
|
|
testl %eax,%eax # it will be zero
|
2004-02-12 04:01:58 +01:00
|
|
|
jz 2f # if so
|
2010-07-18 22:10:22 +02:00
|
|
|
call _yield # should be a short-time thing, so
|
2004-02-12 04:01:58 +01:00
|
|
|
jmp 1b # sleep and loop
|
2004-03-09 02:24:08 +01:00
|
|
|
2: movl \$4,%eax # have the lock, now increment the
|
2004-03-12 03:07:39 +01:00
|
|
|
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
|
2004-02-12 04:01:58 +01:00
|
|
|
popl %edx # restore saved value
|
|
|
|
popl %ebx
|
2003-11-28 21:55:59 +01:00
|
|
|
ret
|
|
|
|
|
2004-02-08 20:59:27 +01:00
|
|
|
.global __sigbe
|
2005-10-29 17:19:34 +02:00
|
|
|
__sigbe: # return here after cygwin syscall
|
2004-02-12 04:01:58 +01:00
|
|
|
pushl %eax # don't clobber
|
2010-08-01 21:10:52 +02:00
|
|
|
pushl %ebx # tls pointer
|
2004-03-12 03:07:39 +01:00
|
|
|
1: movl %fs:4,%ebx # address of bottom of tls
|
2004-02-12 04:01:58 +01:00
|
|
|
movl \$1,%eax # potential lock value
|
2010-07-18 22:10:22 +02:00
|
|
|
xchgl %eax,$tls::stacklock(%ebx) # see if we can grab it
|
2004-03-12 03:07:39 +01:00
|
|
|
movl %eax,$tls::spinning(%ebx) # flag if we are waiting for lock
|
2004-03-07 05:57:47 +01:00
|
|
|
testl %eax,%eax # it will be zero
|
2004-02-12 04:01:58 +01:00
|
|
|
jz 2f # if so
|
2010-07-18 22:10:22 +02:00
|
|
|
call _yield # sleep
|
2004-02-12 04:01:58 +01:00
|
|
|
jmp 1b # and loop
|
|
|
|
2: movl \$-4,%eax # now decrement aux stack
|
2004-03-12 03:07:39 +01:00
|
|
|
xadd %eax,$tls::stackptr(%ebx) # and get pointer
|
2010-08-01 21:10:52 +02:00
|
|
|
movl -4(%eax),%eax # get return address from signal stack
|
|
|
|
xchgl %eax,4(%esp) # swap return address with saved eax
|
2007-08-09 19:20:09 +02:00
|
|
|
decl $tls::incyg(%ebx)
|
2004-03-12 03:07:39 +01:00
|
|
|
decl $tls::stacklock(%ebx) # release lock
|
|
|
|
popl %ebx
|
2004-02-08 20:59:27 +01:00
|
|
|
ret
|
|
|
|
|
2004-03-05 20:09:04 +01:00
|
|
|
.global _sigdelayed
|
|
|
|
_sigdelayed:
|
2012-07-29 23:43:29 +02:00
|
|
|
pushl %ebp
|
|
|
|
movl %esp,%ebp
|
2004-03-05 20:09:04 +01:00
|
|
|
pushf
|
2012-07-29 23:43:29 +02:00
|
|
|
pushl %esi
|
|
|
|
pushl %edi
|
|
|
|
pushl %edx
|
|
|
|
pushl %ecx
|
|
|
|
pushl %ebx
|
|
|
|
pushl %eax
|
|
|
|
movl %fs:4,%ebx # get tls
|
|
|
|
pushl $tls::saved_errno(%ebx) # saved errno
|
2004-03-05 20:09:04 +01:00
|
|
|
|
2012-07-29 23:43:29 +02:00
|
|
|
movl \$$tls::start_offset,%eax # point to beginning
|
|
|
|
addl %ebx,%eax # of tls block
|
|
|
|
call __ZN7_cygtls19call_signal_handlerEv # call handler
|
2011-12-16 17:32:25 +01:00
|
|
|
|
2012-07-29 23:43:29 +02:00
|
|
|
movl %fs:4,%ebx # reget tls
|
2011-12-16 17:32:25 +01:00
|
|
|
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 # sleep
|
|
|
|
jmp 1b # and loop
|
|
|
|
2: popl %edx # saved errno
|
|
|
|
testl %edx,%edx # Is it < 0
|
|
|
|
jl 3f # yup. ignore it
|
|
|
|
movl $tls::errno_addr(%ebx),%eax
|
|
|
|
movl %edx,(%eax)
|
|
|
|
3: movl \$-4,%eax # now decrement aux stack
|
|
|
|
xadd %eax,$tls::stackptr(%ebx) # and get pointer
|
|
|
|
xorl %ebp,%ebp
|
|
|
|
xchgl %ebp,-4(%eax) # get return address from signal stack
|
|
|
|
xchgl %ebp,28(%esp) # store real return address
|
2012-08-15 18:35:00 +02:00
|
|
|
leave: xorl %eax,%eax
|
|
|
|
movl %eax,$tls::incyg(%ebx)
|
|
|
|
movl %eax,$tls::stacklock(%ebx) # unlock
|
2011-12-16 17:32:25 +01:00
|
|
|
|
|
|
|
popl %eax
|
|
|
|
popl %ebx
|
|
|
|
popl %ecx
|
|
|
|
popl %edx
|
|
|
|
popl %edi
|
|
|
|
popl %esi
|
|
|
|
popf
|
|
|
|
ret
|
|
|
|
|
2010-08-01 21:10:52 +02:00
|
|
|
.global __ZN7_cygtls3popEv
|
2004-02-12 04:01:58 +01:00
|
|
|
__ZN7_cygtls3popEv:
|
2004-02-08 20:59:27 +01:00
|
|
|
1: pushl %ebx
|
2010-07-18 22:10:22 +02:00
|
|
|
movl %eax,%ebx # this
|
|
|
|
movl \$-4,%eax
|
|
|
|
xadd %eax,$tls::pstackptr(%ebx)
|
2010-08-01 21:10:52 +02:00
|
|
|
movl -4(%eax),%eax
|
2004-02-08 20:59:27 +01:00
|
|
|
popl %ebx
|
2003-11-28 21:55:59 +01:00
|
|
|
ret
|
|
|
|
|
2004-02-12 04:01:58 +01:00
|
|
|
.global __ZN7_cygtls4lockEv
|
|
|
|
__ZN7_cygtls4lockEv:
|
2004-03-12 03:07:39 +01:00
|
|
|
pushl %ebx
|
|
|
|
movl %eax,%ebx
|
2004-02-08 20:59:27 +01:00
|
|
|
1: movl \$1,%eax
|
2010-07-18 22:10:22 +02:00
|
|
|
xchgl %eax,$tls::pstacklock(%ebx)
|
2004-03-07 05:57:47 +01:00
|
|
|
testl %eax,%eax
|
2004-02-08 20:59:27 +01:00
|
|
|
jz 2f
|
2010-03-13 00:13:48 +01:00
|
|
|
call _yield
|
2004-02-08 20:59:27 +01:00
|
|
|
jmp 1b
|
2004-03-12 03:07:39 +01:00
|
|
|
2: popl %ebx
|
2004-02-08 20:59:27 +01:00
|
|
|
ret
|
|
|
|
|
2004-02-12 04:01:58 +01:00
|
|
|
.global __ZN7_cygtls6unlockEv
|
|
|
|
__ZN7_cygtls6unlockEv:
|
2004-02-08 20:59:27 +01:00
|
|
|
decl $tls::pstacklock(%eax)
|
|
|
|
ret
|
|
|
|
|
2004-02-12 04:01:58 +01:00
|
|
|
.global __ZN7_cygtls6lockedEv
|
|
|
|
__ZN7_cygtls6lockedEv:
|
|
|
|
movl $tls::pstacklock(%eax),%eax
|
|
|
|
ret
|
|
|
|
|
2004-03-04 06:31:14 +01:00
|
|
|
.extern __ZN7_cygtls19call_signal_handlerEv
|
|
|
|
stabilize_sig_stack:
|
2004-03-12 03:07:39 +01:00
|
|
|
movl %fs:4,%ebx
|
|
|
|
1: movl \$1,%eax
|
2010-07-18 22:10:22 +02:00
|
|
|
xchgl %eax,$tls::stacklock(%ebx)
|
2004-03-12 03:07:39 +01:00
|
|
|
movl %eax,$tls::spinning(%ebx) # flag if we are waiting for lock
|
2004-03-07 05:57:47 +01:00
|
|
|
testl %eax,%eax
|
2004-03-04 06:31:14 +01:00
|
|
|
jz 2f
|
2010-03-13 00:13:48 +01:00
|
|
|
call _yield
|
2004-03-04 06:31:14 +01:00
|
|
|
jmp 1b
|
2010-08-01 21:10:52 +02:00
|
|
|
2: incl $tls::incyg(%ebx)
|
|
|
|
cmpl \$0,$tls::sig(%ebx)
|
2004-03-04 06:31:14 +01:00
|
|
|
jz 3f
|
2004-03-12 03:07:39 +01:00
|
|
|
decl $tls::stacklock(%ebx) # unlock
|
2012-07-29 23:43:29 +02:00
|
|
|
movl \$$tls::start_offset,%eax # point to beginning
|
2004-03-12 03:07:39 +01:00
|
|
|
addl %ebx,%eax # of tls block
|
2004-03-04 06:31:14 +01:00
|
|
|
call __ZN7_cygtls19call_signal_handlerEv
|
|
|
|
jmp 1b
|
2004-03-12 03:07:39 +01:00
|
|
|
3: decl $tls::incyg(%ebx)
|
2004-03-09 02:24:08 +01:00
|
|
|
ret
|
2003-11-28 21:55:59 +01:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
return $res;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub longjmp {
|
|
|
|
return <<EOF;
|
|
|
|
|
2005-08-29 01:26:23 +02:00
|
|
|
.globl _setjmp
|
2004-02-18 21:48:38 +01:00
|
|
|
_setjmp:
|
2003-11-28 21:55:59 +01:00
|
|
|
pushl %ebp
|
|
|
|
movl %esp,%ebp
|
2004-02-18 21:48:38 +01:00
|
|
|
pushl %edi
|
2003-11-28 21:55:59 +01:00
|
|
|
movl 8(%ebp),%edi
|
2004-02-18 21:48:38 +01:00
|
|
|
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)
|
2008-03-01 14:18:22 +01:00
|
|
|
movl %fs:0,%eax
|
|
|
|
movl %eax,44(%edi)
|
2004-03-12 03:07:39 +01:00
|
|
|
pushl %ebx
|
2004-02-18 21:48:38 +01:00
|
|
|
call stabilize_sig_stack
|
2004-03-12 03:07:39 +01:00
|
|
|
movl $tls::stackptr(%ebx),%eax # save stack pointer contents
|
|
|
|
decl $tls::stacklock(%ebx)
|
|
|
|
popl %ebx
|
2008-03-01 14:18:22 +01:00
|
|
|
movl %eax,48(%edi)
|
2004-02-18 21:48:38 +01:00
|
|
|
popl %edi
|
|
|
|
movl \$0,%eax
|
|
|
|
leave
|
|
|
|
ret
|
|
|
|
|
2005-08-29 01:26:23 +02:00
|
|
|
.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)
|
2008-03-01 14:18:22 +01:00
|
|
|
movl %fs:0,%eax
|
|
|
|
movl %eax,44(%edi)
|
2005-08-29 01:26:23 +02:00
|
|
|
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
|
2008-03-01 14:18:22 +01:00
|
|
|
movl 44(%edi),%eax
|
|
|
|
movl %eax,%fs:0
|
2005-08-29 01:26:23 +02:00
|
|
|
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
|
|
|
|
|
2004-02-18 21:48:38 +01:00
|
|
|
.globl _longjmp
|
|
|
|
_longjmp:
|
|
|
|
pushl %ebp
|
|
|
|
movl %esp,%ebp
|
|
|
|
movl 8(%ebp),%edi # address of buffer
|
|
|
|
call stabilize_sig_stack
|
2008-03-01 14:18:22 +01:00
|
|
|
movl 48(%edi),%eax # get old signal stack
|
2004-03-12 03:07:39 +01:00
|
|
|
movl %eax,$tls::stackptr(%ebx) # restore
|
|
|
|
decl $tls::stacklock(%ebx) # relinquish lock
|
2005-12-05 21:20:18 +01:00
|
|
|
xorl %eax,%eax
|
|
|
|
movl %eax,$tls::incyg(%ebx) # we're definitely not in cygwin anymore
|
2004-02-18 21:48:38 +01:00
|
|
|
|
2003-11-28 21:55:59 +01:00
|
|
|
movl 12(%ebp),%eax
|
|
|
|
testl %eax,%eax
|
2004-02-12 04:01:58 +01:00
|
|
|
jne 3f
|
2003-11-28 21:55:59 +01:00
|
|
|
incl %eax
|
2004-02-12 04:01:58 +01:00
|
|
|
|
|
|
|
3: movl %eax,0(%edi)
|
2003-11-28 21:55:59 +01:00
|
|
|
movl 24(%edi),%ebp
|
|
|
|
pushfl
|
|
|
|
popl %ebx
|
2008-03-01 14:18:22 +01:00
|
|
|
movl 44(%edi),%eax
|
|
|
|
movl %eax,%fs:0
|
2003-11-28 21:55:59 +01:00
|
|
|
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
|
2004-02-12 04:01:58 +01:00
|
|
|
movl 12(%edi),%edx
|
2003-11-28 21:55:59 +01:00
|
|
|
movl 20(%edi),%edi
|
|
|
|
popfl
|
|
|
|
ret
|
|
|
|
EOF
|
|
|
|
}
|
2005-07-27 18:16:51 +02:00
|
|
|
|
2009-06-28 20:23:35 +02:00
|
|
|
sub cleanup(@) {
|
2005-07-27 18:16:51 +02:00
|
|
|
map {s/\r//g; $_} @_;
|
2009-06-28 20:23:35 +02:00
|
|
|
map {s/#.*//g; $_} @_;
|
|
|
|
map {s/[ \t]+$//g; $_} @_;
|
2005-07-27 18:16:51 +02:00
|
|
|
}
|