mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 19:00:07 +00:00
* sysdeps/i386/fpu/s_frexp.S: Check bounds.
Wrap extern symbols in BP_SYM (). * sysdeps/i386/fpu/s_frexpf.S: Likewise. * sysdeps/i386/fpu/s_frexpl.S: Likewise. * sysdeps/i386/fpu/s_remquo.S: Likewise. * sysdeps/i386/fpu/s_remquof.S: Likewise. * sysdeps/i386/fpu/s_remquol.S: Likewise. * sysdeps/i386/fpu/s_sincos.S: Likewise. * sysdeps/i386/fpu/s_sincosf.S: Likewise. * sysdeps/i386/fpu/s_sincosl.S: Likewise. * sysdeps/unix/sysv/linux/i386/clone.S: Likewise. * sysdeps/unix/sysv/linux/i386/mmap64.S: Likewise.
This commit is contained in:
parent
9a81430bf9
commit
9e25f6e29b
@ -1,5 +1,5 @@
|
||||
/* ix87 specific frexp implementation for double.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
|
||||
#ifdef __ELF__
|
||||
.section .rodata
|
||||
@ -37,10 +39,17 @@ two54: .byte 0, 0, 0, 0, 0, 0, 0x50, 0x43
|
||||
#define MO(op) op
|
||||
#endif
|
||||
|
||||
#define PARMS LINKAGE /* no space for saved regs */
|
||||
#define VAL0 PARMS
|
||||
#define VAL1 VAL0+4
|
||||
#define EXPP VAL1+4
|
||||
|
||||
.text
|
||||
ENTRY(__frexp)
|
||||
movl 4(%esp), %ecx
|
||||
movl 8(%esp), %eax
|
||||
ENTRY (BP_SYM (__frexp))
|
||||
ENTER
|
||||
|
||||
movl VAL0(%esp), %ecx
|
||||
movl VAL1(%esp), %eax
|
||||
movl %eax, %edx
|
||||
andl $0x7fffffff, %eax
|
||||
orl %eax, %ecx
|
||||
@ -52,7 +61,7 @@ ENTRY(__frexp)
|
||||
cmpl $0x00100000, %eax
|
||||
jae 2f
|
||||
|
||||
fldl 4(%esp)
|
||||
fldl VAL0(%esp)
|
||||
#ifdef PIC
|
||||
call 3f
|
||||
3: popl %edx
|
||||
@ -60,8 +69,8 @@ ENTRY(__frexp)
|
||||
#endif
|
||||
fmull MO(two54)
|
||||
movl $-54, %ecx
|
||||
fstpl 4(%esp)
|
||||
movl 8(%esp), %eax
|
||||
fstpl VAL0(%esp)
|
||||
movl VAL1(%esp), %eax
|
||||
movl %eax, %edx
|
||||
andl $0x7fffffff, %eax
|
||||
|
||||
@ -70,13 +79,16 @@ ENTRY(__frexp)
|
||||
subl $1022, %eax
|
||||
orl $0x3fe00000, %edx
|
||||
addl %eax, %ecx
|
||||
movl %edx, 8(%esp)
|
||||
movl %edx, VAL1(%esp)
|
||||
|
||||
/* Store %ecx in the variable pointed to by the second argument,
|
||||
get the factor from the stack and return. */
|
||||
1: movl 12(%esp), %eax
|
||||
fldl 4(%esp)
|
||||
1: movl EXPP(%esp), %eax
|
||||
CHECK_BOUNDS_BOTH_WIDE (%eax, EXPP(%esp), $4)
|
||||
fldl VAL0(%esp)
|
||||
movl %ecx, (%eax)
|
||||
|
||||
LEAVE
|
||||
ret
|
||||
END(__frexp)
|
||||
weak_alias (__frexp, frexp)
|
||||
END (BP_SYM (__frexp))
|
||||
weak_alias (BP_SYM (__frexp), BP_SYM (frexp))
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ix87 specific frexp implementation for float.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
|
||||
#ifdef __ELF__
|
||||
.section .rodata
|
||||
@ -37,9 +39,15 @@ two25: .byte 0, 0, 0, 0x4c
|
||||
#define MO(op) op
|
||||
#endif
|
||||
|
||||
#define PARMS LINKAGE /* no space for saved regs */
|
||||
#define VAL PARMS
|
||||
#define EXPP VAL+4
|
||||
|
||||
.text
|
||||
ENTRY(__frexpf)
|
||||
movl 4(%esp), %eax
|
||||
ENTRY (BP_SYM (__frexpf))
|
||||
ENTER
|
||||
|
||||
movl VAL(%esp), %eax
|
||||
xorl %ecx, %ecx
|
||||
movl %eax, %edx
|
||||
andl $0x7fffffff, %eax
|
||||
@ -50,7 +58,7 @@ ENTRY(__frexpf)
|
||||
cmpl $0x00800000, %eax
|
||||
jae 2f
|
||||
|
||||
flds 4(%esp)
|
||||
flds VAL(%esp)
|
||||
#ifdef PIC
|
||||
call 3f
|
||||
3: popl %edx
|
||||
@ -58,8 +66,8 @@ ENTRY(__frexpf)
|
||||
#endif
|
||||
fmuls MO(two25)
|
||||
movl $-25, %ecx
|
||||
fstps 4(%esp)
|
||||
movl 4(%esp), %eax
|
||||
fstps VAL(%esp)
|
||||
movl VAL(%esp), %eax
|
||||
movl %eax, %edx
|
||||
andl $0x7fffffff, %eax
|
||||
|
||||
@ -68,13 +76,16 @@ ENTRY(__frexpf)
|
||||
subl $126, %eax
|
||||
orl $0x3f000000, %edx
|
||||
addl %eax, %ecx
|
||||
movl %edx, 4(%esp)
|
||||
movl %edx, VAL(%esp)
|
||||
|
||||
/* Store %ecx in the variable pointed to by the second argument,
|
||||
get the factor from the stack and return. */
|
||||
1: movl 8(%esp), %eax
|
||||
flds 4(%esp)
|
||||
1: movl EXPP(%esp), %eax
|
||||
CHECK_BOUNDS_BOTH_WIDE (%eax, EXPP(%esp), $4)
|
||||
flds VAL(%esp)
|
||||
movl %ecx, (%eax)
|
||||
|
||||
LEAVE
|
||||
ret
|
||||
END(__frexpf)
|
||||
weak_alias (__frexpf, frexpf)
|
||||
END (BP_SYM (__frexpf))
|
||||
weak_alias (BP_SYM (__frexpf), BP_SYM (frexpf))
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ix87 specific frexp implementation for long double.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
|
||||
#ifdef __ELF__
|
||||
.section .rodata
|
||||
@ -37,11 +39,19 @@ two64: .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x43
|
||||
#define MO(op) op
|
||||
#endif
|
||||
|
||||
#define PARMS LINKAGE /* no space for saved regs */
|
||||
#define VAL0 PARMS
|
||||
#define VAL1 VAL0+4
|
||||
#define VAL2 VAL1+4
|
||||
#define EXPP VAL2+4
|
||||
|
||||
.text
|
||||
ENTRY(__frexpl)
|
||||
movl 4(%esp), %ecx
|
||||
movl 12(%esp), %eax
|
||||
orl 8(%esp), %ecx
|
||||
ENTRY (BP_SYM (__frexpl))
|
||||
ENTER
|
||||
|
||||
movl VAL0(%esp), %ecx
|
||||
movl VAL2(%esp), %eax
|
||||
orl VAL1(%esp), %ecx
|
||||
movl %eax, %edx
|
||||
andl $0x7fff, %eax
|
||||
orl %eax, %ecx
|
||||
@ -53,7 +63,7 @@ ENTRY(__frexpl)
|
||||
cmpl $0, %eax
|
||||
je 2f
|
||||
|
||||
fldt 4(%esp)
|
||||
fldt VAL0(%esp)
|
||||
#ifdef PIC
|
||||
call 3f
|
||||
3: popl %edx
|
||||
@ -61,8 +71,8 @@ ENTRY(__frexpl)
|
||||
#endif
|
||||
fmull MO(two64) /* It's not necessary to use a 80bit factor */
|
||||
movl $-64, %ecx
|
||||
fstpt 4(%esp)
|
||||
movl 12(%esp), %eax
|
||||
fstpt VAL0(%esp)
|
||||
movl VAL2(%esp), %eax
|
||||
movl %eax, %edx
|
||||
andl $0x7fff, %eax
|
||||
|
||||
@ -70,13 +80,16 @@ ENTRY(__frexpl)
|
||||
subl $16382, %eax
|
||||
orl $0x3ffe, %edx
|
||||
addl %eax, %ecx
|
||||
movl %edx, 12(%esp)
|
||||
movl %edx, VAL2(%esp)
|
||||
|
||||
/* Store %ecx in the variable pointed to by the second argument,
|
||||
get the factor from the stack and return. */
|
||||
1: movl 16(%esp), %eax
|
||||
fldt 4(%esp)
|
||||
1: movl EXPP(%esp), %eax
|
||||
CHECK_BOUNDS_BOTH_WIDE (%eax, EXPP(%esp), $4)
|
||||
fldt VAL0(%esp)
|
||||
movl %ecx, (%eax)
|
||||
|
||||
LEAVE
|
||||
ret
|
||||
END(__frexpl)
|
||||
weak_alias (__frexpl, frexpl)
|
||||
END (BP_SYM (__frexpl))
|
||||
weak_alias (BP_SYM (__frexpl), BP_SYM (frexpl))
|
||||
|
@ -5,10 +5,20 @@
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
|
||||
ENTRY(__remquo)
|
||||
fldl 12(%esp)
|
||||
fldl 4(%esp)
|
||||
#define PARMS LINKAGE /* no space for saved regs */
|
||||
#define DVDND PARMS
|
||||
#define DVSOR DVDND+8
|
||||
#define QUOP DVSOR+8
|
||||
|
||||
.text
|
||||
ENTRY (BP_SYM (__remquo))
|
||||
ENTER
|
||||
|
||||
fldl DVSOR(%esp)
|
||||
fldl DVDND(%esp)
|
||||
1: fprem1
|
||||
fstsw %ax
|
||||
sahf
|
||||
@ -24,13 +34,16 @@ ENTRY(__remquo)
|
||||
movl $0xef2960, %eax
|
||||
shrl %cl, %eax
|
||||
andl $3, %eax
|
||||
movl 20(%esp), %ecx
|
||||
movl 8(%esp), %edx
|
||||
xorl 16(%esp), %edx
|
||||
movl QUOP(%esp), %ecx
|
||||
CHECK_BOUNDS_BOTH_WIDE (%ecx, QUOP(%esp), $4)
|
||||
movl DVDND+4(%esp), %edx
|
||||
xorl DVSOR+4(%esp), %edx
|
||||
testl $0x80000000, %edx
|
||||
jz 1f
|
||||
negl %eax
|
||||
1: movl %eax, (%ecx)
|
||||
|
||||
LEAVE
|
||||
ret
|
||||
END (__remquo)
|
||||
weak_alias (__remquo, remquo)
|
||||
END (BP_SYM (__remquo))
|
||||
weak_alias (BP_SYM (__remquo), BP_SYM (remquo))
|
||||
|
@ -5,10 +5,20 @@
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
|
||||
ENTRY(__remquof)
|
||||
flds 8(%esp)
|
||||
flds 4(%esp)
|
||||
#define PARMS LINKAGE /* no space for saved regs */
|
||||
#define DVDND PARMS
|
||||
#define DVSOR DVDND+4
|
||||
#define QUOP DVSOR+4
|
||||
|
||||
.text
|
||||
ENTRY (BP_SYM (__remquof))
|
||||
ENTER
|
||||
|
||||
flds DVSOR(%esp)
|
||||
flds DVDND(%esp)
|
||||
1: fprem1
|
||||
fstsw %ax
|
||||
sahf
|
||||
@ -24,13 +34,16 @@ ENTRY(__remquof)
|
||||
movl $0xef2960, %eax
|
||||
shrl %cl, %eax
|
||||
andl $3, %eax
|
||||
movl 12(%esp), %ecx
|
||||
movl 4(%esp), %edx
|
||||
xorl 8(%esp), %edx
|
||||
movl QUOP(%esp), %ecx
|
||||
CHECK_BOUNDS_BOTH_WIDE (%ecx, QUOP(%esp), $4)
|
||||
movl DVDND(%esp), %edx
|
||||
xorl DVSOR(%esp), %edx
|
||||
testl $0x80000000, %edx
|
||||
jz 1f
|
||||
negl %eax
|
||||
1: movl %eax, (%ecx)
|
||||
|
||||
LEAVE
|
||||
ret
|
||||
END (__remquof)
|
||||
weak_alias (__remquof, remquof)
|
||||
END (BP_SYM (__remquof))
|
||||
weak_alias (BP_SYM (__remquof), BP_SYM (remquof))
|
||||
|
@ -5,10 +5,20 @@
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
|
||||
ENTRY(__remquol)
|
||||
fldt 16(%esp)
|
||||
fldt 4(%esp)
|
||||
#define PARMS LINKAGE /* no space for saved regs */
|
||||
#define DVDND PARMS
|
||||
#define DVSOR DVDND+12
|
||||
#define QUOP DVSOR+12
|
||||
|
||||
.text
|
||||
ENTRY (BP_SYM (__remquol))
|
||||
ENTER
|
||||
|
||||
fldt DVSOR(%esp)
|
||||
fldt DVDND(%esp)
|
||||
1: fprem1
|
||||
fstsw %ax
|
||||
sahf
|
||||
@ -24,13 +34,16 @@ ENTRY(__remquol)
|
||||
movl $0xef2960, %eax
|
||||
shrl %cl, %eax
|
||||
andl $3, %eax
|
||||
movl 28(%esp), %ecx
|
||||
movl 12(%esp), %edx
|
||||
xorl 24(%esp), %edx
|
||||
movl QUOP(%esp), %ecx
|
||||
CHECK_BOUNDS_BOTH_WIDE (%ecx, QUOP(%esp), $4)
|
||||
movl DVDND+8(%esp), %edx
|
||||
xorl DVSOR+8(%esp), %edx
|
||||
testl $0x8000, %edx
|
||||
jz 1f
|
||||
negl %eax
|
||||
1: movl %eax, (%ecx)
|
||||
|
||||
LEAVE
|
||||
ret
|
||||
END (__remquol)
|
||||
weak_alias (__remquol, remquol)
|
||||
END (BP_SYM (__remquol))
|
||||
weak_alias (BP_SYM (__remquol), BP_SYM (remquol))
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Compute sine and cosine of argument.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -19,18 +19,33 @@
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
|
||||
ENTRY(__sincos)
|
||||
fldl 4(%esp)
|
||||
#define PARMS LINKAGE /* no space for saved regs */
|
||||
#define ANGLE PARMS
|
||||
#define SINP ANGLE+8
|
||||
#define COSP SINP+PTR_SIZE
|
||||
|
||||
.text
|
||||
ENTRY (BP_SYM (__sincos))
|
||||
ENTER
|
||||
|
||||
fldl ANGLE(%esp)
|
||||
fsincos
|
||||
movl 12(%esp), %ecx
|
||||
movl 16(%esp), %edx
|
||||
movl SINP(%esp), %ecx
|
||||
CHECK_BOUNDS_BOTH_WIDE (%ecx, SINP(%esp), $8)
|
||||
movl COSP(%esp), %edx
|
||||
CHECK_BOUNDS_BOTH_WIDE (%edx, COSP(%esp), $8)
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 1f
|
||||
fstpl (%edx)
|
||||
fstpl (%ecx)
|
||||
|
||||
LEAVE
|
||||
ret
|
||||
|
||||
.align ALIGNARG(4)
|
||||
1: fldpi
|
||||
fadd %st(0)
|
||||
@ -43,6 +58,8 @@ ENTRY(__sincos)
|
||||
fsincos
|
||||
fstpl (%edx)
|
||||
fstpl (%ecx)
|
||||
|
||||
LEAVE
|
||||
ret
|
||||
END(__sincos)
|
||||
weak_alias(__sincos, sincos)
|
||||
END (BP_SYM (__sincos))
|
||||
weak_alias (BP_SYM (__sincos), BP_SYM (sincos))
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Compute sine and cosine of argument.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -19,18 +19,33 @@
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
|
||||
ENTRY(__sincosf)
|
||||
flds 4(%esp)
|
||||
#define PARMS LINKAGE /* no space for saved regs */
|
||||
#define ANGLE PARMS
|
||||
#define SINP ANGLE+4
|
||||
#define COSP SINP+PTR_SIZE
|
||||
|
||||
.text
|
||||
ENTRY (BP_SYM (__sincosf))
|
||||
ENTER
|
||||
|
||||
flds ANGLE(%esp)
|
||||
fsincos
|
||||
movl 8(%esp), %ecx
|
||||
movl 12(%esp), %edx
|
||||
movl SINP(%esp), %ecx
|
||||
CHECK_BOUNDS_BOTH_WIDE (%ecx, SINP(%esp), $4)
|
||||
movl COSP(%esp), %edx
|
||||
CHECK_BOUNDS_BOTH_WIDE (%edx, COSP(%esp), $4)
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 1f
|
||||
fstps (%edx)
|
||||
fstps (%ecx)
|
||||
|
||||
LEAVE
|
||||
ret
|
||||
|
||||
.align ALIGNARG(4)
|
||||
1: fldpi
|
||||
fadd %st(0)
|
||||
@ -43,6 +58,8 @@ ENTRY(__sincosf)
|
||||
fsincos
|
||||
fstps (%edx)
|
||||
fstps (%ecx)
|
||||
|
||||
LEAVE
|
||||
ret
|
||||
END(__sincosf)
|
||||
weak_alias(__sincosf, sincosf)
|
||||
END (BP_SYM (__sincosf))
|
||||
weak_alias (BP_SYM (__sincosf), BP_SYM (sincosf))
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Compute sine and cosine of argument.
|
||||
Copyright (C) 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1997, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
@ -19,18 +19,33 @@
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
|
||||
ENTRY(__sincosl)
|
||||
fldt 4(%esp)
|
||||
#define PARMS LINKAGE /* no space for saved regs */
|
||||
#define ANGLE PARMS
|
||||
#define SINP ANGLE+12
|
||||
#define COSP SINP+PTR_SIZE
|
||||
|
||||
.text
|
||||
ENTRY (BP_SYM (__sincosl))
|
||||
ENTER
|
||||
|
||||
fldt ANGLE(%esp)
|
||||
fsincos
|
||||
movl 16(%esp), %ecx
|
||||
movl 20(%esp), %edx
|
||||
movl SINP(%esp), %ecx
|
||||
CHECK_BOUNDS_BOTH_WIDE (%ecx, SINP(%esp), $12)
|
||||
movl COSP(%esp), %edx
|
||||
CHECK_BOUNDS_BOTH_WIDE (%edx, COSP(%esp), $12)
|
||||
fnstsw %ax
|
||||
testl $0x400,%eax
|
||||
jnz 1f
|
||||
fstpt (%edx)
|
||||
fstpt (%ecx)
|
||||
|
||||
LEAVE
|
||||
ret
|
||||
|
||||
.align ALIGNARG(4)
|
||||
1: fldpi
|
||||
fadd %st(0)
|
||||
@ -43,6 +58,8 @@ ENTRY(__sincosl)
|
||||
fsincos
|
||||
fstpt (%edx)
|
||||
fstpt (%ecx)
|
||||
|
||||
LEAVE
|
||||
ret
|
||||
END(__sincosl)
|
||||
weak_alias(__sincosl, sincosl)
|
||||
END (BP_SYM (__sincosl))
|
||||
weak_alias (BP_SYM (__sincosl), BP_SYM (sincosl))
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Richard Henderson (rth@tamu.edu)
|
||||
|
||||
@ -24,21 +24,29 @@
|
||||
#define _ERRNO_H 1
|
||||
#include <bits/errno.h>
|
||||
#include <asm-syntax.h>
|
||||
#include <bp-sym.h>
|
||||
#include <bp-asm.h>
|
||||
|
||||
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
|
||||
|
||||
#define PARMS LINKAGE /* no space for saved regs */
|
||||
#define FUNC PARMS
|
||||
#define STACK FUNC+4
|
||||
#define FLAGS STACK+PTR_SIZE
|
||||
#define ARG FLAGS+4
|
||||
|
||||
.text
|
||||
ENTRY(__clone)
|
||||
ENTRY (BP_SYM (__clone))
|
||||
/* Sanity check arguments. */
|
||||
movl $-EINVAL,%eax
|
||||
movl 4(%esp),%ecx /* no NULL function pointers */
|
||||
movl FUNC(%esp),%ecx /* no NULL function pointers */
|
||||
#ifdef PIC
|
||||
jecxz SYSCALL_ERROR_LABEL
|
||||
#else
|
||||
testl %ecx,%ecx
|
||||
jz SYSCALL_ERROR_LABEL
|
||||
#endif
|
||||
movl 8(%esp),%ecx /* no NULL stack pointers */
|
||||
movl STACK(%esp),%ecx /* no NULL stack pointers */
|
||||
#ifdef PIC
|
||||
jecxz SYSCALL_ERROR_LABEL
|
||||
#else
|
||||
@ -48,17 +56,17 @@ ENTRY(__clone)
|
||||
|
||||
/* Insert the argument onto the new stack. */
|
||||
subl $8,%ecx
|
||||
movl 16(%esp),%eax /* no negative argument counts */
|
||||
movl ARG(%esp),%eax /* no negative argument counts */
|
||||
movl %eax,4(%ecx)
|
||||
|
||||
/* Save the function pointer as the zeroth argument.
|
||||
It will be popped off in the child in the ebx frobbing below. */
|
||||
movl 4(%esp),%eax
|
||||
movl FUNC(%esp),%eax
|
||||
movl %eax,0(%ecx)
|
||||
|
||||
/* Do the system call */
|
||||
pushl %ebx
|
||||
movl 16(%esp),%ebx
|
||||
movl FLAGS+4(%esp),%ebx
|
||||
movl $SYS_ify(clone),%eax
|
||||
int $0x80
|
||||
popl %ebx
|
||||
@ -82,6 +90,6 @@ L(here):
|
||||
pushl %eax
|
||||
call JUMPTARGET (_exit)
|
||||
|
||||
PSEUDO_END (__clone)
|
||||
PSEUDO_END (BP_SYM (__clone))
|
||||
|
||||
weak_alias (__clone, clone)
|
||||
weak_alias (BP_SYM (__clone), BP_SYM (clone))
|
||||
|
@ -17,15 +17,26 @@
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <sysdep.h>
|
||||
#include <bp-sym.h>
|
||||
#include <bp-asm.h>
|
||||
|
||||
#include "kernel-features.h"
|
||||
|
||||
#define EINVAL 22
|
||||
#define ENOSYS 38
|
||||
|
||||
.text
|
||||
#define SVRSP 16 /* saved register space */
|
||||
#define PARMS LINKAGE+SVRSP /* space for 4 saved regs */
|
||||
#define ADDR PARMS
|
||||
#define LEN ADDR+PTR_SIZE
|
||||
#define PROT LEN+4
|
||||
#define FLAGS PROT+4
|
||||
#define FD FLAGS+4
|
||||
#define OFFLO FD+4
|
||||
#define OFFHI OFFLO+4
|
||||
|
||||
ENTRY (__mmap64)
|
||||
.text
|
||||
ENTRY (BP_SYM (__mmap64))
|
||||
|
||||
#ifdef __NR_mmap2
|
||||
|
||||
@ -35,8 +46,8 @@ ENTRY (__mmap64)
|
||||
pushl %esi
|
||||
pushl %edi
|
||||
|
||||
movl 40(%esp), %edx
|
||||
movl 44(%esp), %ecx
|
||||
movl OFFLO(%esp), %edx
|
||||
movl OFFHI(%esp), %ecx
|
||||
testl $0x3ff, %edx
|
||||
jne L(einval)
|
||||
shrdl $12, %ecx, %edx /* mmap2 takes the offset in pages. */
|
||||
@ -44,11 +55,11 @@ ENTRY (__mmap64)
|
||||
jne L(einval)
|
||||
movl %edx, %ebp
|
||||
|
||||
movl 20(%esp), %ebx
|
||||
movl 24(%esp), %ecx
|
||||
movl 28(%esp), %edx
|
||||
movl 32(%esp), %esi
|
||||
movl 36(%esp), %edi
|
||||
movl ADDR(%esp), %ebx
|
||||
movl LEN(%esp), %ecx
|
||||
movl PROT(%esp), %edx
|
||||
movl FLAGS(%esp), %esi
|
||||
movl FD(%esp), %edi
|
||||
|
||||
movl $SYS_ify(mmap2), %eax /* System call number in %eax. */
|
||||
|
||||
@ -91,12 +102,12 @@ L(einval):
|
||||
/* Save registers. */
|
||||
movl %ebx, %edx
|
||||
|
||||
cmpl $0, 28(%esp)
|
||||
cmpl $0, OFFHI-SVRSP(%esp)
|
||||
jne L(einval2)
|
||||
|
||||
movl $SYS_ify(mmap), %eax /* System call number in %eax. */
|
||||
|
||||
lea 4(%esp), %ebx /* Address of args is 1st arg. */
|
||||
lea ADDR-SVRSP(%esp), %ebx /* Address of args is 1st arg. */
|
||||
|
||||
/* Do the system call trap. */
|
||||
int $0x80
|
||||
@ -120,6 +131,6 @@ L(einval2):
|
||||
jmp SYSCALL_ERROR_LABEL
|
||||
#endif
|
||||
|
||||
PSEUDO_END (__mmap64)
|
||||
PSEUDO_END (BP_SYM (__mmap64))
|
||||
|
||||
weak_alias (__mmap64, mmap64)
|
||||
weak_alias (BP_SYM (__mmap64), BP_SYM (mmap64))
|
||||
|
Loading…
Reference in New Issue
Block a user