diff options
author | Ulrich Drepper <drepper@redhat.com> | 1998-06-09 18:24:13 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1998-06-09 18:24:13 +0000 |
commit | 4bbac92a0a58c00a8c8c99241cde3d4a3ddb3f5c (patch) | |
tree | 4557a7d8b1e9402e5ad426280f3bcdd33a68b742 /sysdeps | |
parent | 69f234e8ff029cdd0ee7f91df7bcd006bbcab42f (diff) | |
download | glibc-4bbac92a0a58c00a8c8c99241cde3d4a3ddb3f5c.tar.gz glibc-4bbac92a0a58c00a8c8c99241cde3d4a3ddb3f5c.tar.xz glibc-4bbac92a0a58c00a8c8c99241cde3d4a3ddb3f5c.zip |
Update.
1998-06-09 18:16 Ulrich Drepper <drepper@cygnus.com> * math/Makefile (libm-calls): Add w_exp10 and e_exp10. * math/libm.map: Add exp10{,f,l} and pow10{,f,l}. * math/math_private.h: Add prototypes for __ieee754_exp10{,f,l}. * math/bits/mathcalls.h: Add definitions for exp10 and pow10 prototypes. * sysdeps/libm-i387/e_exp10.S: New file. * sysdeps/libm-i387/e_exp10f.S: New file. * sysdeps/libm-i387/e_exp10l.S: New file. * sysdeps/libm-ieee754/e_exp10.c: New file. * sysdeps/libm-ieee754/e_exp10f.c: New file. * sysdeps/libm-ieee754/e_exp10l.c: New file. * sysdeps/libm-ieee754/w_exp10.c: New file. * sysdeps/libm-ieee754/w_exp10f.c: New file. * sysdeps/libm-ieee754/w_exp10l.c: New file. * sysdeps/libm-ieee754/k_standard.c: Add exception code for exp10. 1998-05-25 22:18 H.J. Lu <hjl@gnu.org> * sysdeps/unix/sysv/linux/i386/Makefile (sysdep_headers): Add sys/elf.h and sys/reg.h. * sysdeps/unix/sysv/linux/i386/sys/elf.h: New file. * sysdeps/unix/sysv/linux/i386/sys/reg.h: New file. * sysdeps/unix/sysv/linux/i386/sys/procfs.h: New file. * sysdeps/unix/sysv/linux/i386/sys/user.h: New file. * sysdeps/unix/sysv/linux/sys/ptrace.h (PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS, PTRACE_SETFPREGS): Added.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/libm-i387/e_exp10.S | 38 | ||||
-rw-r--r-- | sysdeps/libm-i387/e_exp10f.S | 38 | ||||
-rw-r--r-- | sysdeps/libm-i387/e_exp10l.S | 38 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/e_exp10.c | 29 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/e_exp10f.c | 29 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/e_exp10l.c | 29 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/k_standard.c | 40 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/w_exp10.c | 59 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/w_exp10f.c | 57 | ||||
-rw-r--r-- | sysdeps/libm-ieee754/w_exp10l.c | 56 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/Makefile | 2 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/sys/elf.h | 60 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/sys/procfs.h | 109 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/sys/reg.h | 43 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/i386/sys/user.h | 86 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/sys/ptrace.h | 46 |
16 files changed, 741 insertions, 18 deletions
diff --git a/sysdeps/libm-i387/e_exp10.S b/sysdeps/libm-i387/e_exp10.S new file mode 100644 index 0000000000..6bfcdbb723 --- /dev/null +++ b/sysdeps/libm-i387/e_exp10.S @@ -0,0 +1,38 @@ +/* + * Written by Ulrich Drepper <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +/* 10^x = 2^(x * log2(10)) */ +ENTRY(__ieee754_exp10) + fldl 4(%esp) +/* I added the following ugly construct because exp(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + For the i686 the code can be written better. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ + fstsw %ax + movb $0x45, %dh + andb %ah, %dh + cmpb $0x05, %dh + je 1f /* Is +-Inf, jump. */ + fldl2t + fmulp /* x * log2(10) */ + fld %st + frndint /* int(x * log2(10)) */ + fsubr %st,%st(1) /* fract(x * log2(10)) */ + fxch + f2xm1 /* 2^(fract(x * log2(10))) - 1 */ + fld1 + faddp /* 2^(fract(x * log2(10))) */ + fscale /* e^x */ + fstp %st(1) + ret + +1: testl $0x200, %eax /* Test sign. */ + jz 2f /* If positive, jump. */ + fstp %st + fldz /* Set result to 0. */ +2: ret +END (__ieee754_exp10) diff --git a/sysdeps/libm-i387/e_exp10f.S b/sysdeps/libm-i387/e_exp10f.S new file mode 100644 index 0000000000..4791b99afa --- /dev/null +++ b/sysdeps/libm-i387/e_exp10f.S @@ -0,0 +1,38 @@ +/* + * Written by Ulrich Drepper. + */ + +#include <machine/asm.h> + +/* e^x = 2^(x * log2(10)) */ +ENTRY(__ieee754_exp10f) + flds 4(%esp) +/* I added the following ugly construct because exp(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + For the i686 the code can be written better. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ + fstsw %ax + movb $0x45, %dh + andb %ah, %dh + cmpb $0x05, %dh + je 1f /* Is +-Inf, jump. */ + fldl2t + fmulp /* x * log2(10) */ + fld %st + frndint /* int(x * log2(10)) */ + fsubr %st,%st(1) /* fract(x * log2(10)) */ + fxch + f2xm1 /* 2^(fract(x * log2(10))) - 1 */ + fld1 + faddp /* 2^(fract(x * log2(10))) */ + fscale /* e^x */ + fstp %st(1) + ret + +1: testl $0x200, %eax /* Test sign. */ + jz 2f /* If positive, jump. */ + fstp %st + fldz /* Set result to 0. */ +2: ret +END (__ieee754_exp10f) diff --git a/sysdeps/libm-i387/e_exp10l.S b/sysdeps/libm-i387/e_exp10l.S new file mode 100644 index 0000000000..71f0da792d --- /dev/null +++ b/sysdeps/libm-i387/e_exp10l.S @@ -0,0 +1,38 @@ +/* + * Written by Ulrich Drepper <drepper@cygnus.com>. + */ + +#include <machine/asm.h> + +/* e^x = 2^(x * log2l(10)) */ +ENTRY(__ieee754_exp10l) + fldt 4(%esp) +/* I added the following ugly construct because expl(+-Inf) resulted + in NaN. The ugliness results from the bright minds at Intel. + For the i686 the code can be written better. + -- drepper@cygnus.com. */ + fxam /* Is NaN or +-Inf? */ + fstsw %ax + movb $0x45, %dh + andb %ah, %dh + cmpb $0x05, %dh + je 1f /* Is +-Inf, jump. */ + fldl2t + fmulp /* x * log2(10) */ + fld %st + frndint /* int(x * log2(10)) */ + fsubr %st,%st(1) /* fract(x * log2(10)) */ + fxch + f2xm1 /* 2^(fract(x * log2(10))) - 1 */ + fld1 + faddp /* 2^(fract(x * log2(10))) */ + fscale /* e^x */ + fstp %st(1) + ret + +1: testl $0x200, %eax /* Test sign. */ + jz 2f /* If positive, jump. */ + fstp %st + fldz /* Set result to 0. */ +2: ret +END (__ieee754_exp10l) diff --git a/sysdeps/libm-ieee754/e_exp10.c b/sysdeps/libm-ieee754/e_exp10.c new file mode 100644 index 0000000000..3b367641cd --- /dev/null +++ b/sysdeps/libm-ieee754/e_exp10.c @@ -0,0 +1,29 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <math.h> + + +double +__ieee754_exp10 (double arg) +{ + /* This is a very stupid and inprecise implementation. It'll get + replaced sometime (soon?). */ + return __ieee754_exp (M_LN10 * arg); +} diff --git a/sysdeps/libm-ieee754/e_exp10f.c b/sysdeps/libm-ieee754/e_exp10f.c new file mode 100644 index 0000000000..200eecd833 --- /dev/null +++ b/sysdeps/libm-ieee754/e_exp10f.c @@ -0,0 +1,29 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <math.h> + + +float +__ieee754_exp10f (float arg) +{ + /* This is a very stupid and inprecise implementation. It'll get + replaced sometime (soon?). */ + return __ieee754_expf (M_LN10 * arg); +} diff --git a/sysdeps/libm-ieee754/e_exp10l.c b/sysdeps/libm-ieee754/e_exp10l.c new file mode 100644 index 0000000000..e2820d24f7 --- /dev/null +++ b/sysdeps/libm-ieee754/e_exp10l.c @@ -0,0 +1,29 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include <math.h> + + +long double +__ieee754_exp10l (long double arg) +{ + /* This is a very stupid and inprecise implementation. It'll get + replaced sometime (soon?). */ + return __ieee754_expl (M_LN10l * arg); +} diff --git a/sysdeps/libm-ieee754/k_standard.c b/sysdeps/libm-ieee754/k_standard.c index 6c410c4c1a..aeaa50f2ee 100644 --- a/sysdeps/libm-ieee754/k_standard.c +++ b/sysdeps/libm-ieee754/k_standard.c @@ -83,6 +83,8 @@ static double zero = 0.0; /* used as const */ * 43-- +0**neg * 44-- exp2 overflow * 45-- exp2 underflow + * 46-- exp10 overflow + * 47-- exp10 underflow */ @@ -874,7 +876,7 @@ static double zero = 0.0; /* used as const */ /* exp(finite) overflow */ exc.type = OVERFLOW; exc.name = type < 100 ? "exp2" : (type < 200 - ? "exp2f" : "exp2l"); + ? "exp2f" : "exp2l"); if (_LIB_VERSION == _SVID_) exc.retval = HUGE; else @@ -891,7 +893,7 @@ static double zero = 0.0; /* used as const */ /* exp(finite) underflow */ exc.type = UNDERFLOW; exc.name = type < 100 ? "exp2" : (type < 200 - ? "exp2f" : "exp2l"); + ? "exp2f" : "exp2l"); exc.retval = zero; if (_LIB_VERSION == _POSIX_) __set_errno (ERANGE); @@ -899,7 +901,39 @@ static double zero = 0.0; /* used as const */ __set_errno (ERANGE); } break; - /* #### Last used is 44/144/244 ### */ + + case 46: + case 146: + case 246: + /* exp(finite) overflow */ + exc.type = OVERFLOW; + exc.name = type < 100 ? "exp10" : (type < 200 + ? "exp10f" : "exp10l"); + if (_LIB_VERSION == _SVID_) + exc.retval = HUGE; + else + exc.retval = HUGE_VAL; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + __set_errno (ERANGE); + } + break; + case 47: + case 147: + case 247: + /* exp(finite) underflow */ + exc.type = UNDERFLOW; + exc.name = type < 100 ? "exp10" : (type < 200 + ? "exp10f" : "exp10l"); + exc.retval = zero; + if (_LIB_VERSION == _POSIX_) + __set_errno (ERANGE); + else if (!matherr(&exc)) { + __set_errno (ERANGE); + } + break; + /* #### Last used is 47/147/247 ### */ } return exc.retval; } diff --git a/sysdeps/libm-ieee754/w_exp10.c b/sysdeps/libm-ieee754/w_exp10.c new file mode 100644 index 0000000000..cb27159e4f --- /dev/null +++ b/sysdeps/libm-ieee754/w_exp10.c @@ -0,0 +1,59 @@ +/* @(#)w_exp10.c + * Conversion to exp10 by Ulrich Drepper <drepper@cygnus.com>. +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * wrapper exp10(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const double +#else +static double +#endif +o_threshold= 3.0825471555991674389672e+02, +u_threshold= -3.2360724533877978485251e+02; + +#ifdef __STDC__ + double __exp10(double x) /* wrapper exp10 */ +#else + double __exp10(x) /* wrapper exp10 */ + double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_exp10(x); +#else + double z; + z = __ieee754_exp10(x); + if(_LIB_VERSION == _IEEE_) return z; + if(__finite(x)) { + if(x>o_threshold) + return __kernel_standard(x,x,46); /* exp10 overflow */ + else if(x<u_threshold) + return __kernel_standard(x,x,47); /* exp10 underflow */ + } + return z; +#endif +} +weak_alias (__exp10, exp10) +strong_alias (__exp10, __pow10) +weak_alias (__pow10, pow10) +#ifdef NO_LONG_DOUBLE +strong_alias (__exp10, __exp10l) +weak_alias (__exp10, exp10l) +strong_alias (__exp10l, __pow10l) +weak_alias (__pow10l, pow10l) +#endif diff --git a/sysdeps/libm-ieee754/w_exp10f.c b/sysdeps/libm-ieee754/w_exp10f.c new file mode 100644 index 0000000000..f78be7973b --- /dev/null +++ b/sysdeps/libm-ieee754/w_exp10f.c @@ -0,0 +1,57 @@ +/* w_exp10f.c -- float version of w_exp10.c. + * Conversion to exp10 by Ulrich Drepper <drepper@cygnus.com>. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * wrapper expf10(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const float +#else +static float +#endif +o_threshold= 3.853183944498959298709e+01, +u_threshold= -4.515449934959717928174e+01; + +#ifdef __STDC__ + float __exp10f(float x) /* wrapper exp10f */ +#else + float __exp10f(x) /* wrapper exp10f */ + float x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_exp10f(x); +#else + float z; + z = __ieee754_exp10f(x); + if(_LIB_VERSION == _IEEE_) return z; + if(__finitef(x)) { + if(x>o_threshold) + /* exp overflow */ + return (float)__kernel_standard((double)x,(double)x,146); + else if(x<u_threshold) + /* exp underflow */ + return (float)__kernel_standard((double)x,(double)x,147); + } + return z; +#endif +} +weak_alias (__exp10f, exp10f) +strong_alias (__exp10f, __pow10f) +weak_alias (__pow10f, pow10f) diff --git a/sysdeps/libm-ieee754/w_exp10l.c b/sysdeps/libm-ieee754/w_exp10l.c new file mode 100644 index 0000000000..7117873c22 --- /dev/null +++ b/sysdeps/libm-ieee754/w_exp10l.c @@ -0,0 +1,56 @@ +/* w_exp10l.c -- long double version of w_exp10.c. + * Conversion to long double by Ulrich Drepper, + * Cygnus Support, drepper@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * wrapper exp10l(x) + */ + +#include "math.h" +#include "math_private.h" + +#ifdef __STDC__ +static const long double +#else +static long double +#endif +o_threshold= 4.93207544895866790234755e+03, +u_threshold= -4.95104033868549871764588e+03; + +#ifdef __STDC__ + long double __exp10l(long double x) /* wrapper exp10 */ +#else + long double __exp10l(x) /* wrapper exp10 */ + long double x; +#endif +{ +#ifdef _IEEE_LIBM + return __ieee754_exp10l(x); +#else + long double z; + z = __ieee754_exp10l(x); + if(_LIB_VERSION == _IEEE_) return z; + if(__finitel(x)) { + if(x>o_threshold) + return __kernel_standard(x,x,246); /* exp10 overflow */ + else if(x<u_threshold) + return __kernel_standard(x,x,247); /* exp10 underflow */ + } + return z; +#endif +} +weak_alias (__exp10l, exp10l) +strong_alias (__exp10l, __pow10l) +weak_alias (__pow10l, pow10l) diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile index 7ef9e50085..73321ec76a 100644 --- a/sysdeps/unix/sysv/linux/i386/Makefile +++ b/sysdeps/unix/sysv/linux/i386/Makefile @@ -1,6 +1,6 @@ ifeq ($(subdir),misc) sysdep_routines += ioperm iopl vm86 s_pread64 s_pwrite64 -sysdep_headers += sys/perm.h sys/vm86.h +sysdep_headers += sys/elf.h sys/perm.h sys/reg.h sys/vm86.h endif ifeq ($(subdir),elf) diff --git a/sysdeps/unix/sysv/linux/i386/sys/elf.h b/sysdeps/unix/sysv/linux/i386/sys/elf.h new file mode 100644 index 0000000000..68ed3eeed0 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/sys/elf.h @@ -0,0 +1,60 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_ELF_H +#define _SYS_ELF_H 1 + +/* + * ELF register definitions.. + */ + +#include <sys/user.h> + +typedef unsigned long elf_greg_t; + +#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t)) +typedef elf_greg_t elf_gregset_t[ELF_NGREG]; + +typedef struct user_fpregs_struct elf_fpregset_t; + +#define USE_ELF_CORE_DUMP +#define ELF_EXEC_PAGESIZE 4096 + +/* regs is struct pt_regs, pr_reg is elf_gregset_t (which is + now struct_user_regs, they are different) */ + +#define ELF_CORE_COPY_REGS(pr_reg, regs) \ + pr_reg[0] = regs->ebx; \ + pr_reg[1] = regs->ecx; \ + pr_reg[2] = regs->edx; \ + pr_reg[3] = regs->esi; \ + pr_reg[4] = regs->edi; \ + pr_reg[5] = regs->ebp; \ + pr_reg[6] = regs->eax; \ + pr_reg[7] = regs->xds; \ + pr_reg[8] = regs->xes; \ + pr_reg[9] = regs->xds; \ + pr_reg[10] = regs->xds; \ + pr_reg[11] = regs->orig_eax; \ + pr_reg[12] = regs->eip; \ + pr_reg[13] = regs->xcs; \ + pr_reg[14] = regs->eflags; \ + pr_reg[15] = regs->esp; \ + pr_reg[16] = regs->xss; + +#endif /* _SYS_ELF_H */ diff --git a/sysdeps/unix/sysv/linux/i386/sys/procfs.h b/sysdeps/unix/sysv/linux/i386/sys/procfs.h new file mode 100644 index 0000000000..d98d9f55f8 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/sys/procfs.h @@ -0,0 +1,109 @@ +/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_PROCFS_H + +#define _SYS_PROCFS_H 1 +#include <features.h> + +/* This is somehow modelled after the file of the same name on SysVr4 + systems. It provides a definition of the core file format for ELF + used on Linux. */ + +#include <signal.h> +#include <sys/time.h> +#include <sys/types.h> +#include <sys/user.h> +#include <sys/elf.h> + +__BEGIN_DECLS + +struct elf_siginfo + { + int si_signo; /* Signal number. */ + int si_code; /* Extra code. */ + int si_errno; /* Errno. */ + }; + +typedef elf_greg_t greg_t; +typedef elf_gregset_t gregset_t; +typedef elf_fpregset_t fpregset_t; +#define NGREG ELF_NGREG + +/* Definitions to generate Intel SVR4-like core files. These mostly + have the same names as the SVR4 types with "elf_" tacked on the + front to prevent clashes with linux definitions, and the typedef + forms have been avoided. This is mostly like the SVR4 structure, + but more Linuxy, with things that Linux does not support and which + gdb doesn't really use excluded. Fields present but not used are + marked with "XXX". */ +struct elf_prstatus + { +#if 0 + long int pr_flags; /* XXX Process flags. */ + short int pr_why; /* XXX Reason for process halt. */ + short int pr_what; /* XXX More detailed reason. */ +#endif + struct elf_siginfo pr_info; /* Info associated with signal. */ + short int pr_cursig; /* Current signal. */ + unsigned long int pr_sigpend; /* Set of pending signals. */ + unsigned long int pr_sighold; /* Set of held signals. */ +#if 0 + struct sigaltstack pr_altstack; /* Alternate stack info. */ + struct sigaction pr_action; /* Signal action for current sig. */ +#endif + __pid_t pr_pid; + __pid_t pr_ppid; + __pid_t pr_pgrp; + __pid_t pr_sid; + struct timeval pr_utime; /* User time. */ + struct timeval pr_stime; /* System time. */ + struct timeval pr_cutime; /* Cumulative user time. */ + struct timeval pr_cstime; /* Cumulative system time. */ +#if 0 + long int pr_instr; /* Current instruction. */ +#endif + elf_gregset_t pr_reg; /* GP registers. */ + int pr_fpvalid; /* True if math copro being used. */ + }; + + +#define ELF_PRARGSZ (80) /* Number of chars for args */ + +struct elf_prpsinfo + { + char pr_state; /* Numeric process state. */ + char pr_sname; /* Char for pr_state. */ + char pr_zomb; /* Zombie. */ + char pr_nice; /* Nice val. */ + unsigned long int pr_flag; /* Flags. */ + unsigned short int pr_uid; + unsigned short int pr_gid; + int pr_pid, pr_ppid, pr_pgrp, pr_sid; + /* Lots missing */ + char pr_fname[16]; /* Filename of executable. */ + char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */ + }; + + +typedef struct elf_prstatus prstatus_t; +typedef struct elf_prpsinfo prpsinfo_t; + +__END_DECLS + +#endif /* sys/procfs.h */ diff --git a/sysdeps/unix/sysv/linux/i386/sys/reg.h b/sysdeps/unix/sysv/linux/i386/sys/reg.h new file mode 100644 index 0000000000..99c4929af6 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/sys/reg.h @@ -0,0 +1,43 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_REG_H +#define _SYS_REG_H 1 + +/* Index into an array of 4 byte integers returned from ptrace for + * location of the users' stored general purpose registers. */ + +#define EBX 0 +#define ECX 1 +#define EDX 2 +#define ESI 3 +#define EDI 4 +#define EBP 5 +#define EAX 6 +#define DS 7 +#define ES 8 +#define FS 9 +#define GS 10 +#define ORIG_EAX 11 +#define EIP 12 +#define CS 13 +#define EFL 14 +#define UESP 15 +#define SS 16 + +#endif /* _SYS_REG_H */ diff --git a/sysdeps/unix/sysv/linux/i386/sys/user.h b/sysdeps/unix/sysv/linux/i386/sys/user.h new file mode 100644 index 0000000000..4ab02a7406 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/sys/user.h @@ -0,0 +1,86 @@ +/* Copyright (C) 1998 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#ifndef _SYS_USER_H +#define _SYS_USER_H 1 + +/* The whole purpose of this file is for gdb and gdb only. Don't read + too much into it. Don't use it for anything other than gdb unless + you know what you are doing. */ + +struct user_fpregs_struct +{ + long cwd; + long swd; + long twd; + long fip; + long fcs; + long foo; + long fos; + long st_space [20]; +}; + +struct user_regs_struct +{ + long ebx; + long ecx; + long edx; + long esi; + long edi; + long ebp; + long eax; + long xds; + long xes; + long xfs; + long xgs; + long orig_eax; + long eip; + long xcs; + long eflags; + long esp; + long xss; +}; + +struct user +{ + struct user_regs_struct regs; + int u_fpvalid; + struct user_fpregs_struct i387; + unsigned long int u_tsize; + unsigned long int u_dsize; + unsigned long int u_ssize; + unsigned long start_code; + unsigned long start_stack; + long int signal; + int reserved; + struct user_regs_struct* u_ar0; + struct user_fpregs_struct* u_fpstate; + unsigned long magic; + char u_comm [32]; + int u_debugreg [8]; +}; + +#define PAGE_SHIFT 12 +#define PAGE_SIZE (1UL << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE-1)) +#define NBPG PAGE_SIZE +#define UPAGES 1 +#define HOST_TEXT_START_ADDR (u.start_code) +#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) + +#endif /* _SYS_USER_H */ diff --git a/sysdeps/unix/sysv/linux/sys/ptrace.h b/sysdeps/unix/sysv/linux/sys/ptrace.h index 7cde2f0a86..33beb50b72 100644 --- a/sysdeps/unix/sysv/linux/sys/ptrace.h +++ b/sysdeps/unix/sysv/linux/sys/ptrace.h @@ -1,5 +1,5 @@ /* `ptrace' debugger support interface. Linux version. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -22,8 +22,6 @@ #define _SYS_PTRACE_H 1 #include <features.h> -#include <asm/ptrace.h> - __BEGIN_DECLS /* Type of the REQUEST argument to `ptrace.' */ @@ -36,48 +34,68 @@ enum __ptrace_request #define PT_TRACE_ME PTRACE_TRACEME /* Return the word in the process's text space at address ADDR. */ - PTRACE_PEEKTEXT, + PTRACE_PEEKTEXT = 1, #define PT_READ_I PTRACE_PEEKTEXT /* Return the word in the process's data space at address ADDR. */ - PTRACE_PEEKDATA, + PTRACE_PEEKDATA = 2, #define PT_READ_D PTRACE_PEEKDATA /* Return the word in the process's user area at offset ADDR. */ - PTRACE_PEEKUSER, + PTRACE_PEEKUSER = 3, #define PT_READ_U PTRACE_PEEKUSER /* Write the word DATA into the process's text space at address ADDR. */ - PTRACE_POKETEXT, + PTRACE_POKETEXT = 4, #define PT_WRITE_I PTRACE_POKETEXT /* Write the word DATA into the process's data space at address ADDR. */ - PTRACE_POKEDATA, + PTRACE_POKEDATA = 5, #define PT_WRITE_D PTRACE_POKEDATA /* Write the word DATA into the process's user area at offset ADDR. */ - PTRACE_POKEUSER, + PTRACE_POKEUSER = 6, #define PT_WRITE_U PTRACE_POKEUSER /* Continue the process. */ - PTRACE_CONT, + PTRACE_CONT = 7, #define PT_CONTINUE PTRACE_CONT /* Kill the process. */ - PTRACE_KILL, + PTRACE_KILL = 8, #define PT_KILL PTRACE_KILL /* Single step the process. This is not supported on all machines. */ - PTRACE_SINGLESTEP, + PTRACE_SINGLESTEP = 9, #define PT_STEP PTRACE_SINGLESTEP + /* Get all general purpose registers used by a processes. + This is not supported on all machines. */ + PTRACE_GETREGS = 12, +#define PT_GETREGS PTRACE_GETREGS + + /* Set all general purpose registers used by a processes. + This is not supported on all machines. */ + PTRACE_SETREGS = 13, +#define PT_SETREGS PTRACE_SETREGS + + /* Get all floating point registers used by a processes. + This is not supported on all machines. */ + PTRACE_GETFPREGS = 14, +#define PT_GETFPREGS PTRACE_GETFPREGS + + /* Set all floating point registers used by a processes. + This is not supported on all machines. */ + PTRACE_SETFPREGS = 15, +#define PT_SETFPREGS PTRACE_SETFPREGS + /* Attach to a process that is already running. */ - PTRACE_ATTACH = 0x10, + PTRACE_ATTACH = 16, #define PT_ATTACH PTRACE_ATTACH /* Detach from a process attached to with PTRACE_ATTACH. */ - PTRACE_DETACH, + PTRACE_DETACH = 17, #define PT_DETACH PTRACE_DETACH /* Continue and stop at the next (return from) syscall. */ |