2003-11-28 21:55:59 +01:00
|
|
|
#!/usr/bin/perl
|
2013-01-21 05:34:52 +01:00
|
|
|
# Copyright 2003, 2004, 2005, 2006, 2008, 2009, 2010, 2011, 2012, 2013
|
|
|
|
# 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;
|
2013-05-01 01:43:08 +02:00
|
|
|
use integer;
|
|
|
|
use Getopt::Long;
|
|
|
|
|
2009-06-28 20:23:35 +02:00
|
|
|
sub cleanup(@);
|
|
|
|
|
2013-05-01 01:43:08 +02:00
|
|
|
my $cpu;
|
|
|
|
my $output_def;
|
|
|
|
my $tls_offsets;
|
|
|
|
GetOptions('cpu=s'=>\$cpu, 'output-def=s'=>\$output_def, 'tlsoffsets=s'=>\$tls_offsets);
|
2003-11-28 21:55:59 +01:00
|
|
|
|
|
|
|
$main::first = 0;
|
2013-05-01 01:43:08 +02:00
|
|
|
if (!defined($cpu) || !defined($output_def) || !defined($tls_offsets)) {
|
|
|
|
die "$0: missing required option\n";
|
2003-11-28 21:55:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
require $tls_offsets;
|
|
|
|
|
2013-05-01 01:43:08 +02:00
|
|
|
my $is64bit = $cpu eq 'x86_64';
|
|
|
|
my $sym_prefix = $is64bit ? '' : '_';
|
2013-04-23 11:44:36 +02:00
|
|
|
|
2003-11-28 21:55:59 +01:00
|
|
|
my @top = ();
|
2013-05-01 01:43:08 +02:00
|
|
|
while (<>) {
|
2009-06-28 20:23:35 +02:00
|
|
|
push(@top, cleanup $_);
|
2013-05-01 01:43:08 +02:00
|
|
|
last if /^\s*exports$/oi;
|
2003-11-28 21:55:59 +01:00
|
|
|
}
|
2013-05-01 01:43:08 +02:00
|
|
|
my @in = cleanup <>;
|
2003-11-28 21:55:59 +01:00
|
|
|
|
|
|
|
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];
|
2013-04-23 11:44:36 +02:00
|
|
|
my $maybe = (defined($1) ? lc $1 : '') . '_';
|
2006-03-13 00:57:05 +01:00
|
|
|
$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
|
|
|
|
2013-05-01 01:43:08 +02:00
|
|
|
open OUT, '>', $output_def or die "$0: couldn't open \"$output_def\" - $!\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;
|
|
|
|
|
2013-05-01 03:15:07 +02:00
|
|
|
open SIGFE, '>', 'sigfe.s' or die "$0: couldn't open 'sigfe.s' file for writing - $!\n";
|
2003-11-28 21:55:59 +01:00
|
|
|
|
|
|
|
for my $k (sort keys %sigfe) {
|
|
|
|
print SIGFE fefunc($k, $sigfe{$k});
|
|
|
|
}
|
|
|
|
close SIGFE;
|
|
|
|
|
|
|
|
sub fefunc {
|
2013-04-23 11:44:36 +02:00
|
|
|
my $func = $sym_prefix . shift;
|
|
|
|
my $fe = $sym_prefix . shift;
|
|
|
|
my $sigfe_func;
|
|
|
|
if ($is64bit) {
|
|
|
|
$sigfe_func = ($fe =~ /^(.*)_${func}$/)[0];
|
|
|
|
} else {
|
|
|
|
$sigfe_func = ($fe =~ /^(.*)${func}$/)[0];
|
|
|
|
}
|
2003-11-28 21:55:59 +01:00
|
|
|
my $extra;
|
2013-04-23 11:44:36 +02:00
|
|
|
my $res;
|
|
|
|
if ($is64bit) {
|
|
|
|
$res = <<EOF;
|
2003-11-28 21:55:59 +01:00
|
|
|
.extern $func
|
|
|
|
.global $fe
|
2013-04-23 11:44:36 +02:00
|
|
|
.seh_proc $fe
|
2003-11-28 21:55:59 +01:00
|
|
|
$fe:
|
2013-04-23 11:44:36 +02:00
|
|
|
leaq $func(%rip),%r10
|
|
|
|
pushq %r10
|
|
|
|
.seh_pushreg %r10
|
|
|
|
.seh_endprologue
|
2006-03-13 00:57:05 +01:00
|
|
|
jmp $sigfe_func
|
2013-04-23 11:44:36 +02:00
|
|
|
.seh_endproc
|
|
|
|
|
|
|
|
EOF
|
|
|
|
} else {
|
|
|
|
$res = <<EOF;
|
|
|
|
.extern $func
|
|
|
|
.global $fe
|
|
|
|
$fe:
|
|
|
|
pushl \$$func
|
|
|
|
jmp $sigfe_func
|
2003-11-28 21:55:59 +01:00
|
|
|
|
|
|
|
EOF
|
2013-04-23 11:44:36 +02:00
|
|
|
}
|
2003-11-28 21:55:59 +01:00
|
|
|
if (!$main::first++) {
|
2013-04-23 11:44:36 +02:00
|
|
|
if ($is64bit) {
|
|
|
|
$res = <<EOF . longjmp () . $res;
|
|
|
|
.text
|
|
|
|
|
|
|
|
.seh_proc _sigfe_maybe
|
2013-05-21 20:26:48 +02:00
|
|
|
_sigfe_maybe: # stack is aligned on entry!
|
2013-04-23 11:44:36 +02:00
|
|
|
.seh_endprologue
|
2013-05-21 20:26:48 +02:00
|
|
|
movq %gs:8,%r10 # location of bottom of stack
|
2013-05-27 21:31:04 +02:00
|
|
|
leaq $tls::initialized(%r10),%r11 # where we will be looking
|
|
|
|
cmpq %r11,%rsp # stack loc > than tls
|
|
|
|
jge 0f # yep. we don't have a tls.
|
2013-05-21 20:26:48 +02:00
|
|
|
movl $tls::initialized(%r10),%r11d
|
2013-04-23 11:44:36 +02:00
|
|
|
cmpl \$0xc763173f,%r11d # initialized?
|
|
|
|
je 1f
|
2013-05-27 21:31:04 +02:00
|
|
|
0: ret
|
2013-04-23 11:44:36 +02:00
|
|
|
.seh_endproc
|
|
|
|
|
|
|
|
.seh_proc _sigfe
|
|
|
|
_sigfe: # stack is aligned on entry!
|
|
|
|
.seh_endprologue
|
2013-05-21 20:26:48 +02:00
|
|
|
movq %gs:8,%r10 # location of bottom of stack
|
2013-04-23 11:44:36 +02:00
|
|
|
1: movl \$1,%r11d # potential lock value
|
2013-05-21 20:26:48 +02:00
|
|
|
xchgl %r11d,$tls::stacklock(%r10) # see if we can grab it
|
|
|
|
movl %r11d,$tls::spinning(%r10) # flag if we are waiting for lock
|
2013-04-23 11:44:36 +02:00
|
|
|
testl %r11d,%r11d # it will be zero
|
|
|
|
jz 2f # if so
|
|
|
|
pause
|
|
|
|
jmp 1b # loop
|
|
|
|
2: movq \$8,%rax # have the lock, now increment the
|
2013-05-21 20:26:48 +02:00
|
|
|
xaddq %rax,$tls::stackptr(%r10) # stack pointer and get pointer
|
2013-04-23 11:44:36 +02:00
|
|
|
leaq _sigbe(%rip),%r11 # new place to return to
|
2013-05-21 20:26:48 +02:00
|
|
|
xchgq %r11,8(%rsp) # exchange with real return value
|
2013-04-23 11:44:36 +02:00
|
|
|
movq %r11,(%rax) # store real return value on alt stack
|
2013-05-21 20:26:48 +02:00
|
|
|
incl $tls::incyg(%r10)
|
|
|
|
decl $tls::stacklock(%r10) # remove lock
|
2013-04-23 11:44:36 +02:00
|
|
|
popq %rax # pop real function address from stack
|
|
|
|
jmp *%rax # and jmp to it
|
|
|
|
.seh_endproc
|
|
|
|
|
|
|
|
.seh_proc _sigfe
|
|
|
|
_sigbe: # return here after cygwin syscall
|
|
|
|
# stack is aligned on entry!
|
|
|
|
.seh_endprologue
|
2013-05-21 20:26:48 +02:00
|
|
|
movq %gs:8,%r10 # address of bottom of tls
|
2013-04-23 11:44:36 +02:00
|
|
|
1: movl \$1,%r11d # potential lock value
|
2013-05-21 20:26:48 +02:00
|
|
|
xchgl %r11d,$tls::stacklock(%r10) # see if we can grab it
|
|
|
|
movl %r11d,$tls::spinning(%r10) # flag if we are waiting for lock
|
2013-04-23 11:44:36 +02:00
|
|
|
testl %r11d,%r11d # it will be zero
|
|
|
|
jz 2f # if so
|
|
|
|
pause
|
|
|
|
jmp 1b # and loop
|
|
|
|
2: movq \$-8,%r11 # now decrement aux stack
|
2013-05-21 20:26:48 +02:00
|
|
|
xaddq %r11,$tls::stackptr(%r10) # and get pointer
|
2013-04-23 11:44:36 +02:00
|
|
|
movq -8(%r11),%r11 # get return address from signal stack
|
2013-05-21 20:26:48 +02:00
|
|
|
decl $tls::incyg(%r10)
|
|
|
|
decl $tls::stacklock(%r10) # release lock
|
2013-04-23 11:44:36 +02:00
|
|
|
jmp *%r11 # "return" to caller
|
|
|
|
.seh_endproc
|
|
|
|
|
|
|
|
.global sigdelayed
|
|
|
|
.seh_proc sigdelayed
|
|
|
|
sigdelayed:
|
|
|
|
pushq %r10 # used for return address injection
|
|
|
|
.seh_pushreg %rbp
|
|
|
|
pushq %rbp
|
|
|
|
.seh_pushreg %rbp
|
|
|
|
movq %rsp,%rbp
|
|
|
|
# stack is aligned or unaligned on entry!
|
|
|
|
# make sure it is aligned from here on
|
|
|
|
# We could be called from an interrupted thread which doesn't know
|
|
|
|
# about his fate, so save and restore everything and the kitchen sink.
|
|
|
|
andq \$0xfffffffffffffff0,%rsp
|
|
|
|
.seh_setframe %rbp,0
|
|
|
|
pushq %r15
|
|
|
|
.seh_pushreg %r15
|
|
|
|
pushq %r14
|
|
|
|
.seh_pushreg %r14
|
|
|
|
pushq %r13
|
|
|
|
.seh_pushreg %r13
|
|
|
|
pushq %r12
|
|
|
|
.seh_pushreg %r12
|
|
|
|
pushq %r11
|
|
|
|
.seh_pushreg %r11
|
|
|
|
pushq %r9
|
|
|
|
.seh_pushreg %r9
|
|
|
|
pushq %r8
|
|
|
|
.seh_pushreg %r8
|
|
|
|
pushq %rsi
|
|
|
|
.seh_pushreg %rsi
|
|
|
|
pushq %rdi
|
|
|
|
.seh_pushreg %rdi
|
|
|
|
pushq %rdx
|
|
|
|
.seh_pushreg %rdx
|
|
|
|
pushq %rcx
|
|
|
|
.seh_pushreg %rcx
|
|
|
|
pushq %rbx
|
|
|
|
.seh_pushreg %rbx
|
|
|
|
pushq %rax
|
|
|
|
.seh_pushreg %rax
|
|
|
|
pushf
|
2014-01-27 21:08:36 +01:00
|
|
|
subq \$0x130,%rsp
|
|
|
|
.seh_stackalloc 0x130
|
|
|
|
fnstcw 0x120(%rsp)
|
2013-04-23 11:44:36 +02:00
|
|
|
movdqa %xmm15,0x110(%rsp)
|
|
|
|
movdqa %xmm14,0x100(%rsp)
|
|
|
|
movdqa %xmm13,0xf0(%rsp)
|
|
|
|
movdqa %xmm12,0xe0(%rsp)
|
|
|
|
movdqa %xmm11,0xd0(%rsp)
|
|
|
|
movdqa %xmm10,0xc0(%rsp)
|
|
|
|
movdqa %xmm9,0xb0(%rsp)
|
|
|
|
movdqa %xmm8,0xa0(%rsp)
|
|
|
|
movdqa %xmm7,0x90(%rsp)
|
|
|
|
movdqa %xmm6,0x80(%rsp)
|
|
|
|
movdqa %xmm5,0x70(%rsp)
|
|
|
|
movdqa %xmm4,0x60(%rsp)
|
|
|
|
movdqa %xmm3,0x50(%rsp)
|
|
|
|
movdqa %xmm2,0x40(%rsp)
|
|
|
|
movdqa %xmm1,0x30(%rsp)
|
|
|
|
movdqa %xmm0,0x20(%rsp)
|
|
|
|
.seh_endprologue
|
|
|
|
|
|
|
|
movq %gs:8,%r12 # get tls
|
|
|
|
movl $tls::saved_errno(%r12),%r15d # temporarily save saved_errno
|
|
|
|
movq \$$tls::start_offset,%rcx # point to beginning of tls block
|
|
|
|
addq %r12,%rcx # and store as first arg to method
|
|
|
|
call _ZN7_cygtls19call_signal_handlerEv # call handler
|
|
|
|
|
|
|
|
1: movl \$1,%r11d # potential lock value
|
|
|
|
xchgl %r11d,$tls::stacklock(%r12) # see if we can grab it
|
|
|
|
movl %r11d,$tls::spinning(%r12) # flag if we are waiting for lock
|
|
|
|
testl %r11d,%r11d # it will be zero
|
|
|
|
jz 2f # if so
|
|
|
|
pause
|
|
|
|
jmp 1b # and loop
|
|
|
|
2: testl %r15d,%r15d # was saved_errno < 0
|
|
|
|
jl 3f # yup. ignore it
|
|
|
|
movq $tls::errno_addr(%r12),%r11
|
|
|
|
movl %r15d,(%r11)
|
|
|
|
3: movq \$-8,%r11 # now decrement aux stack
|
|
|
|
xaddq %r11,$tls::stackptr(%r12) # and get pointer
|
|
|
|
xorq %r10,%r10
|
|
|
|
xchgq %r10,-8(%r11) # get return address from signal stack
|
|
|
|
xorl %r11d,%r11d
|
|
|
|
movl %r11d,$tls::incyg(%r12)
|
|
|
|
movl %r11d,$tls::stacklock(%r12) # unlock
|
|
|
|
movdqa 0x20(%rsp),%xmm0
|
|
|
|
movdqa 0x30(%rsp),%xmm1
|
|
|
|
movdqa 0x40(%rsp),%xmm2
|
|
|
|
movdqa 0x50(%rsp),%xmm3
|
|
|
|
movdqa 0x60(%rsp),%xmm4
|
|
|
|
movdqa 0x70(%rsp),%xmm5
|
|
|
|
movdqa 0x80(%rsp),%xmm6
|
|
|
|
movdqa 0x90(%rsp),%xmm7
|
|
|
|
movdqa 0xa0(%rsp),%xmm8
|
|
|
|
movdqa 0xb0(%rsp),%xmm9
|
|
|
|
movdqa 0xc0(%rsp),%xmm10
|
|
|
|
movdqa 0xd0(%rsp),%xmm11
|
|
|
|
movdqa 0xe0(%rsp),%xmm12
|
|
|
|
movdqa 0xf0(%rsp),%xmm13
|
|
|
|
movdqa 0x100(%rsp),%xmm14
|
|
|
|
movdqa 0x110(%rsp),%xmm15
|
2014-01-27 21:08:36 +01:00
|
|
|
fninit
|
|
|
|
fldcw 0x120(%rsp)
|
|
|
|
addq \$0x130,%rsp
|
2013-04-23 11:44:36 +02:00
|
|
|
popf
|
|
|
|
popq %rax
|
|
|
|
popq %rbx
|
|
|
|
popq %rcx
|
|
|
|
popq %rdx
|
|
|
|
popq %rdi
|
|
|
|
popq %rsi
|
|
|
|
popq %r8
|
|
|
|
popq %r9
|
|
|
|
popq %r11
|
|
|
|
popq %r12
|
|
|
|
popq %r13
|
|
|
|
popq %r14
|
|
|
|
popq %r15
|
|
|
|
movq %rbp,%rsp
|
|
|
|
popq %rbp
|
|
|
|
xchgq %r10,(%rsp)
|
|
|
|
ret
|
|
|
|
.seh_endproc
|
|
|
|
|
|
|
|
# _cygtls::pop
|
|
|
|
.global _ZN7_cygtls3popEv
|
|
|
|
.seh_proc _ZN7_cygtls3popEv
|
|
|
|
_ZN7_cygtls3popEv:
|
|
|
|
.seh_endprologue
|
|
|
|
movq \$-8,%r11
|
|
|
|
xaddq %r11,$tls::pstackptr(%rcx)
|
|
|
|
movq -8(%r11),%rax
|
|
|
|
ret
|
|
|
|
.seh_endproc
|
|
|
|
|
|
|
|
# _cygtls::lock
|
|
|
|
.global _ZN7_cygtls4lockEv
|
|
|
|
.seh_proc _ZN7_cygtls4lockEv
|
|
|
|
_ZN7_cygtls4lockEv:
|
|
|
|
pushq %r12
|
|
|
|
.seh_pushreg %r12
|
|
|
|
.seh_endprologue
|
|
|
|
movq %rcx,%r12
|
|
|
|
1: movl \$1,%r11d
|
|
|
|
xchgl %r11d,$tls::pstacklock(%r12)
|
|
|
|
testl %r11d,%r11d
|
|
|
|
jz 2f
|
|
|
|
pause
|
|
|
|
jmp 1b
|
|
|
|
2: popq %r12
|
|
|
|
ret
|
|
|
|
.seh_endproc
|
|
|
|
|
|
|
|
# _cygtls::unlock
|
|
|
|
.global _ZN7_cygtls6unlockEv
|
|
|
|
.seh_proc _ZN7_cygtls6unlockEv
|
|
|
|
_ZN7_cygtls6unlockEv:
|
|
|
|
.seh_endprologue
|
|
|
|
decl $tls::pstacklock(%rcx)
|
|
|
|
ret
|
|
|
|
.seh_endproc
|
|
|
|
|
|
|
|
# _cygtls::locked
|
|
|
|
.global _ZN7_cygtls6lockedEv
|
|
|
|
.seh_proc _ZN7_cygtls6lockedEv
|
|
|
|
_ZN7_cygtls6lockedEv:
|
|
|
|
.seh_endprologue
|
|
|
|
movl $tls::pstacklock(%rcx),%eax
|
|
|
|
ret
|
|
|
|
.seh_endproc
|
|
|
|
|
|
|
|
.seh_proc stabilize_sig_stack
|
|
|
|
stabilize_sig_stack:
|
|
|
|
pushq %r12
|
|
|
|
.seh_pushreg %r12
|
|
|
|
subq \$0x20,%rsp
|
|
|
|
.seh_stackalloc 32
|
|
|
|
.seh_endprologue
|
|
|
|
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
|
|
|
|
testl %r10d,%r10d
|
|
|
|
jz 2f
|
|
|
|
pause
|
|
|
|
jmp 1b
|
|
|
|
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
|
|
|
|
call _ZN7_cygtls19call_signal_handlerEv
|
|
|
|
jmp 1b
|
|
|
|
3: decl $tls::incyg(%r12)
|
|
|
|
addq \$0x20,%rsp
|
|
|
|
movq %r12,%r11 # return tls addr in r11
|
|
|
|
popq %r12
|
|
|
|
ret
|
|
|
|
.seh_endproc
|
|
|
|
EOF
|
|
|
|
} else {
|
|
|
|
$res = <<EOF . longjmp () . $res;
|
2003-11-28 21:55:59 +01:00
|
|
|
.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
|
2014-01-27 21:08:36 +01:00
|
|
|
# We could be called from an interrupted thread which doesn't know
|
|
|
|
# about his fate, so save and restore everything and the kitchen sink.
|
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
|
2014-01-27 21:08:36 +01:00
|
|
|
subl \$0x84,%esp
|
|
|
|
fnstcw 0x80(%esp)
|
|
|
|
movdqu %xmm7,0x70(%esp)
|
|
|
|
movdqu %xmm6,0x60(%esp)
|
|
|
|
movdqu %xmm5,0x50(%esp)
|
|
|
|
movdqu %xmm4,0x40(%esp)
|
|
|
|
movdqu %xmm3,0x30(%esp)
|
|
|
|
movdqu %xmm2,0x20(%esp)
|
|
|
|
movdqu %xmm1,0x10(%esp)
|
|
|
|
movdqu %xmm0,(%esp)
|
2012-07-29 23:43:29 +02:00
|
|
|
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
|
2013-01-21 05:34:52 +01:00
|
|
|
call __ZN7_cygtls19call_signal_handlerEv\@4 # 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
|
2014-01-27 21:08:36 +01:00
|
|
|
xchgl %ebp,0xa0(%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
|
|
|
|
2014-01-27 21:08:36 +01:00
|
|
|
movdqu (%esp),%xmm0
|
|
|
|
movdqu 0x10(%esp),%xmm1
|
|
|
|
movdqu 0x20(%esp),%xmm2
|
|
|
|
movdqu 0x30(%esp),%xmm3
|
|
|
|
movdqu 0x40(%esp),%xmm4
|
|
|
|
movdqu 0x50(%esp),%xmm5
|
|
|
|
movdqu 0x60(%esp),%xmm6
|
|
|
|
movdqu 0x70(%esp),%xmm7
|
|
|
|
fninit
|
|
|
|
fldcw 0x80(%esp)
|
|
|
|
addl \$0x84,%esp
|
2011-12-16 17:32:25 +01:00
|
|
|
popl %eax
|
|
|
|
popl %ebx
|
|
|
|
popl %ecx
|
|
|
|
popl %edx
|
|
|
|
popl %edi
|
|
|
|
popl %esi
|
|
|
|
popf
|
|
|
|
ret
|
|
|
|
|
2013-01-21 05:34:52 +01:00
|
|
|
.global __ZN7_cygtls3popEv\@4
|
|
|
|
__ZN7_cygtls3popEv\@4:
|
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
|
|
|
|
|
2012-12-07 18:23:22 +01:00
|
|
|
# _cygtls::lock
|
2013-01-21 05:34:52 +01:00
|
|
|
.global __ZN7_cygtls4lockEv\@4
|
|
|
|
__ZN7_cygtls4lockEv\@4:
|
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
|
|
|
|
|
2012-12-07 18:23:22 +01:00
|
|
|
# _cygtls::unlock
|
2013-01-21 05:34:52 +01:00
|
|
|
.global __ZN7_cygtls6unlockEv\@4
|
|
|
|
__ZN7_cygtls6unlockEv\@4:
|
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
|
|
|
|
|
2013-01-21 05:34:52 +01:00
|
|
|
.extern __ZN7_cygtls19call_signal_handlerEv\@4
|
2004-03-04 06:31:14 +01:00
|
|
|
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
|
2013-01-21 05:34:52 +01:00
|
|
|
call __ZN7_cygtls19call_signal_handlerEv\@4
|
2004-03-04 06:31:14 +01:00
|
|
|
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
|
2013-04-23 11:44:36 +02:00
|
|
|
}
|
2003-11-28 21:55:59 +01:00
|
|
|
}
|
|
|
|
return $res;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub longjmp {
|
2013-04-23 11:44:36 +02:00
|
|
|
if ($is64bit) {
|
|
|
|
return <<EOF;
|
|
|
|
|
|
|
|
.globl setjmp
|
|
|
|
.seh_proc setjmp
|
|
|
|
setjmp:
|
|
|
|
.seh_endprologue
|
|
|
|
# We use the Windows jmp_buf layout. Store ExceptionList in Frame.
|
|
|
|
# Store alternative stackptr in Spare.
|
|
|
|
movq %gs:0,%r10
|
|
|
|
movq %r10,(%rcx)
|
|
|
|
movq %rbx,0x8(%rcx)
|
|
|
|
movq %rsp,0x10(%rcx)
|
|
|
|
movq %rbp,0x18(%rcx)
|
|
|
|
movq %rsi,0x20(%rcx)
|
|
|
|
movq %rdi,0x28(%rcx)
|
|
|
|
movq %r12,0x30(%rcx)
|
|
|
|
movq %r13,0x38(%rcx)
|
|
|
|
movq %r14,0x40(%rcx)
|
|
|
|
movq %r15,0x48(%rcx)
|
|
|
|
movq (%rsp),%r10
|
|
|
|
movq %r10,0x50(%rcx)
|
|
|
|
# jmp_buf is potentially unaligned!
|
|
|
|
movdqu %xmm6,0x60(%rcx)
|
|
|
|
movdqu %xmm7,0x70(%rcx)
|
|
|
|
movdqu %xmm8,0x80(%rcx)
|
|
|
|
movdqu %xmm9,0x90(%rcx)
|
|
|
|
movdqu %xmm10,0xa0(%rcx)
|
|
|
|
movdqu %xmm11,0xb0(%rcx)
|
|
|
|
movdqu %xmm12,0xc0(%rcx)
|
|
|
|
movdqu %xmm13,0xd0(%rcx)
|
|
|
|
movdqu %xmm14,0xe0(%rcx)
|
|
|
|
movdqu %xmm15,0xf0(%rcx)
|
|
|
|
pushq %rcx
|
|
|
|
.seh_pushreg %rcx
|
|
|
|
call stabilize_sig_stack # returns tls in r11
|
|
|
|
popq %rcx
|
|
|
|
movq $tls::stackptr(%r11),%r10
|
|
|
|
movq %r10,0x58(%rcx)
|
|
|
|
decl $tls::stacklock(%r11)
|
|
|
|
movl \$0,%eax
|
|
|
|
ret
|
|
|
|
.seh_endproc
|
|
|
|
|
|
|
|
.globl __sjfault
|
|
|
|
.seh_proc __sjfault
|
|
|
|
__sjfault:
|
|
|
|
.seh_endprologue
|
|
|
|
# Like setjmp, just w/o storing the alternate stackptr.
|
|
|
|
movq %gs:0,%r10
|
|
|
|
movq %r10,(%rcx)
|
|
|
|
movq %rbx,0x8(%rcx)
|
|
|
|
movq %rsp,0x10(%rcx)
|
|
|
|
movq %rbp,0x18(%rcx)
|
|
|
|
movq %rsi,0x20(%rcx)
|
|
|
|
movq %rdi,0x28(%rcx)
|
|
|
|
movq %r12,0x30(%rcx)
|
|
|
|
movq %r13,0x38(%rcx)
|
|
|
|
movq %r14,0x40(%rcx)
|
|
|
|
movq %r15,0x48(%rcx)
|
|
|
|
movq (%rsp),%r10
|
|
|
|
movq %r10,0x50(%rcx)
|
|
|
|
# jmp_buf is potentially unaligned!
|
|
|
|
movdqu %xmm6,0x60(%rcx)
|
|
|
|
movdqu %xmm7,0x70(%rcx)
|
|
|
|
movdqu %xmm8,0x80(%rcx)
|
|
|
|
movdqu %xmm9,0x90(%rcx)
|
|
|
|
movdqu %xmm10,0xa0(%rcx)
|
|
|
|
movdqu %xmm11,0xb0(%rcx)
|
|
|
|
movdqu %xmm12,0xc0(%rcx)
|
|
|
|
movdqu %xmm13,0xd0(%rcx)
|
|
|
|
movdqu %xmm14,0xe0(%rcx)
|
|
|
|
movdqu %xmm15,0xf0(%rcx)
|
|
|
|
movl \$0,%eax
|
|
|
|
ret
|
|
|
|
.seh_endproc
|
|
|
|
|
|
|
|
.globl __ljfault
|
|
|
|
.seh_proc __ljfault
|
|
|
|
__ljfault:
|
|
|
|
movq (%rcx),%r10
|
|
|
|
movq %r10,%gs:0
|
|
|
|
movq 0x8(%rcx),%rbx
|
|
|
|
movq 0x10(%rcx),%rsp
|
|
|
|
movq 0x18(%rcx),%rbp
|
|
|
|
movq 0x20(%rcx),%rsi
|
|
|
|
movq 0x28(%rcx),%rdi
|
|
|
|
movq 0x30(%rcx),%r12
|
|
|
|
movq 0x38(%rcx),%r13
|
|
|
|
movq 0x40(%rcx),%r14
|
|
|
|
movq 0x48(%rcx),%r15
|
|
|
|
movq 0x50(%rcx),%r10
|
|
|
|
movq %r10,(%rsp)
|
|
|
|
# jmp_buf is potentially unaligned!
|
|
|
|
movdqu 0x60(%rcx),%xmm6
|
|
|
|
movdqu 0x70(%rcx),%xmm7
|
|
|
|
movdqu 0x80(%rcx),%xmm8
|
|
|
|
movdqu 0x90(%rcx),%xmm9
|
|
|
|
movdqu 0xa0(%rcx),%xmm10
|
|
|
|
movdqu 0xb0(%rcx),%xmm11
|
|
|
|
movdqu 0xc0(%rcx),%xmm12
|
|
|
|
movdqu 0xd0(%rcx),%xmm13
|
|
|
|
movdqu 0xe0(%rcx),%xmm14
|
|
|
|
movdqu 0xf0(%rcx),%xmm15
|
|
|
|
movl %edx,%eax
|
|
|
|
testl %eax,%eax
|
|
|
|
jne 0f
|
|
|
|
incl %eax
|
|
|
|
0: ret
|
|
|
|
.seh_endproc
|
|
|
|
|
|
|
|
.globl longjmp
|
|
|
|
.seh_proc longjmp
|
|
|
|
longjmp:
|
|
|
|
pushq %rcx
|
|
|
|
.seh_pushreg %rcx
|
|
|
|
.seh_endprologue
|
|
|
|
movl %edx,%r12d # save return value (r12 is overwritten anyway)
|
|
|
|
call stabilize_sig_stack # returns tls in r11
|
|
|
|
popq %rcx
|
|
|
|
movl %r12d,%eax # restore return value
|
|
|
|
movq 0x58(%rcx),%r10 # get old signal stack
|
|
|
|
movq %r10,$tls::stackptr(%r11) # restore
|
|
|
|
decl $tls::stacklock(%r11) # relinquish lock
|
|
|
|
xorl %r10d,%r10d
|
|
|
|
movl %r10d,$tls::incyg(%r11) # we're definitely not in cygwin anymore
|
|
|
|
movq (%rcx),%r10
|
|
|
|
movq %r10,%gs:0
|
|
|
|
movq 0x8(%rcx),%rbx
|
|
|
|
movq 0x10(%rcx),%rsp
|
|
|
|
movq 0x18(%rcx),%rbp
|
|
|
|
movq 0x20(%rcx),%rsi
|
|
|
|
movq 0x28(%rcx),%rdi
|
|
|
|
movq 0x30(%rcx),%r12
|
|
|
|
movq 0x38(%rcx),%r13
|
|
|
|
movq 0x40(%rcx),%r14
|
|
|
|
movq 0x48(%rcx),%r15
|
|
|
|
movq 0x50(%rcx),%r10
|
|
|
|
movq %r10,(%rsp)
|
|
|
|
# jmp_buf is potentially unaligned!
|
|
|
|
movdqu 0x60(%rcx),%xmm6
|
|
|
|
movdqu 0x70(%rcx),%xmm7
|
|
|
|
movdqu 0x80(%rcx),%xmm8
|
|
|
|
movdqu 0x90(%rcx),%xmm9
|
|
|
|
movdqu 0xa0(%rcx),%xmm10
|
|
|
|
movdqu 0xb0(%rcx),%xmm11
|
|
|
|
movdqu 0xc0(%rcx),%xmm12
|
|
|
|
movdqu 0xd0(%rcx),%xmm13
|
|
|
|
movdqu 0xe0(%rcx),%xmm14
|
|
|
|
movdqu 0xf0(%rcx),%xmm15
|
|
|
|
testl %eax,%eax
|
|
|
|
jne 0f
|
|
|
|
incl %eax
|
|
|
|
0: ret
|
|
|
|
.seh_endproc
|
|
|
|
EOF
|
|
|
|
} else {
|
|
|
|
return <<EOF;
|
2003-11-28 21:55:59 +01:00
|
|
|
|
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)
|
2014-01-27 21:53:02 +01:00
|
|
|
fnstcw 48(%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
|
2014-01-27 21:53:02 +01:00
|
|
|
movl %eax,52(%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
|
2014-01-27 21:53:02 +01:00
|
|
|
movl 52(%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
|
2014-01-27 21:08:36 +01:00
|
|
|
fninit
|
2014-01-27 21:53:02 +01:00
|
|
|
fldcw 48(%edi)
|
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
|
2013-04-23 11:44:36 +02:00
|
|
|
}
|
2003-11-28 21:55:59 +01:00
|
|
|
}
|
2005-07-27 18:16:51 +02:00
|
|
|
|
2009-06-28 20:23:35 +02:00
|
|
|
sub cleanup(@) {
|
2013-05-01 01:43:08 +02:00
|
|
|
grep {s/\r//og; s/#.*//og; s/\s+\n//sog; !/^$/o && $_} @_;
|
2005-07-27 18:16:51 +02:00
|
|
|
}
|