Add sys/procfs.h.

This commit is contained in:
Andreas Jaeger 2000-08-21 17:06:46 +00:00
parent b7d2cec071
commit 528be9fe8e
18 changed files with 1587 additions and 56 deletions

View File

@ -29,8 +29,6 @@
void
__longjmp (__jmp_buf env, int val)
{
unsigned int result;
/* Restore registers and jump back */
asm volatile("lr %%r2,%0\n\t" /* put val in grp 2 */
"lm %%r6,%%r15,%1\n\t"

View File

@ -15,9 +15,7 @@
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.
*/
Boston, MA 02111-1307, USA. */
#ifndef _FENV_H
# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
@ -62,11 +60,6 @@ enum
#define FE_TOWARDZERO FE_TOWARDZERO
};
#define FPC_EXCEPTION_MASK_SHIFT 24
#define FPC_FLAGS_SHIFT 16
#define FPC_DXC_SHIFT 8
#define FPC_NOT_FPU_EXCEPTION 0x300
/* Type representing exception flags. */
typedef unsigned int fexcept_t; /* size of fpc */

View File

@ -17,7 +17,7 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <fenv.h>
#include <fenv_libc.h>
#include <fpu_control.h>
int
@ -28,12 +28,12 @@ feclearexcept (int excepts)
/* Mask out unsupported bits/exceptions. */
excepts &= FE_ALL_EXCEPT;
_FPU_GETCW(temp);
_FPU_GETCW (temp);
/* Clear the relevant bits. */
temp &= ~((excepts<<FPC_DXC_SHIFT)|(excepts<<FPC_FLAGS_SHIFT));
temp &= ~((excepts << FPC_DXC_SHIFT)|(excepts << FPC_FLAGS_SHIFT));
/* Put the new data in effect. */
_FPU_SETCW(temp);
_FPU_SETCW (temp);
/* Success. */
return 0;

View File

@ -0,0 +1,43 @@
/* Store current floating-point environment.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
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 <fenv_libc.h>
#include <fpu_control.h>
#include <stddef.h>
#include <asm/ptrace.h>
#include <sys/ptrace.h>
#include <unistd.h>
int
fegetenv (fenv_t *envp)
{
/* The S/390 IEEE fpu doesn't keep track of the ieee instruction pointer.
To get around that the kernel will store the address of the last
fpu fault to the process structure. This ptrace call reads this value
from the kernel space. That means the ieee_instruction_pointer is
only correct after a fpu fault. That's the best we can do, there is
no way to find out the ieee instruction pointer if there was no fault. */
_FPU_GETCW (envp->fpc);
envp->ieee_instruction_pointer =
ptrace (PTRACE_PEEKUSER, getpid (), PT_IEEE_IP);
/* Success. */
return 0;
}

View File

@ -1,8 +1,7 @@
/* Return current rounding direction.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com)
Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
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
@ -19,7 +18,7 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <fenv.h>
#include <fenv_libc.h>
#include <fpu_control.h>
int
@ -27,9 +26,7 @@ fegetround (void)
{
fexcept_t cw;
_FPU_GETCW(cw);
_FPU_GETCW (cw);
return cw & FPC_RM_MASK;
}

View File

@ -0,0 +1,34 @@
/* Store current floating-point environment and clear exceptions.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
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 <fenv_libc.h>
#include <fpu_control.h>
int feholdexcept (fenv_t *envp)
{
/* Store the environment. */
fegetenv (envp);
/* Clear the current sticky bits as more than one exception
may be generated. */
envp->fpc &= ~(FPC_FLAGS_MASK | FPC_DXC_MASK);
/* Hold from generating fpu exceptions temporarily. */
_FPU_SETCW ((envp->fpc & ~(FE_ALL_EXCEPT << FPC_EXCEPTION_MASK_SHIFT)));
return 0;
}

View File

@ -0,0 +1,37 @@
/* Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
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 _FENV_LIBC_H
#define _FENV_LIBC_H 1
#include <fenv.h>
/* Definitions from asm/s390-regs-common.h that are needed in th glibc. */
#define FPC_DXC_MASK 0x0000FF00
#define FPC_EXCEPTION_MASK 0xF8000000
#define FPC_FLAGS_MASK 0x00F80000
#define FPC_RM_MASK 0x00000003
#define FPC_EXCEPTION_MASK_SHIFT 24
#define FPC_FLAGS_SHIFT 16
#define FPC_DXC_SHIFT 8
#define FPC_NOT_FPU_EXCEPTION 0x300
#endif /* _FENV_LIBC_H */

View File

@ -0,0 +1,56 @@
/* Install given floating-point environment.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
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 <fenv_libc.h>
#include <fpu_control.h>
#include <stddef.h>
#include <asm/ptrace.h>
#include <sys/ptrace.h>
#include <unistd.h>
int
fesetenv (const fenv_t *envp)
{
fenv_t env;
if (envp == FE_DFL_ENV)
{
env.fpc = _FPU_DEFAULT;
env.ieee_instruction_pointer = 0;
}
else if (envp == FE_NOMASK_ENV)
{
env.fpc = FPC_EXCEPTION_MASK;
env.ieee_instruction_pointer = 0;
}
else
env = (*envp);
/* The S/390 IEEE fpu doesn't have a register for the ieee
instruction pointer. The operating system is required to keep an
instruction pointer on a per process base. We read and write this
value with the ptrace interface. */
_FPU_SETCW (env.fpc);
ptrace (PTRACE_POKEUSER, getpid (), PT_IEEE_IP,
env.ieee_instruction_pointer);
/* Success. */
return 0;
}

View File

@ -1,7 +1,7 @@
/* Set current rounding direction.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com)
Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
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
@ -18,7 +18,7 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <fenv.h>
#include <fenv_libc.h>
#include <fpu_control.h>
int
@ -32,6 +32,6 @@ fesetround (int round)
__asm__ volatile ("srnm 0(%0)"
:
: "a" (round));
return 0;
}

View File

@ -0,0 +1,40 @@
/* Install given floating-point environment and raise exceptions.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
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 <fenv_libc.h>
#include <fpu_control.h>
int
feupdateenv (const fenv_t *envp)
{
fexcept_t temp;
_FPU_GETCW (temp);
temp = (temp & FPC_FLAGS_MASK) >> FPC_FLAGS_SHIFT;
/* Raise the exceptions since the last call to feholdenv */
/* re install saved environment. */
fesetenv (envp);
feraiseexcept ((int) temp);
/* Success. */
return 0;
}

View File

@ -1,7 +1,7 @@
/* Store current representation for exceptions.
Copyright (C) 1997 Free Software Foundation, Inc.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
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
@ -16,31 +16,21 @@
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.
Boston, MA 02111-1307, USA. */
Contributed by:
Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
*/
#include <fenv.h>
#include <fenv_libc.h>
#include <fpu_control.h>
int fegetexceptflag (fexcept_t *flagp, int excepts)
int
fegetexceptflag (fexcept_t *flagp, int excepts)
{
fexcept_t temp,newexcepts;
/* Get the current exceptions. */
_FPU_GETCW(temp);
newexcepts=((excepts<<FPC_DXC_SHIFT)|(excepts<<FPC_FLAGS_SHIFT));
*flagp = temp & newexcepts;
fexcept_t temp, newexcepts;
/* Success. */
return 0;
/* Get the current exceptions. */
_FPU_GETCW (temp);
newexcepts = (excepts << FPC_DXC_SHIFT) | (excepts << FPC_FLAGS_SHIFT);
*flagp = temp & newexcepts;
/* Success. */
return 0;
}

View File

@ -1,8 +1,8 @@
/* FPU control word definitions. Stub version.
Copyright (C) 1999 Free Software Foundation, Inc.
Contributed by
Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com) and
Copyright (C) 2000 Free Software Foundation, Inc.
Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com) and
Martin Schwidefsky (schwidefsky@de.ibm.com).
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
@ -35,13 +35,10 @@
typedef unsigned int fpu_control_t;
/* Macros for accessing the hardware control word. */
#define _FPU_GETCW(cw) __asm__ volatile ("efpc %0,0" : "=d" (cw))
#define _FPU_SETCW(cw) __asm__ volatile ("sfpc %0,0" : : "d" (cw))
#define _FPU_GETCW(cw) __asm__ volatile ("efpc %0,0" : "=d" (cw))
#define _FPU_SETCW(cw) __asm__ volatile ("sfpc %0,0" : : "d" (cw))
/* Default control word set at startup. */
extern fpu_control_t __fpu_control;
#endif /* _FPU_CONTROL_H */

View File

@ -0,0 +1,71 @@
/* Raise given exceptions.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com) and
Martin Schwidefsky (schwidefsky@de.ibm.com).
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 <fenv_libc.h>
#include <math.h>
static __inline__ void
fexceptdiv (float d, float e)
{
__asm__ __volatile__ ("debr %0,%1" : : "f" (d), "f" (e) );
}
static __inline__ void
fexceptadd (float d, float e)
{
__asm__ __volatile__ ("aebr %0,%1" : : "f" (d), "f" (e) );
}
int
feraiseexcept (int excepts)
{
/* Raise exceptions represented by EXPECTS. But we must raise only
one signal at a time. It is important that if the overflow/underflow
exception and the inexact exception are given at the same time,
the overflow/underflow exception follows the inexact exception. */
/* First: invalid exception. */
if (FE_INVALID & excepts)
fexceptdiv (0.0, 0.0);
/* Next: division by zero. */
if (FE_DIVBYZERO & excepts)
fexceptdiv (1.0, 0.0);
/* Next: overflow. */
if (FE_OVERFLOW & excepts)
/* I don't think we can do the same trick as intel so we will have
to live with inexact coming also. */
fexceptadd (FLT_MAX, 1.0e32);
/* Next: underflow. */
if (FE_UNDERFLOW & excepts)
fexceptdiv (FLT_MIN, 3.0);
/* Last: inexact. */
if (FE_INEXACT & excepts)
fexceptdiv (2.0, 3.0);
/* Success. */
return 0;
}

View File

@ -0,0 +1,46 @@
/* Set floating-point environment exception handling.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Denis Joseph Barrow (djbarrow@de.ibm.com).
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 <fenv_libc.h>
#include <math.h>
#include <fpu_control.h>
int
fesetexceptflag (const fexcept_t *flagp, int excepts)
{
fexcept_t temp,newexcepts;
/* Get the current environment. We have to do this since we cannot
separately set the status word. */
_FPU_GETCW (temp);
/* Install the new exception bits in the Accrued Exception Byte. */
excepts = excepts & FE_ALL_EXCEPT;
newexcepts = (excepts << FPC_DXC_SHIFT) | (excepts << FPC_FLAGS_SHIFT);
temp &= ~newexcepts;
temp |= *flagp & newexcepts;
/* Store the new status word (along with the rest of the environment.
Possibly new exceptions are set but they won't get executed unless
the next floating-point instruction. */
_FPU_SETCW (temp);
/* Success. */
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@
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.
Boston, MA 02111-1307, USA. */
#define BITS_PER_MP_LIMB 32
#define BYTES_PER_MP_LIMB 4

149
sysdeps/s390/initfini.c Normal file
View File

@ -0,0 +1,149 @@
/* Special .init and .fini section support for S/390.
Copyright (C) 2000 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.
In addition to the permissions in the GNU Library General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The Library General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
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, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* This file is compiled into assembly code which is then munged by a sed
script into two files: crti.s and crtn.s.
* crti.s puts a function prologue at the beginning of the
.init and .fini sections and defines global symbols for
those addresses, so they can be called as functions.
* crtn.s puts the corresponding function epilogues
in the .init and .fini sections. */
__asm__ ("
#include \"defs.h\"
/*@HEADER_ENDS*/
/*@TESTS_BEGIN*/
/*@TESTS_END*/
/*@_init_PROLOG_BEGINS*/
.section .init
#NO_APP
.align 4
.globl _init
.type _init,@function
_init:
# leaf function 0
# automatics 0
# outgoing args 0
# need frame pointer 0
# call alloca 0
# has varargs 0
# incoming args (stack) 0
# function length 36
STM 6,15,24(15)
BRAS 13,.LTN1_0
.LT1_0:
.LC14:
.long __gmon_start__@GOT
.LC15:
.long _GLOBAL_OFFSET_TABLE_-.LT1_0
.LTN1_0:
LR 1,15
AHI 15,-96
ST 1,0(15)
L 12,.LC15-.LT1_0(13)
AR 12,13
L 1,.LC14-.LT1_0(13)
L 1,0(1,12)
LTR 1,1
JE .L22
BASR 14,1
.L22:
#APP
ALIGN
END_INIT
/*@_init_PROLOG_ENDS*/
/*@_init_EPILOG_BEGINS*/
.align 4
.section .init
#NO_APP
.align 4
L 4,152(15)
LM 6,15,120(15)
BR 4
#APP
END_INIT
/*@_init_EPILOG_ENDS*/
/*@_fini_PROLOG_BEGINS*/
.section .fini
#NO_APP
.align 4
.globl _fini
.type _fini,@function
_fini:
# leaf function 0
# automatics 0
# outgoing args 0
# need frame pointer 0
# call alloca 0
# has varargs 0
# incoming args (stack) 0
# function length 30
STM 6,15,24(15)
BRAS 13,.LTN2_0
.LT2_0:
.LC17:
.long _GLOBAL_OFFSET_TABLE_-.LT2_0
.LTN2_0:
LR 1,15
AHI 15,-96
ST 1,0(15)
L 12,.LC17-.LT2_0(13)
AR 12,13
#APP
ALIGN
END_FINI
/*@_fini_PROLOG_ENDS*/
/*@_fini_EPILOG_BEGINS*/
.align 4
.section .fini
#NO_APP
.align 4
L 4,152(15)
LM 6,15,120(15)
BR 4
#APP
END_FINI
/*@_fini_EPILOG_ENDS*/
/*@TRAILER_BEGINS*/
");

View File

@ -4,4 +4,5 @@ setresgid.c
setfsuid.c
setfsgid.c
sys/elf.h
sys/procfs.h
sys/user.h