2006-02-20  Roland McGrath  <roland@redhat.com>
	* sysdeps/mips: Directory removed, saved in ports repository.
	* sysdeps/unix/mips: Likewise.
	* sysdeps/unix/sysv/linux/mips: Likewise.
	* sysdeps/mach/mips: Likewise.
	* sysdeps/mach/hurd/mips: Likewise.
	* shlib-versions: Remove mips matches, now in ports fragment.
	* sysdeps/unix/sysv/linux/kernel-features.h: Likewise.
	* configure.in (machine): Likewise.
	* configure: Regenerated.
2006-02-15  Thomas Schwinge  <tschwinge@gnu.org>

	[BZ #2329]
	* include/unistd.h (__getresuid, __getresgid, __setresuid)
	(__setresgid): Fix argument name order in prototypes.
	* posix/unistd.h (getresuid, getresgid, setresuid, setresgid):
	Likewise.
	* posix/getresuid.c (__getresuid): Fix argument order in definition.
	* posix/getresgid.c (__getresgid): Likewise.
	* posix/setresuid.c (__setresuid): Likewise.
	* posix/setresgid.c (__setresgid): Likewise.
	* sysdeps/mach/hurd/getresuid.c (__getresuid): Likewise.
	* sysdeps/mach/hurd/getresgid.c (__getresgid): Likewise.
	* sysdeps/mach/hurd/setresuid.c (__setresuid): Likewise.
	* sysdeps/mach/hurd/setresgid.c (__setresgid): Likewise.
	Reported by Samuel Thibault <samuel.thibault@ens-lyon.org>.
This commit is contained in:
Roland McGrath 2006-02-21 02:30:10 +00:00
parent 0ca3379de1
commit 0d5cb2c74f
236 changed files with 85 additions and 18273 deletions

View File

@ -8,7 +8,17 @@
* sysdeps/unix/sysv/linux/alpha/fxstatat.c: Fix hidden defs.
2006-02-20 Roland McGrath <roland@frob.com>
2006-02-20 Roland McGrath <roland@redhat.com>
* sysdeps/mips: Directory removed, saved in ports repository.
* sysdeps/unix/mips: Likewise.
* sysdeps/unix/sysv/linux/mips: Likewise.
* sysdeps/mach/mips: Likewise.
* sysdeps/mach/hurd/mips: Likewise.
* shlib-versions: Remove mips matches, now in ports fragment.
* sysdeps/unix/sysv/linux/kernel-features.h: Likewise.
* configure.in (machine): Likewise.
* configure: Regenerated.
* hurd/hurd/xattr.h: New file.
* hurd/xattr.c: New file.
@ -24,6 +34,23 @@
* sysdeps/mach/hurd/removexattr.c: New file.
* sysdeps/mach/hurd/setxattr.c: New file.
2006-02-15 Thomas Schwinge <tschwinge@gnu.org>
[BZ #2329]
* include/unistd.h (__getresuid, __getresgid, __setresuid)
(__setresgid): Fix argument name order in prototypes.
* posix/unistd.h (getresuid, getresgid, setresuid, setresgid):
Likewise.
* posix/getresuid.c (__getresuid): Fix argument order in definition.
* posix/getresgid.c (__getresgid): Likewise.
* posix/setresuid.c (__setresuid): Likewise.
* posix/setresgid.c (__setresgid): Likewise.
* sysdeps/mach/hurd/getresuid.c (__getresuid): Likewise.
* sysdeps/mach/hurd/getresgid.c (__getresgid): Likewise.
* sysdeps/mach/hurd/setresuid.c (__setresuid): Likewise.
* sysdeps/mach/hurd/setresgid.c (__setresgid): Likewise.
Reported by Samuel Thibault <samuel.thibault@ens-lyon.org>.
2006-02-13 Mike Frysinger <vapier@gentoo.org>
* string/tester.c (test_strnlen): New function.

View File

@ -448,33 +448,6 @@ m680?0) base_machine=m68k machine=m68k/$machine ;;
m68k) base_machine=m68k machine=m68k/m68020 ;;
m88???) base_machine=m88k machine=m88k/$machine ;;
m88k) base_machine=m88k machine=m88k/m88100 ;;
mips64*) base_machine=mips64
case "$CC $CFLAGS $CPPFLAGS " in
*" -mabi=n32 "*) mips_cc_abi=n32 ;;
*" -mabi=64 "*|*" -mabi=n64 "*) mips_cc_abi=64 ;;
*" -mabi=32 "*|*" -mabi=o32 "*) mips_cc_abi=32 ;;
*) mips_cc_abi=default ;;
esac
case $config_os in
*abin32*) mips_config_abi=n32 ;;
*abi64*|*abin64*) mips_config_abi=64 ;;
*abi32*|*abio32*) mips_config_abi=32 ;;
*) mips_config_abi=$mips_cc_abi ;;
esac
case $mips_config_abi in
default) machine=mips/mips64/n32 mips_config_abi=n32 ;;
n32) machine=mips/mips64/n32 ;;
64) machine=mips/mips64/n64 ;;
32) machine=mips/mips32/kern64 ;;
esac
machine=$machine/$config_machine
if test $mips_config_abi != $mips_cc_abi; then
# This won't make it to config.make, but we want to
# set this in case configure tests depend on it.
CPPFLAGS="$CPPFLAGS -mabi=$mips_config_abi"
fi
;;
mips*) base_machine=mips machine=mips/mips32/$machine ;;
powerpc) base_machine=powerpc machine=powerpc/powerpc32 ;;
powerpc64) base_machine=powerpc machine=powerpc/powerpc64 ;;
s390) base_machine=s390 machine=s390/s390-32 ;;

View File

@ -96,10 +96,10 @@ extern int __setgid (__gid_t __gid);
extern int __setpgid (__pid_t __pid, __pid_t __pgid);
libc_hidden_proto (__setpgid)
extern int __setregid (__gid_t __rgid, __gid_t __egid);
extern int __getresuid (__uid_t *__euid, __uid_t *__ruid, __uid_t *__suid);
extern int __getresgid (__gid_t *__egid, __gid_t *__rgid, __gid_t *__sgid);
extern int __setresuid (__uid_t __euid, __uid_t __ruid, __uid_t __suid);
extern int __setresgid (__gid_t __egid, __gid_t __rgid, __gid_t __sgid);
extern int __getresuid (__uid_t *__ruid, __uid_t *__euid, __uid_t *__suid);
extern int __getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid);
extern int __setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid);
extern int __setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid);
libc_hidden_proto (__getresuid)
libc_hidden_proto (__getresgid)
libc_hidden_proto (__setresuid)

View File

@ -1,25 +0,0 @@
# Copyright (C) 2005 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 Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with the GNU C Library; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA.
ifeq ($(subdir),csu)
gen-as-const-headers += tcb-offsets.sym
endif
ifeq ($(subdir),nptl)
libpthread-sysdep_routines += nptl-sysdep
endif

View File

@ -1,2 +0,0 @@
/* Pull in __syscall_error. */
#include <sysdep.S>

View File

@ -1,37 +0,0 @@
/* Copyright (C) 2005 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sys/asm.h>
#include <sysdep.h>
#include <sgidefs.h>
ENTRY (pthread_spin_lock)
.set push
#if _MIPS_SIM == _ABIO32
.set mips2
#endif
1: ll a2, 0(a0)
li a1, 1
bnez a2, 1b
sc a1, 0(a0)
beqz a1, 1b
MIPS_SYNC
.set pop
li v0, 0
ret
PSEUDO_END (pthread_spin_lock)

View File

@ -1,41 +0,0 @@
/* Copyright (C) 2005 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sys/asm.h>
#include <sysdep.h>
#define _ERRNO_H 1
#include <bits/errno.h>
#include <sgidefs.h>
ENTRY (pthread_spin_trylock)
.set push
#if _MIPS_SIM == _ABIO32
.set mips2
#endif
ll a2, 0(a0)
li a1, 1
bnez a2, 1f
sc a1, 0(a0)
beqz a1, 1f
MIPS_SYNC
.set pop
li v0, 0
ret
1: li v0, EBUSY
ret
PSEUDO_END (pthread_spin_trylock)

View File

@ -1,39 +0,0 @@
/* Copyright (C) 2002, 2003, 2005 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* Default stack size. */
#define ARCH_STACK_DEFAULT_SIZE (2 * 1024 * 1024)
/* Required stack pointer alignment at beginning. */
#define STACK_ALIGN 16
/* Minimal stack size after allocating thread descriptor and guard size. */
#define MINIMAL_REST_STACK 2048
/* Alignment requirement for TCB. */
#define TCB_ALIGNMENT 16
/* Location of current stack frame. */
#define CURRENT_STACK_FRAME __builtin_frame_address (0)
/* XXX Until we have a better place keep the definitions here. */
#define __exit_thread_inline(val) \
INLINE_SYSCALL (exit, 1, (val))

View File

@ -1,11 +0,0 @@
#include <sysdep.h>
#include <tls.h>
--
-- Abuse tls.h macros to derive offsets relative to the thread register.
#define thread_offsetof(mem) (long)(offsetof(struct pthread, mem) - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE)
MULTIPLE_THREADS_OFFSET thread_offsetof (header.multiple_threads)
PID_OFFSET thread_offsetof (pid)
TID_OFFSET thread_offsetof (tid)

View File

@ -1,161 +0,0 @@
/* Definition for thread-local data handling. NPTL/MIPS version.
Copyright (C) 2005 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _TLS_H
#define _TLS_H 1
#include <dl-sysdep.h>
#ifndef __ASSEMBLER__
# include <stdbool.h>
# include <stddef.h>
# include <stdint.h>
/* Type for the dtv. */
typedef union dtv
{
size_t counter;
struct
{
void *val;
bool is_static;
} pointer;
} dtv_t;
/* Note: rd must be $v1 to be ABI-conformant. */
# define READ_THREAD_POINTER() \
({ void *__result; \
asm volatile (".set\tpush\n\t.set\tmips32r2\n\t" \
"rdhwr\t%0, $29\n\t.set\tpop" : "=v" (__result)); \
__result; })
#else /* __ASSEMBLER__ */
# include <tcb-offsets.h>
# define READ_THREAD_POINTER(rd) \
.set push; \
.set mips32r2; \
rdhwr rd, $29; \
.set pop
#endif /* __ASSEMBLER__ */
/* We require TLS support in the tools. */
#ifndef HAVE_TLS_SUPPORT
# error "TLS support is required."
#endif
/* Signal that TLS support is available. */
#define USE_TLS 1
#ifndef __ASSEMBLER__
/* Get system call information. */
# include <sysdep.h>
/* The TP points to the start of the thread blocks. */
# define TLS_DTV_AT_TP 1
/* Get the thread descriptor definition. */
# include <nptl/descr.h>
typedef struct
{
dtv_t *dtv;
void *private;
} tcbhead_t;
/* This is the size of the initial TCB. Because our TCB is before the thread
pointer, we don't need this. */
# define TLS_INIT_TCB_SIZE 0
/* Alignment requirements for the initial TCB. */
# define TLS_INIT_TCB_ALIGN __alignof__ (struct pthread)
/* This is the size of the TCB. Because our TCB is before the thread
pointer, we don't need this. */
# define TLS_TCB_SIZE 0
/* Alignment requirements for the TCB. */
# define TLS_TCB_ALIGN __alignof__ (struct pthread)
/* This is the size we need before TCB - actually, it includes the TCB. */
# define TLS_PRE_TCB_SIZE \
(sizeof (struct pthread) \
+ ((sizeof (tcbhead_t) + TLS_TCB_ALIGN - 1) & ~(TLS_TCB_ALIGN - 1)))
/* The thread pointer (in hardware register $29) points to the end of
the TCB + 0x7000, as for PowerPC. The pthread_descr structure is
immediately in front of the TCB. */
# define TLS_TCB_OFFSET 0x7000
/* Install the dtv pointer. The pointer passed is to the element with
index -1 which contain the length. */
# define INSTALL_DTV(tcbp, dtvp) \
(((tcbhead_t *) (tcbp))[-1].dtv = (dtvp) + 1)
/* Install new dtv for current thread. */
# define INSTALL_NEW_DTV(dtv) \
(THREAD_DTV() = (dtv))
/* Return dtv of given thread descriptor. */
# define GET_DTV(tcbp) \
(((tcbhead_t *) (tcbp))[-1].dtv)
/* Code to initially initialize the thread pointer. This might need
special attention since 'errno' is not yet available and if the
operation can cause a failure 'errno' must not be touched. */
# define TLS_INIT_TP(tcbp, secondcall) \
({ INTERNAL_SYSCALL_DECL (err); \
long result_var; \
result_var = INTERNAL_SYSCALL (set_thread_area, err, 1, \
(char *) (tcbp) + TLS_TCB_OFFSET); \
INTERNAL_SYSCALL_ERROR_P (result_var, err) \
? "unknown error" : NULL; })
/* Return the address of the dtv for the current thread. */
# define THREAD_DTV() \
(((tcbhead_t *) (READ_THREAD_POINTER () - TLS_TCB_OFFSET))[-1].dtv)
/* Return the thread descriptor for the current thread. */
# define THREAD_SELF \
((struct pthread *) (READ_THREAD_POINTER () \
- TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE))
/* Magic for libthread_db to know how to do THREAD_SELF. */
# define DB_THREAD_SELF \
CONST_THREAD_AREA (32, TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE)
/* Access to data in the thread descriptor is easy. */
# define THREAD_GETMEM(descr, member) \
descr->member
# define THREAD_GETMEM_NC(descr, member, idx) \
descr->member[idx]
# define THREAD_SETMEM(descr, member, value) \
descr->member = (value)
# define THREAD_SETMEM_NC(descr, member, idx, value) \
descr->member[idx] = (value)
/* l_tls_offset == 0 is perfectly valid on MIPS, so we have to use some
different value to mean unset l_tls_offset. */
# define NO_TLS_OFFSET -1
#endif /* __ASSEMBLER__ */
#endif /* tls.h */

View File

@ -1,202 +0,0 @@
/* Machine-specific pthread type layouts. MIPS version.
Copyright (C) 2005, 2006 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _BITS_PTHREADTYPES_H
#define _BITS_PTHREADTYPES_H 1
#if _MIPS_SIM == _ABI64
# define __SIZEOF_PTHREAD_ATTR_T 56
# define __SIZEOF_PTHREAD_MUTEX_T 40
# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
# define __SIZEOF_PTHREAD_COND_T 48
# define __SIZEOF_PTHREAD_CONDATTR_T 4
# define __SIZEOF_PTHREAD_RWLOCK_T 56
# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
# define __SIZEOF_PTHREAD_BARRIER_T 32
# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
#else
# define __SIZEOF_PTHREAD_ATTR_T 36
# define __SIZEOF_PTHREAD_MUTEX_T 24
# define __SIZEOF_PTHREAD_MUTEXATTR_T 4
# define __SIZEOF_PTHREAD_COND_T 48
# define __SIZEOF_PTHREAD_CONDATTR_T 4
# define __SIZEOF_PTHREAD_RWLOCK_T 32
# define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
# define __SIZEOF_PTHREAD_BARRIER_T 20
# define __SIZEOF_PTHREAD_BARRIERATTR_T 4
#endif
/* Thread identifiers. The structure of the attribute type is
deliberately not exposed. */
typedef unsigned long int pthread_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_ATTR_T];
long int __align;
} pthread_attr_t;
/* Data structures for mutex handling. The structure of the attribute
type is deliberately not exposed. */
typedef union
{
struct __pthread_mutex_s
{
int __lock;
unsigned int __count;
int __owner;
#if _MIPS_SIM == _ABI64
unsigned int __nusers;
#endif
/* KIND must stay at this position in the structure to maintain
binary compatibility. */
int __kind;
#if _MIPS_SIM == _ABI64
int __spins;
struct __pthread_mutex_s *__next;
struct __pthread_mutex_s *__prev;
# define __PTHREAD_MUTEX_HAVE_PREV 1
#else
unsigned int __nusers;
__extension__ union
{
int __spins;
struct __pthread_mutex_s *__next;
};
#endif
} __data;
char __size[__SIZEOF_PTHREAD_MUTEX_T];
long int __align;
} pthread_mutex_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_MUTEXATTR_T];
int __align;
} pthread_mutexattr_t;
/* Data structure for conditional variable handling. The structure of
the attribute type is deliberately not exposed. */
typedef union
{
struct
{
int __lock;
unsigned int __futex;
__extension__ unsigned long long int __total_seq;
__extension__ unsigned long long int __wakeup_seq;
__extension__ unsigned long long int __woken_seq;
void *__mutex;
unsigned int __nwaiters;
unsigned int __broadcast_seq;
} __data;
char __size[__SIZEOF_PTHREAD_COND_T];
__extension__ long long int __align;
} pthread_cond_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_CONDATTR_T];
int __align;
} pthread_condattr_t;
/* Keys for thread-specific data */
typedef unsigned int pthread_key_t;
/* Once-only execution */
typedef int pthread_once_t;
#if defined __USE_UNIX98 || defined __USE_XOPEN2K
/* Data structure for read-write lock variable handling. The
structure of the attribute type is deliberately not exposed. */
typedef union
{
# if _MIPS_SIM == _ABI64
struct
{
int __lock;
unsigned int __nr_readers;
unsigned int __readers_wakeup;
unsigned int __writer_wakeup;
unsigned int __nr_readers_queued;
unsigned int __nr_writers_queued;
int __writer;
int __pad1;
unsigned long int __pad2;
unsigned long int __pad3;
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
unsigned int __flags;
} __data;
# else
struct
{
int __lock;
unsigned int __nr_readers;
unsigned int __readers_wakeup;
unsigned int __writer_wakeup;
unsigned int __nr_readers_queued;
unsigned int __nr_writers_queued;
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
unsigned int __flags;
int __writer;
} __data;
# endif
char __size[__SIZEOF_PTHREAD_RWLOCK_T];
long int __align;
} pthread_rwlock_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_RWLOCKATTR_T];
long int __align;
} pthread_rwlockattr_t;
#endif
#ifdef __USE_XOPEN2K
/* POSIX spinlock data type. */
typedef volatile int pthread_spinlock_t;
/* POSIX barriers data type. The structure of the type is
deliberately not exposed. */
typedef union
{
char __size[__SIZEOF_PTHREAD_BARRIER_T];
long int __align;
} pthread_barrier_t;
typedef union
{
char __size[__SIZEOF_PTHREAD_BARRIERATTR_T];
int __align;
} pthread_barrierattr_t;
#endif
#endif /* bits/pthreadtypes.h */

View File

@ -1,40 +0,0 @@
/* Copyright (C) 2002, 2005 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _SEMAPHORE_H
# error "Never use <bits/semaphore.h> directly; include <semaphore.h> instead."
#endif
#if _MIPS_SIM == _ABI64
# define __SIZEOF_SEM_T 32
#else
# define __SIZEOF_SEM_T 16
#endif
/* Value returned if `sem_open' failed. */
#define SEM_FAILED ((sem_t *) 0)
/* Maximum value the semaphore can have. */
#define SEM_VALUE_MAX (2147483647)
typedef union
{
char __size[__SIZEOF_SEM_T];
long int __align;
} sem_t;

View File

@ -1,2 +0,0 @@
#define RESET_PID
#include <sysdeps/unix/sysv/linux/mips/clone.S>

View File

@ -1,24 +0,0 @@
/* Copyright (C) 2005 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* Value passed to 'clone' for initialization of the thread register. */
#define TLS_VALUE ((void *) (pd) \
+ TLS_TCB_OFFSET + TLS_PRE_TCB_SIZE)
/* Get the real implementation. */
#include <nptl/sysdeps/pthread/createthread.c>

View File

@ -1 +0,0 @@
#include "../i386/fork.c"

View File

@ -1,216 +0,0 @@
/* Copyright (C) 2003, 2004, 2005 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _LOWLEVELLOCK_H
#define _LOWLEVELLOCK_H 1
#include <time.h>
#include <sys/param.h>
#include <bits/pthreadtypes.h>
#include <atomic.h>
#include <sysdep.h>
#define FUTEX_WAIT 0
#define FUTEX_WAKE 1
#define FUTEX_REQUEUE 3
#define FUTEX_CMP_REQUEUE 4
/* Initializer for compatibility lock. */
#define LLL_MUTEX_LOCK_INITIALIZER (0)
#define lll_futex_wait(futexp, val) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret; \
__ret = INTERNAL_SYSCALL (futex, __err, 4, \
(futexp), FUTEX_WAIT, (val), 0); \
INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
})
#define lll_futex_timed_wait(futexp, val, timespec) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret; \
__ret = INTERNAL_SYSCALL (futex, __err, 4, \
(futexp), FUTEX_WAIT, (val), (timespec)); \
INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
})
#define lll_futex_wake(futexp, nr) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret; \
__ret = INTERNAL_SYSCALL (futex, __err, 4, \
(futexp), FUTEX_WAKE, (nr), 0); \
INTERNAL_SYSCALL_ERROR_P (__ret, __err) ? -__ret : __ret; \
})
/* Returns non-zero if error happened, zero if success. */
#define lll_futex_requeue(futexp, nr_wake, nr_move, mutex, val) \
({ \
INTERNAL_SYSCALL_DECL (__err); \
long int __ret; \
__ret = INTERNAL_SYSCALL (futex, __err, 6, \
(futexp), FUTEX_CMP_REQUEUE, (nr_wake), \
(nr_move), (mutex), (val)); \
INTERNAL_SYSCALL_ERROR_P (__ret, __err); \
})
static inline int __attribute__((always_inline))
__lll_mutex_trylock(int *futex)
{
return atomic_compare_and_exchange_val_acq (futex, 1, 0) != 0;
}
#define lll_mutex_trylock(lock) __lll_mutex_trylock (&(lock))
static inline int __attribute__((always_inline))
__lll_mutex_cond_trylock(int *futex)
{
return atomic_compare_and_exchange_val_acq (futex, 2, 0) != 0;
}
#define lll_mutex_cond_trylock(lock) __lll_mutex_cond_trylock (&(lock))
extern void __lll_lock_wait (int *futex) attribute_hidden;
static inline void __attribute__((always_inline))
__lll_mutex_lock(int *futex)
{
if (atomic_compare_and_exchange_bool_acq (futex, 1, 0) != 0)
__lll_lock_wait (futex);
}
#define lll_mutex_lock(futex) __lll_mutex_lock (&(futex))
static inline void __attribute__ ((always_inline))
__lll_mutex_cond_lock (int *futex)
{
if (atomic_compare_and_exchange_bool_acq (futex, 2, 0) != 0)
__lll_lock_wait (futex);
}
#define lll_mutex_cond_lock(futex) __lll_mutex_cond_lock (&(futex))
extern int __lll_timedlock_wait (int *futex, const struct timespec *)
attribute_hidden;
static inline int __attribute__ ((always_inline))
__lll_mutex_timedlock (int *futex, const struct timespec *abstime)
{
int result = 0;
if (atomic_compare_and_exchange_bool_acq (futex, 1, 0) != 0)
result = __lll_timedlock_wait (futex, abstime);
return result;
}
#define lll_mutex_timedlock(futex, abstime) \
__lll_mutex_timedlock (&(futex), abstime)
static inline void __attribute__ ((always_inline))
__lll_mutex_unlock (int *futex)
{
int val = atomic_exchange_rel (futex, 0);
if (__builtin_expect (val > 1, 0))
lll_futex_wake (futex, 1);
}
#define lll_mutex_unlock(futex) __lll_mutex_unlock(&(futex))
static inline void __attribute__ ((always_inline))
__lll_mutex_unlock_force (int *futex)
{
(void) atomic_exchange_rel (futex, 0);
lll_futex_wake (futex, 1);
}
#define lll_mutex_unlock_force(futex) __lll_mutex_unlock_force(&(futex))
#define lll_mutex_islocked(futex) \
(futex != 0)
/* Our internal lock implementation is identical to the binary-compatible
mutex implementation. */
/* Type for lock object. */
typedef int lll_lock_t;
/* Initializers for lock. */
#define LLL_LOCK_INITIALIZER (0)
#define LLL_LOCK_INITIALIZER_LOCKED (1)
extern int lll_unlock_wake_cb (int *__futex) attribute_hidden;
/* The states of a lock are:
0 - untaken
1 - taken by one user
>1 - taken by more users */
#define lll_trylock(lock) lll_mutex_trylock (lock)
#define lll_lock(lock) lll_mutex_lock (lock)
#define lll_unlock(lock) lll_mutex_unlock (lock)
#define lll_islocked(lock) lll_mutex_islocked (lock)
/* The kernel notifies a process which uses CLONE_CLEARTID via futex
wakeup when the clone terminates. The memory location contains the
thread ID while the clone is running and is reset to zero
afterwards. */
#define lll_wait_tid(tid) \
do { \
__typeof (tid) __tid; \
while ((__tid = (tid)) != 0) \
lll_futex_wait (&(tid), __tid); \
} while (0)
extern int __lll_timedwait_tid (int *, const struct timespec *)
attribute_hidden;
#define lll_timedwait_tid(tid, abstime) \
({ \
int __res = 0; \
if ((tid) != 0) \
__res = __lll_timedwait_tid (&(tid), (abstime)); \
__res; \
})
/* Conditional variable handling. */
extern void __lll_cond_wait (pthread_cond_t *cond)
attribute_hidden;
extern int __lll_cond_timedwait (pthread_cond_t *cond,
const struct timespec *abstime)
attribute_hidden;
extern void __lll_cond_wake (pthread_cond_t *cond)
attribute_hidden;
extern void __lll_cond_broadcast (pthread_cond_t *cond)
attribute_hidden;
#define lll_cond_wait(cond) \
__lll_cond_wait (cond)
#define lll_cond_timedwait(cond, abstime) \
__lll_cond_timedwait (cond, abstime)
#define lll_cond_wake(cond) \
__lll_cond_wake (cond)
#define lll_cond_broadcast(cond) \
__lll_cond_broadcast (cond)
#endif /* lowlevellock.h */

View File

@ -1,37 +0,0 @@
/* Copyright (C) 2005 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <tls.h>
/* Save the PID value. */
#define SAVE_PID \
READ_THREAD_POINTER(v1); /* Get the thread pointer. */ \
lw a2, PID_OFFSET(v1); /* Load the saved PID. */ \
subu a2, $0, a2; /* Negate it. */ \
sw a2, PID_OFFSET(v1); /* Store the temporary PID. */
/* Restore the old PID value in the parent. */
#define RESTORE_PID \
beqz v0, 1f; /* If we are the parent... */ \
READ_THREAD_POINTER(v1); /* Get the thread pointer. */ \
lw a2, PID_OFFSET(v1); /* Load the saved PID. */ \
subu a2, $0, a2; /* Re-negate it. */ \
sw a2, PID_OFFSET(v1); /* Restore the PID. */ \
1:
#include <../sysdeps/unix/sysv/linux/mips/vfork.S>

View File

@ -1,94 +0,0 @@
/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include "pthreadP.h"
#include <lowlevellock.h>
unsigned long int __fork_generation attribute_hidden;
static void
clear_once_control (void *arg)
{
pthread_once_t *once_control = (pthread_once_t *) arg;
*once_control = 0;
lll_futex_wake (once_control, INT_MAX);
}
int
__pthread_once (once_control, init_routine)
pthread_once_t *once_control;
void (*init_routine) (void);
{
while (1)
{
int oldval, val, newval;
val = *once_control;
do
{
/* Check if the initialized has already been done. */
if ((val & 2) != 0)
return 0;
oldval = val;
newval = (oldval & 3) | __fork_generation | 1;
val = atomic_compare_and_exchange_val_acq (once_control, newval,
oldval);
}
while (__builtin_expect (val != oldval, 0));
/* Check if another thread already runs the initializer. */
if ((oldval & 1) != 0)
{
/* Check whether the initializer execution was interrupted
by a fork. */
if (((oldval ^ newval) & -4) == 0)
{
/* Same generation, some other thread was faster. Wait. */
lll_futex_wait (once_control, newval);
continue;
}
}
/* This thread is the first here. Do the initialization.
Register a cleanup handler so that in case the thread gets
interrupted the initialization can be restarted. */
pthread_cleanup_push (clear_once_control, once_control);
init_routine ();
pthread_cleanup_pop (0);
/* Add one to *once_control. */
atomic_increment (once_control);
/* Wake up all other threads. */
lll_futex_wake (once_control, INT_MAX);
break;
}
return 0;
}
weak_alias (__pthread_once, pthread_once)
strong_alias (__pthread_once, __pthread_once_internal)

View File

@ -1,170 +0,0 @@
/* Copyright (C) 2003, 2004, 2005 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sysdep.h>
#include <sysdeps/generic/sysdep.h>
#include <tls.h>
#ifndef __ASSEMBLER__
# include <nptl/pthreadP.h>
#endif
#if !defined NOT_IN_libc || defined IS_IN_libpthread || defined IS_IN_librt
#ifdef __PIC__
# undef PSEUDO
# define PSEUDO(name, syscall_name, args) \
.align 2; \
L(pseudo_start): \
cfi_startproc; \
99: la t9,__syscall_error; \
jr t9; \
.type __##syscall_name##_nocancel, @function; \
.globl __##syscall_name##_nocancel; \
__##syscall_name##_nocancel: \
.set noreorder; \
.cpload t9; \
li v0, SYS_ify(syscall_name); \
syscall; \
.set reorder; \
bne a3, zero, SYSCALL_ERROR_LABEL; \
ret; \
.size __##syscall_name##_nocancel,.-__##syscall_name##_nocancel; \
ENTRY (name) \
.set noreorder; \
.cpload t9; \
.set reorder; \
SINGLE_THREAD_P(v1); \
bne zero, v1, L(pseudo_cancel); \
.set noreorder; \
li v0, SYS_ify(syscall_name); \
syscall; \
.set reorder; \
bne a3, zero, SYSCALL_ERROR_LABEL; \
ret; \
L(pseudo_cancel): \
SAVESTK_##args; \
sw ra, 28(sp); \
cfi_rel_offset (ra, 28); \
sw gp, 32(sp); \
cfi_rel_offset (gp, 32); \
PUSHARGS_##args; /* save syscall args */ \
CENABLE; \
lw gp, 32(sp); \
sw v0, 44(sp); /* save mask */ \
POPARGS_##args; /* restore syscall args */ \
.set noreorder; \
li v0, SYS_ify (syscall_name); \
syscall; \
.set reorder; \
sw v0, 36(sp); /* save syscall result */ \
sw a3, 40(sp); /* save syscall error flag */ \
lw a0, 44(sp); /* pass mask as arg1 */ \
CDISABLE; \
lw gp, 32(sp); \
lw v0, 36(sp); /* restore syscall result */ \
lw a3, 40(sp); /* restore syscall error flag */ \
lw ra, 28(sp); /* restore return address */ \
.set noreorder; \
bne a3, zero, SYSCALL_ERROR_LABEL; \
RESTORESTK; \
L(pseudo_end): \
.set reorder;
# undef PSEUDO_END
# define PSEUDO_END(sym) cfi_endproc; .end sym; .size sym,.-sym
#endif
# define PUSHARGS_0 /* nothing to do */
# define PUSHARGS_1 PUSHARGS_0 sw a0, 0(sp); cfi_rel_offset (a0, 0);
# define PUSHARGS_2 PUSHARGS_1 sw a1, 4(sp); cfi_rel_offset (a1, 4);
# define PUSHARGS_3 PUSHARGS_2 sw a2, 8(sp); cfi_rel_offset (a2, 8);
# define PUSHARGS_4 PUSHARGS_3 sw a3, 12(sp); cfi_rel_offset (a3, 12);
# define PUSHARGS_5 PUSHARGS_4 /* handled by SAVESTK_## */
# define PUSHARGS_6 PUSHARGS_5
# define PUSHARGS_7 PUSHARGS_6
# define POPARGS_0 /* nothing to do */
# define POPARGS_1 POPARGS_0 lw a0, 0(sp);
# define POPARGS_2 POPARGS_1 lw a1, 4(sp);
# define POPARGS_3 POPARGS_2 lw a2, 8(sp);
# define POPARGS_4 POPARGS_3 lw a3, 12(sp);
# define POPARGS_5 POPARGS_4 /* args already in new stackframe */
# define POPARGS_6 POPARGS_5
# define POPARGS_7 POPARGS_6
# define STKSPACE 48
# define SAVESTK_0 subu sp, STKSPACE; cfi_adjust_cfa_offset(STKSPACE)
# define SAVESTK_1 SAVESTK_0
# define SAVESTK_2 SAVESTK_1
# define SAVESTK_3 SAVESTK_2
# define SAVESTK_4 SAVESTK_3
# define SAVESTK_5 lw t0, 16(sp); \
SAVESTK_0; \
sw t0, 16(sp)
# define SAVESTK_6 lw t0, 16(sp); \
lw t1, 20(sp); \
SAVESTK_0; \
sw t0, 16(sp); \
sw t1, 20(sp)
# define SAVESTK_7 lw t0, 16(sp); \
lw t1, 20(sp); \
lw t2, 24(sp); \
SAVESTK_0; \
sw t0, 16(sp); \
sw t1, 20(sp); \
sw t2, 24(sp)
# define RESTORESTK addu sp, STKSPACE; cfi_adjust_cfa_offset(-STKSPACE)
/* We use jalr rather than jal. This means that the assembler will not
automatically restore $gp (in case libc has multiple GOTs) so we must
do it manually - which we have to do anyway since we don't use .cprestore.
It also shuts up the assembler warning about not using .cprestore. */
# ifdef IS_IN_libpthread
# define CENABLE la t9, __pthread_enable_asynccancel; jalr t9;
# define CDISABLE la t9, __pthread_disable_asynccancel; jalr t9;
# elif defined IS_IN_librt
# define CENABLE la t9, __librt_enable_asynccancel; jalr t9;
# define CDISABLE la t9, __librt_disable_asynccancel; jalr t9;
# else
# define CENABLE la t9, __libc_enable_asynccancel; jalr t9;
# define CDISABLE la t9, __libc_disable_asynccancel; jalr t9;
# endif
# ifndef __ASSEMBLER__
# define SINGLE_THREAD_P \
__builtin_expect (THREAD_GETMEM (THREAD_SELF, \
header.multiple_threads) \
== 0, 1)
# else
# define SINGLE_THREAD_P(reg) \
READ_THREAD_POINTER(reg); \
lw reg, MULTIPLE_THREADS_OFFSET(reg)
#endif
#elif !defined __ASSEMBLER__
# define SINGLE_THREAD_P 1
# define NO_CANCELLATION 1
#endif

View File

@ -1,42 +0,0 @@
/* Copyright (C) 2005 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <tls.h>
/* Save the PID value. */
#define SAVE_PID \
READ_THREAD_POINTER(v1); /* Get the thread pointer. */ \
lw a2, PID_OFFSET(v1); /* Load the saved PID. */ \
subu a2, $0, a2; /* Negate it. */ \
bnez a2, 1f; /* If it was zero... */ \
lui a2, 0x8000; /* use 0x80000000 instead. */ \
1: sw a2, PID_OFFSET(v1); /* Store the temporary PID. */
/* Restore the old PID value in the parent. */
#define RESTORE_PID \
beqz v0, 1f; /* If we are the parent... */ \
READ_THREAD_POINTER(v1); /* Get the thread pointer. */ \
lw a2, PID_OFFSET(v1); /* Load the saved PID. */ \
subu a2, $0, a2; /* Re-negate it. */ \
lui a0, 0x8000; /* Load 0x80000000... */ \
bne a2, a0, 2f; /* ... compare against it... */ \
li a2, 0; /* ... use 0 instead. */ \
2: sw a2, PID_OFFSET(v1); /* Restore the PID. */ \
1:
#include <../sysdeps/unix/sysv/linux/mips/vfork.S>

View File

@ -1,4 +1,5 @@
/* Copyright (C) 1991,1995,1996,1997,1998,2002 Free Software Foundation, Inc.
/* Copyright (C) 1991,1995,1996,1997,1998,2002,2006
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
@ -19,10 +20,10 @@
#include <errno.h>
#include <unistd.h>
/* Fetch the effective group ID, real group ID, and saved-set group ID,
/* Fetch the real group ID, effective group ID, and saved-set group ID,
of the calling process. */
int
__getresgid (gid_t *egid, gid_t *rgid, gid_t *sgid)
__getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid)
{
__set_errno (ENOSYS);
return -1;

View File

@ -1,4 +1,5 @@
/* Copyright (C) 1991,1995,1996,1997,1998,2002 Free Software Foundation, Inc.
/* Copyright (C) 1991,1995,1996,1997,1998,2002,2006
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
@ -19,10 +20,10 @@
#include <errno.h>
#include <unistd.h>
/* Fetch the effective user ID, real user ID, and saved-set user ID,
/* Fetch the real user ID, effective user ID, and saved-set user ID,
of the calling process. */
int
__getresuid (uid_t *euid, uid_t *ruid, uid_t *suid)
__getresuid (uid_t *ruid, uid_t *euid, uid_t *suid)
{
__set_errno (ENOSYS);
return -1;

View File

@ -1,5 +1,5 @@
/* setresgid -- set effective group ID, real group ID, and saved-set group ID
Copyright (C) 2002 Free Software Foundation, Inc.
/* setresgid -- set real group ID, effective group ID, and saved-set group ID
Copyright (C) 2002, 2006 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
@ -20,10 +20,10 @@
#include <errno.h>
#include <unistd.h>
/* Set the effective group ID, real group ID, and saved-set group ID,
of the calling process to EGID, RGID, and SGID, respectively. */
/* Set the real group ID, effective group ID, and saved-set group ID,
of the calling process to RGID, EGID, and SGID, respectively. */
int
__setresgid (gid_t egid, gid_t rgid, gid_t sgid)
__setresgid (gid_t rgid, gid_t egid, gid_t sgid)
{
__set_errno (ENOSYS);
return -1;

View File

@ -1,5 +1,5 @@
/* setresuid -- set effective user ID, real user ID, and saved-set user ID
Copyright (C) 2002 Free Software Foundation, Inc.
/* setresuid -- set real user ID, effective user ID, and saved-set user ID
Copyright (C) 2002, 2006 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
@ -20,10 +20,10 @@
#include <errno.h>
#include <unistd.h>
/* Set the effective user ID, real user ID, and saved-set user ID,
of the calling process to EUID, RUID, and SUID, respectively. */
/* Set the real user ID, effective user ID, and saved-set user ID,
of the calling process to RUID, EUID, and SUID, respectively. */
int
__setresuid (uid_t euid, uid_t ruid, uid_t suid)
__setresuid (uid_t ruid, uid_t euid, uid_t suid)
{
__set_errno (ENOSYS);
return -1;

View File

@ -693,24 +693,24 @@ extern int setegid (__gid_t __gid) __THROW;
#endif /* Use BSD. */
#ifdef __USE_GNU
/* Fetch the effective user ID, real user ID, and saved-set user ID,
/* Fetch the real user ID, effective user ID, and saved-set user ID,
of the calling process. */
extern int getresuid (__uid_t *__euid, __uid_t *__ruid, __uid_t *__suid)
extern int getresuid (__uid_t *__ruid, __uid_t *__euid, __uid_t *__suid)
__THROW;
/* Fetch the effective group ID, real group ID, and saved-set group ID,
/* Fetch the real group ID, effective group ID, and saved-set group ID,
of the calling process. */
extern int getresgid (__gid_t *__egid, __gid_t *__rgid, __gid_t *__sgid)
extern int getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid)
__THROW;
/* Set the effective user ID, real user ID, and saved-set user ID,
of the calling process to EUID, RUID, and SUID, respectively. */
extern int setresuid (__uid_t __euid, __uid_t __ruid, __uid_t __suid)
/* Set the real user ID, effective user ID, and saved-set user ID,
of the calling process to RUID, EUID, and SUID, respectively. */
extern int setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid)
__THROW;
/* Set the effective group ID, real group ID, and saved-set group ID,
of the calling process to EGID, RGID, and SGID, respectively. */
extern int setresgid (__gid_t __egid, __gid_t __rgid, __gid_t __sgid)
/* Set the real group ID, effective group ID, and saved-set group ID,
of the calling process to RGID, EGID, and SGID, respectively. */
extern int setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid)
__THROW;
#endif

View File

@ -49,7 +49,6 @@ sparc.*-.*-.* WORDSIZE64 sparc64-@VENDOR@-@OS@
# The interface to -lm depends mostly only on cpu, not on operating system.
sparc64-.*-linux.* libm=6 GLIBC_2.2
alpha.*-.*-linux.* libm=6.1
mips.*-.*-linux.* libm=6 GLIBC_2.0 GLIBC_2.2
ia64-.*-linux.* libm=6.1 GLIBC_2.2
sh.*-.*-linux.* libm=6 GLIBC_2.2
hppa.*-.*-.* libm=6 GLIBC_2.2
@ -58,8 +57,6 @@ hppa.*-.*-.* libm=6 GLIBC_2.2
# We provide libc.so.6 for Linux kernel versions 2.0 and later.
alpha.*-.*-linux.* libc=6.1
# Working mips versions were never released between 2.0 and 2.2.
mips.*-.*-linux.* libc=6 GLIBC_2.0 GLIBC_2.2
ia64-.*-linux.* libc=6.1 GLIBC_2.2
sh.*-.*-linux.* libc=6 GLIBC_2.2
sparc64-.*-linux.* libc=6 GLIBC_2.2
@ -82,7 +79,6 @@ sparc.*-.*-linux.* ld=ld-linux.so.2
alpha.*-.*-linux.* ld=ld-linux.so.2
sh.*-.*-linux.* ld=ld-linux.so.2 GLIBC_2.2
ia64-.*-linux.* ld=ld-linux-ia64.so.2 GLIBC_2.2
mips.*-.*-linux.* ld=ld.so.1 GLIBC_2.0 GLIBC_2.2
hppa.*-.*-.* ld=ld.so.1 GLIBC_2.2
s390x-.*-linux.* ld=ld64.so.1 GLIBC_2.2
powerpc64.*-.*-linux.* ld=ld64.so.1 GLIBC_2.3
@ -93,7 +89,6 @@ x86_64-.*-linux.* ld=ld-linux-x86-64.so.2 GLIBC_2.2.5
# The -ldl interface (see <dlfcn.h>) is the same on all platforms.
alpha.*-.*-linux.* libdl=2.1
mips.*-.*-linux.* libdl=2 GLIBC_2.0 GLIBC_2.2
.*-.*-.* libdl=2
# So far the -lutil interface is the same on all platforms, except for the
@ -104,19 +99,11 @@ alpha.*-.*-linux.* libutil=1.1
# Version number 2 is used on other systems for the BIND 4.9.5 resolver
# interface.
alpha.*-.*-linux.* libresolv=2.1
mips.*-.*-linux.* libresolv=2 GLIBC_2.0 GLIBC_2.2
.*-.*-.* libresolv=2
# Interface revision of nss_* modules. This must match NSS_SHLIB_REVISION
# in nss/nsswitch.h, which determines the library names used for service
# names given in /etc/nsswitch.conf.
mips.*-.*-linux.* libnss_files=2 GLIBC_2.0 GLIBC_2.2
mips.*-.*-linux.* libnss_dns=2 GLIBC_2.0 GLIBC_2.2
mips.*-.*-linux.* libnss_compat=2 GLIBC_2.0 GLIBC_2.2
mips.*-.*-linux.* libnss_nis=2 GLIBC_2.0 GLIBC_2.2
mips.*-.*-linux.* libnss_nisplus=2 GLIBC_2.0 GLIBC_2.2
mips.*-.*-linux.* libnss_ldap=2 GLIBC_2.0 GLIBC_2.2
mips.*-.*-linux.* libnss_hesiod=2 GLIBC_2.0 GLIBC_2.2
.*-.*-.* libnss_files=2
.*-.*-.* libnss_dns=2
.*-.*-.* libnss_compat=2
@ -127,7 +114,6 @@ mips.*-.*-linux.* libnss_hesiod=2 GLIBC_2.0 GLIBC_2.2
# Version for libnsl with YP and NIS+ functions.
alpha.*-.*-linux.* libnsl=1.1
mips.*-.*-linux.* libnsl=1 GLIBC_2.0 GLIBC_2.2
.*-.*-.* libnsl=1
# This defines the shared library version numbers we will install.
@ -143,7 +129,6 @@ hppa-.*-.* libBrokenLocale=1 GLIBC_2.2
.*-.*-.* libBrokenLocale=1
# The real-time library from POSIX.1b.
mips.*-.*-linux.* librt=1 GLIBC_2.0 GLIBC_2.2
.*-.*-.* librt=1
# The asynchronous name lookup library.

View File

@ -1,5 +1,5 @@
/* getresgid -- fetch effective group ID, real group ID, and saved-set group ID
Copyright (C) 2002 Free Software Foundation, Inc.
/* getresgid -- fetch real group ID, effective group ID, and saved-set group ID
Copyright (C) 2002, 2006 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,13 +22,13 @@
#include <hurd.h>
#include <hurd/id.h>
/* Fetch the effective group ID, real group ID, and saved-set group ID,
/* Fetch the real group ID, effective group ID, and saved-set group ID,
of the calling process. */
int
__getresgid (gid_t *egid, gid_t *rgid, gid_t *sgid)
__getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid)
{
error_t err;
gid_t eff, real, saved;
gid_t real, eff, saved;
HURD_CRITICAL_BEGIN;
__mutex_lock (&_hurd_id.lock);
@ -42,8 +42,8 @@ __getresgid (gid_t *egid, gid_t *rgid, gid_t *sgid)
else
{
real = _hurd_id.aux.gids[0];
saved = _hurd_id.aux.ngids < 2 ? real :_hurd_id.aux.gids[1];
eff = _hurd_id.gen.ngids < 1 ? real : _hurd_id.gen.gids[0];
saved = _hurd_id.aux.ngids < 2 ? real : _hurd_id.aux.gids[1];
}
}
@ -53,8 +53,8 @@ __getresgid (gid_t *egid, gid_t *rgid, gid_t *sgid)
if (err)
return __hurd_fail (err);
*egid = eff;
*rgid = real;
*egid = eff;
*sgid = saved;
return 0;
}

View File

@ -1,5 +1,5 @@
/* getresuid -- fetch effective user ID, real user ID, and saved-set user ID
Copyright (C) 2002 Free Software Foundation, Inc.
/* getresuid -- fetch real user ID, effective user ID, and saved-set user ID
Copyright (C) 2002, 2006 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,13 +22,13 @@
#include <hurd.h>
#include <hurd/id.h>
/* Fetch the effective user ID, real user ID, and saved-set user ID,
/* Fetch the real user ID, effective user ID, and saved-set user ID,
of the calling process. */
int
__getresuid (uid_t *euid, uid_t *ruid, uid_t *suid)
__getresuid (uid_t *ruid, uid_t *euid, uid_t *suid)
{
error_t err;
uid_t eff, real, saved;
uid_t real, eff, saved;
HURD_CRITICAL_BEGIN;
__mutex_lock (&_hurd_id.lock);
@ -42,8 +42,8 @@ __getresuid (uid_t *euid, uid_t *ruid, uid_t *suid)
else
{
real = _hurd_id.aux.uids[0];
saved = _hurd_id.aux.nuids < 2 ? real :_hurd_id.aux.uids[1];
eff = _hurd_id.gen.nuids < 1 ? real : _hurd_id.gen.uids[0];
saved = _hurd_id.aux.nuids < 2 ? real : _hurd_id.aux.uids[1];
}
}
@ -53,8 +53,8 @@ __getresuid (uid_t *euid, uid_t *ruid, uid_t *suid)
if (err)
return __hurd_fail (err);
*euid = eff;
*ruid = real;
*euid = eff;
*suid = saved;
return 0;
}

View File

@ -1,80 +0,0 @@
/* Machine-dependent signal context structure for GNU Hurd. MIPS version.
Copyright (C) 1994,97,2001 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
#endif
#ifndef sc_mips_thread_state
/* Signal handlers are actually called:
void handler (int sig, int code, struct sigcontext *scp); */
/* State of this thread when the signal was taken. */
struct sigcontext
{
/* These first members are machine-independent. */
int sc_onstack; /* Nonzero if running on sigstack. */
__sigset_t sc_mask; /* Blocked signals to restore. */
/* MiG reply port this thread is using. */
unsigned int sc_reply_port;
/* Port this thread is doing an interruptible RPC on. */
unsigned int sc_intr_port;
/* Error code associated with this signal (interpreted as `error_t'). */
int sc_error;
/* All following members are machine-dependent. The rest of this
structure is written to be laid out identically to:
{
struct mips_thread_state ts;
struct mips_exc_state es;
struct mips_float_state fs;
}
trampoline.c knows this, so it must be changed if this changes. */
#define sc_mips_thread_state sc_gpr /* Beginning of correspondence. */
int sc_gpr[31]; /* "General" registers; [0] is r1. */
int sc_mdlo, sc_mdhi; /* Low and high multiplication results. */
int sc_pc; /* Instruction pointer. */
/* struct mips_exc_state */
#define sc_mips_exc_state sc_cause
unsigned int sc_cause; /* Machine-level trap code. */
#define SC_CAUSE_SST 0x00000044
unsigned int sc_badvaddr;
unsigned int sc_coproc_used; /* Which coprocessors the thread has used. */
#define SC_COPROC_USE_COP0 1 /* (by definition) */
#define SC_COPROC_USE_COP1 2 /* FPA */
#define SC_COPROC_USE_FPU SC_COPROC_USE_COP1
#define SC_COPROC_USE_COP2 4
#define SC_COPROC_USE_COP3 8
/* struct mips_float_state
This is only filled in if the SC_COPROC_USE_FPU bit
is set in sc_coproc_used. */
#define sc_mips_float_state sc_fpr
int sc_fpr[32]; /* FP registers. */
int sc_fpcsr; /* FPU status register. */
int sc_fpeir; /* FP exception instruction register. */
};
#endif /* sc_mips_thread_state */

View File

@ -1,132 +0,0 @@
/* Operating system support for run-time dynamic linker. MIPS specific
stuffs on Hurd.
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <hurd.h>
#include <link.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <assert.h>
#include <sysdep.h>
#include <mach/mig_support.h>
#include "../stdio-common/_itoa.h"
#include <stdarg.h>
#include <ctype.h>
#include <sys/stat.h>
#include <libintl.h>
void weak_function
abort (void)
{
_exit (127);
}
#include <string.h>
#include <mach/error.h>
#include <errorlib.h>
#undef _
#define _(x) x
/* Return a string describing the errno code in ERRNUM. */
char * weak_function
_strerror_internal (int errnum, char *buf, size_t buflen)
{
int system;
int sub;
int code;
const struct error_system *es;
extern void __mach_error_map_compat (int *);
__mach_error_map_compat (&errnum);
system = err_get_system (errnum);
sub = err_get_sub (errnum);
code = err_get_code (errnum);
if (system > err_max_system || ! __mach_error_systems[system].bad_sub)
{
const char *unk = _("Error in unknown error system: ");
const size_t unklen = strlen (unk);
char *p = buf + buflen;
*--p = '\0';
p = _itoa (errnum, p, 16, 1);
return memcpy (p - unklen, unk, unklen);
}
es = &__mach_error_systems[system];
if (sub >= es->max_sub)
return (char *) es->bad_sub;
if (code >= es->subsystem[sub].max_code)
{
const char *unk = _("Unknown error ");
const size_t unklen = strlen (unk);
char *p = buf + buflen;
size_t len = strlen (es->subsystem[sub].subsys_name);
*--p = '\0';
p = _itoa (errnum, p, 16, 1);
*p-- = ' ';
p = memcpy (p - len, es->subsystem[sub].subsys_name, len);
return memcpy (p - unklen, unk, unklen);
}
return (char *) _(es->subsystem[sub].codes[code]);
}
/* Read the whole contents of FILE into new mmap'd space with given
protections. The size of the file is returned in SIZE. */
void *
_dl_sysdep_read_whole_file (const char *file, size_t *size, int prot)
{
struct stat stat;
mach_port_t memobj_rd;
void *contents;
error_t err;
memobj_rd = __open (file, O_RDONLY, 0);
if (memobj_rd)
{
err = __io_stat ((file_t) memobj_rd, &stat);
if (err)
{
__hurd_fail (err);
contents = 0;
}
else
{
/* Map a copy of the file contents. */
contents = __mmap (0, stat.st_size, prot, MAP_COPY, memobj_rd, 0);
if (contents == (void *)-1)
contents = 0;
else
*size = stat.st_size;
}
__mach_port_deallocate (__mach_task_self (), memobj_rd);
}
else
contents = 0;
return contents;
}

View File

@ -1,97 +0,0 @@
/* Translate Mach exception codes into signal numbers. MIPS version.
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <hurd.h>
#include <hurd/signal.h>
#include <mach/exception.h>
/* Translate the Mach exception codes, as received in an `exception_raise' RPC,
into a signal number and signal subcode. */
void
_hurd_exception2signal (struct hurd_signal_detail *detail, int *signo)
{
detail->error = 0;
switch (detail->exc)
{
default:
*signo = SIGIOT;
detail->code = detail->exc;
break;
case EXC_BAD_ACCESS:
if (detail->exc_code == KERN_PROTECTION_FAILURE)
*signo = SIGSEGV;
else
*signo = SIGBUS;
detail->code = detail->exc_subcode;
detail->error = detail->exc_code;
break;
case EXC_BAD_INSTRUCTION:
*signo = SIGILL;
if (detail->exc_code == EXC_MIPS_II)
detail->code = detail->exc_subcode;
else
detail->code = 0;
break;
case EXC_ARITHMETIC:
switch (detail->exc_code)
{
case EXC_MIPS_OV: /* integer overflow */
*signo = SIGFPE;
detail->code = detail->exc_subcode;
break;
default:
*signo = SIGFPE;
detail->code = 0;
break;
case EXC_MIPS_INT:
/* Subcode is the fp_status word saved by the hardware.
Give an error code corresponding to the first bit set. */
if (detail->exc_subcode == EXC_MIPS_FLT_UNIMP)
*signo = SIGILL;
else
*signo = SIGFPE;
detail->code = detail->exc_subcode;
break;
}
break;
case EXC_EMULATION:
/* 3.0 doesn't give this one, why, I don't know. */
*signo = SIGEMT;
detail->code = 0;
break;
case EXC_SOFTWARE:
*signo = SIGEMT;
detail->code = 0;
break;
case EXC_BREAKPOINT:
*signo = SIGTRAP;
detail->code = 0;
break;
}
}

View File

@ -1,41 +0,0 @@
/* Set up a thread_state for proc_handle_exceptions. MIPS version.
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <hurd/signal.h>
#include <mach/thread_status.h>
#include <string.h>
#include <setjmp.h>
extern jmp_buf _hurd_sigthread_fault_env;
static char fault_stack[32];
static volatile void
faulted (void)
{
__longjmp (_hurd_sigthread_fault_env, 1);
}
void
_hurd_initialize_fault_recovery_state (void *state)
{
struct mips_thread_state *ts = state;
memset (ts, 0, sizeof (*ts));
ts->r29 = (int) &fault_stack[sizeof (fault_stack)];
ts->pc = (int) &faulted;
}

View File

@ -1,414 +0,0 @@
/* Initialization code run first thing by the ELF startup code. For Mips/Hurd.
Copyright (C) 1996,1997,1998,2000,01,02,03 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <hurd.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include "hurdstartup.h"
#include "set-hooks.h"
#include "hurdmalloc.h" /* XXX */
extern void __mach_init (void);
extern void __init_misc (int, char **, char **);
#ifdef USE_NONOPTION_FLAGS
extern void __getopt_clean_environment (char **);
#endif
#ifndef SHARED
extern void _dl_non_dynamic_init (void) internal_function;
#endif
extern void __libc_global_ctors (void);
unsigned int __hurd_threadvar_max;
unsigned long int __hurd_threadvar_stack_offset;
unsigned long int __hurd_threadvar_stack_mask;
int __libc_multiple_libcs attribute_hidden = 1;
int __libc_argc attribute_hidden;
char **__libc_argv attribute_hidden;
void *(*_cthread_init_routine) (void); /* Returns new SP to use. */
void (*_cthread_exit_routine) (int status) __attribute__ ((__noreturn__));
/* Things that want to be run before _hurd_init or much anything else.
Importantly, these are called before anything tries to use malloc. */
DEFINE_HOOK (_hurd_preinit_hook, (void));
static void
init1 (int argc, char *arg0, ...)
{
char **argv = &arg0;
char **envp = &argv[argc + 1];
struct hurd_startup_data *d;
__libc_argc = argc;
__libc_argv = argv;
__environ = envp;
while (*envp)
++envp;
d = (void *) ++envp;
/* If we are the bootstrap task started by the kernel,
then after the environment pointers there is no Hurd
data block; the argument strings start there. */
if ((void *) d != argv[0])
{
_hurd_init_dtable = d->dtable;
_hurd_init_dtablesize = d->dtablesize;
{
/* Check if the stack we are now on is different from
the one described by _hurd_stack_{base,size}. */
char dummy;
const vm_address_t newsp = (vm_address_t) &dummy;
if (d->stack_size != 0 && (newsp < d->stack_base ||
newsp - d->stack_base > d->stack_size))
/* The new stack pointer does not intersect with the
stack the exec server set up for us, so free that stack. */
__vm_deallocate (__mach_task_self (), d->stack_base, d->stack_size);
}
}
if (__hurd_threadvar_stack_mask == 0)
{
/* We are not using cthreads, so we will have just a single allocated
area for the per-thread variables of the main user thread. */
unsigned long int i;
__hurd_threadvar_stack_offset
= (unsigned long int) malloc (__hurd_threadvar_max *
sizeof (unsigned long int));
if (__hurd_threadvar_stack_offset == 0)
__libc_fatal ("Can't allocate single-threaded per-thread variables.");
for (i = 0; i < __hurd_threadvar_max; ++i)
((unsigned long int *) __hurd_threadvar_stack_offset)[i] = 0;
}
if ((void *) d != argv[0] && (d->portarray || d->intarray))
/* Initialize library data structures, start signal processing, etc. */
_hurd_init (d->flags, argv,
d->portarray, d->portarraysize,
d->intarray, d->intarraysize);
#ifndef SHARED
_dl_non_dynamic_init ();
#endif
__init_misc (argc, argv, __environ);
#ifdef USE_NONOPTION_FLAGS
/* This is a hack to make the special getopt in GNU libc working. */
__getopt_clean_environment (envp);
#endif
#ifdef SHARED
__libc_global_ctors ();
#endif
(void) &init1;
}
static void *
__init (int *data)
{
int argc = *data;
char **argv = (void *) (data + 1);
char **envp = &argv[argc + 1];
struct hurd_startup_data *d;
__environ = envp;
while (*envp)
++envp;
d = (void *) ++envp;
/* The user might have defined a value for this, to get more variables.
Otherwise it will be zero on startup. We must make sure it is set
properly before before cthreads initialization, so cthreads can know
how much space to leave for thread variables. */
if (__hurd_threadvar_max < _HURD_THREADVAR_MAX)
__hurd_threadvar_max = _HURD_THREADVAR_MAX;
/* After possibly switching stacks, call `init1' (above) with the user
code as the return address, and the argument data immediately above
that on the stack. */
if (_cthread_init_routine)
{
/* Initialize cthreads, which will allocate us a new stack to run on. */
void *newsp = (*_cthread_init_routine) ();
struct hurd_startup_data *od;
/* Copy the argdata from the old stack to the new one. */
newsp = memcpy (newsp - ((char *) &d[1] - (char *) data), data,
(char *) d - (char *) data);
/* Set up the Hurd startup data block immediately following
the argument and environment pointers on the new stack. */
od = (newsp + ((char *) d - (char *) data));
if ((void *) argv[0] == d)
/* We were started up by the kernel with arguments on the stack.
There is no Hurd startup data, so zero the block. */
memset (od, 0, sizeof *od);
else
/* Copy the Hurd startup data block to the new stack. */
*od = *d;
/* Push the user code address on the top of the new stack. It will
be the return address for `init1'; we will jump there with NEWSP
as the stack pointer. */
return newsp;
}
/* The argument data is just above the stack frame we will unwind by
returning. */
return (void *) data;
(void) &__init;
}
#ifdef SHARED
/* This function is called to initialize the shared C library.
It is called just before the user _start code from mips/elf/start.S,
with the stack set up as that code gets it. */
/* NOTE! The linker notices the magical name `_init' and sets the DT_INIT
pointer in the dynamic section based solely on that. It is convention
for this function to be in the `.init' section, but the symbol name is
the only thing that really matters!! */
/*void _init (int argc, ...) __attribute__ ((unused, section (".init")));*/
#if __mips64
asm ("\
.section .init,\"ax\",@progbits\n\
.align 3\n\
.globl _init\n\
.type _init,@function\n\
.ent _init\n\
_init:\n\
.set noreorder\n\
.cpload $25\n\
.set reorder\n\
dsubu $29, 8*8\n\
.cprestore 6*8\n\
sd $16, 4*8($29)\n\
sd $31, 5*8($29)\n\
jal preinit\n\
sd $28, 6*8($29)\n\
move $16, $29 # Save the old stack pointer to s0 ($16)\n\
daddu $4, $29, 4*8\n\
jal __init\n\
# Restore saved registers from the old stack.\n\
ld $28, 6*8($16)\n\
ld $31, 5*8($16)\n\
ld $16, 4*8($16)\n\
move $29, $2 # set new sp to SP\n\
call_init1:\n\
ld $4, 0($29)\n\
ld $5, 1*8($29)\n\
ld $6, 2*8($29)\n\
ld $7, 3*8($29)\n\
dla $25, init1\n\
jr $25\n\
.end _init\n\
.text\n\
");
#else
asm ("\
.section .init,\"ax\",@progbits\n\
.align 2\n\
.globl _init\n\
.type _init,@function\n\
.ent _init\n\
_init:\n\
.set noreorder\n\
.cpload $25\n\
.set reorder\n\
subu $29, 32\n\
.cprestore 24\n\
sw $16, 16($29)\n\
sw $31, 20($29)\n\
jal preinit\n\
sw $28, 24($29)\n\
move $16, $29 # Save the old stack pointer to s0 ($16)\n\
addu $4, $29, 32\n\
jal __init\n\
# Restore saved registers from the old stack.\n\
lw $28, 24($16)\n\
lw $31, 20($16)\n\
lw $16, 16($16)\n\
move $29, $2 # set new sp to SP\n\
call_init1:\n\
lw $4, 0($29)\n\
lw $5, 4($29)\n\
lw $6, 8($29)\n\
lw $7, 12($29)\n\
la $25, init1\n\
jr $25\n\
.end _init\n\
.text\n\
");
#endif
static void
preinit (void)
{
/* Initialize data structures so we can do RPCs. */
__mach_init ();
RUN_HOOK (_hurd_preinit_hook, ());
(void) &preinit;
}
void __libc_init_first (int argc, ...)
{
}
#endif
#ifndef SHARED
/* An assembler code wrapping c function __init. */
#ifdef __mips64
asm ("\
.text\n\
.align 3\n\
init:\n\
dsubu $29, 8*8\n\
sd $16, 4*8($29)\n\
sd $31, 5*8($29)\n\
move $16, $29\n\
jal __init\n\
ld $31, 5*8($16)\n\
ld $16, 4*8($16)\n\
move $29, $2 # set new sp to SP\n\
call_init1:\n\
ld $4, 0($29)\n\
ld $5, 1*8($29)\n\
ld $6, 2*8($29)\n\
ld $7, 3*8($29)\n\
dla $25, init1\n\
jr $25\n\
");
#else
asm ("\
.text\n\
.align 2\n\
init:\n\
subu $29, 32\n\
sw $16, 16($29)\n\
sw $31, 20($29)\n\
move $16, $29\n\
jal __init\n\
lw $31, 20($16)\n\
lw $16, 16($16)\n\
move $29, $2 # set new sp to SP\n\
call_init1:\n\
lw $4, 0($29)\n\
lw $5, 4($29)\n\
lw $6, 8($29)\n\
lw $7, 12($29)\n\
la $25, init1\n\
jr $25\n\
");
#endif
/* An assembler code wrapping c function ___libc_init_first.
___libc_init_first does an RPC call to flush cache to put doinit
function on the stack, so we should call __mach_init first in
this wrap. */
#ifdef __mips64
asm ("\
.text\n\
.align 3\n\
.globl __libc_init_first\n\
__libc_init_first:\n\
dsubu $29, 8\n\
sd $31, 0($29)\n\
jal __mach_init\n\
ld $4, 0($29)\n\
ld $5, 1*8($29)\n\
ld $6, 2*8($29)\n\
ld $7, 3*8($29)\n\
j ___libc_init_first\n\
");
#else
asm ("\
.text\n\
.align 2\n\
.globl __libc_init_first\n\
__libc_init_first:\n\
subu $29, 4\n\
sw $31, 0($29)\n\
jal __mach_init\n\
lw $4, 0($29)\n\
lw $5, 4($29)\n\
lw $6, 8($29)\n\
lw $7, 12($29)\n\
j ___libc_init_first\n\
");
#endif
static void
___libc_init_first (int return_addr, int argc, ...)
{
void doinit (int *data)
{
#if 0
/* This function gets called with the argument data at TOS. */
void doinit1 (int argc, ...)
{
init (&argc);
}
#endif
extern void init (int *data);
/* Push the user return address after the argument data, and then
jump to `doinit1' (above), so it is as if __libc_init_first's
caller had called `init' with the argument data already on the
stack. */
*--data = return_addr;
#ifdef __mips64
asm volatile ("ld $31, 0(%0)\n" /* Load the original return address. */
"daddu $29, %0, 8\n" /* Switch to new outermost stack. */
"move $4, $29\n"
"jr %1" : : "r" (data), "r" (&init));
#else
asm volatile ("lw $31, 0(%0)\n" /* Load the original return address. */
"addu $29, %0, 4\n" /* Switch to new outermost stack. */
"move $4, $29\n"
"jr %1" : : "r" (data), "r" (&init));
#endif
/* NOTREACHED */
}
#if 0
/* Initialize data structures so we can do RPCs. */
__mach_init ();
#endif
RUN_HOOK (_hurd_preinit_hook, ());
_hurd_startup ((void **) &argc, &doinit);
(void) &___libc_init_first;
}
#endif

View File

@ -1,127 +0,0 @@
/* Machine-dependent details of interruptible RPC messaging. Mips version.
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifdef __mips64
#define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify) \
({ \
error_t err; \
mach_port_t __rcv_name = (rcv_name); \
mach_msg_timeout_t __timeout = (timeout); \
mach_port_t __notify = (notify); \
asm (".globl _hurd_intr_rpc_msg_do_trap\n" \
".globl _hurd_intr_rpc_msg_in_trap\n" \
" move $4, %1\n" \
" move $5, %2\n" \
" move $6, %3\n" \
" move $7, %4\n" \
" move $8, %5\n" \
" move $9, %6\n" \
" move $10, %7\n" \
" dli $2, -25\n" \
"_hurd_intr_rpc_msg_do_trap: syscall\n" \
"_hurd_intr_rpc_msg_in_trap: move %0, $2\n" \
: "=r" (err) \
: "r" (msg), "r" (option), "r" (send_size), "r" (rcv_size), \
"r" (__rcv_name), "r" (__timeout), "r" (__notify) \
: "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", \
"$11", "$12", "$13", "$14", "$15", "$24", "$25", "$28"); \
err; \
})
#else
#define INTR_MSG_TRAP(msg, option, send_size, rcv_size, rcv_name, timeout, notify) \
({ \
error_t err; \
mach_port_t __rcv_name = (rcv_name); \
mach_msg_timeout_t __timeout = (timeout); \
mach_port_t __notify = (notify); \
asm (".globl _hurd_intr_rpc_msg_do_trap\n" \
".globl _hurd_intr_rpc_msg_in_trap\n" \
" move $4, %1\n" \
" move $5, %2\n" \
" move $6, %3\n" \
" move $7, %4\n" \
" move $8, %5\n" \
" move $9, %6\n" \
" move $10, %7\n" \
" li $2, -25\n" \
"_hurd_intr_rpc_msg_do_trap: syscall\n" \
"_hurd_intr_rpc_msg_in_trap: move %0, $2\n" \
: "=r" (err) \
: "r" (msg), "r" (option), "r" (send_size), "r" (rcv_size), \
"r" (__rcv_name), "r" (__timeout), "r" (__notify) \
: "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", "$9", "$10", \
"$11", "$12", "$13", "$14", "$15", "$24", "$25", "$28"); \
err; \
})
#endif
static inline void
INTR_MSG_BACK_OUT (struct mips_thread_state *state)
{
return;
}
#include "hurdfault.h"
static inline int
SYSCALL_EXAMINE (struct mips_thread_state *state, int *callno)
{
u_int32_t *p = (void *) (state->pc - 4);
int result;
if (_hurdsig_catch_memory_fault (p))
return 0;
if (result = (*p == 0x0000000c))
/* The PC is just after a `syscall' instruction.
This is a system call in progress; v0($2) holds the call number. */
*callno = state->r2;
_hurdsig_end_catch_fault ();
return result;
}
struct mach_msg_trap_args
{
/* This is the order of arguments to mach_msg_trap. */
mach_msg_header_t *msg;
mach_msg_option_t option;
mach_msg_size_t send_size;
mach_msg_size_t rcv_size;
mach_port_t rcv_name;
mach_msg_timeout_t timeout;
mach_port_t notify;
};
static inline mach_port_t
MSG_EXAMINE (struct mips_thread_state *state, int *msgid)
{
mach_msg_header_t *msg;
mach_port_t send_port;
msg = (mach_msg_header_t *) state->r4;
if (_hurdsig_catch_memory_fault (msg))
return MACH_PORT_NULL;
send_port = msg->msgh_remote_port;
*msgid = msg->msgh_id;
_hurdsig_end_catch_fault ();
return send_port;
}

View File

@ -1,41 +0,0 @@
/* Perform a `longjmp' on a `struct sigcontext'. MIPS version.
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <setjmp.h>
#include <hurd/signal.h>
#include <string.h>
void
_hurd_longjmp_sigcontext (struct sigcontext *scp, jmp_buf env, int retval)
{
scp->sc_gpr[16] = env[0].__regs[0];
scp->sc_gpr[17] = env[0].__regs[1];
scp->sc_gpr[18] = env[0].__regs[2];
scp->sc_gpr[19] = env[0].__regs[3];
scp->sc_gpr[20] = env[0].__regs[4];
scp->sc_gpr[21] = env[0].__regs[5];
scp->sc_gpr[22] = env[0].__regs[6];
scp->sc_gpr[23] = env[0].__regs[7];
scp->sc_gpr[28] = (int) env[0].__gp;
scp->sc_fp = (int) env[0].__fp;
scp->sc_sp = (int) env[0].__sp;
scp->sc_pc = (int) env[0].__pc;
scp->sc_gpr[2] = retval ?: 1;
}

View File

@ -1,45 +0,0 @@
/* Perform a `longjmp' on a Mach thread_state. MIPS version.
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <hurd/signal.h>
#include <setjmp.h>
#include <mach/thread_status.h>
/* Set up STATE to do the equivalent of `longjmp (ENV, VAL);'. */
void
_hurd_longjmp_thread_state (void *state, jmp_buf env, int val)
{
struct mips_thread_state *ts = state;
ts->r16 = env[0].__jmpbuf[0].__regs[0];
ts->r17 = env[0].__jmpbuf[0].__regs[1];
ts->r18 = env[0].__jmpbuf[0].__regs[2];
ts->r19 = env[0].__jmpbuf[0].__regs[3];
ts->r20 = env[0].__jmpbuf[0].__regs[4];
ts->r21 = env[0].__jmpbuf[0].__regs[5];
ts->r22 = env[0].__jmpbuf[0].__regs[6];
ts->r23 = env[0].__jmpbuf[0].__regs[7];
ts->r28 = (int) env[0].__jmpbuf[0].__gp;
ts->r29 = (int) env[0].__jmpbuf[0].__sp;
ts->r30 = (int) env[0].__jmpbuf[0].__fp;
ts->pc = (int) env[0].__jmpbuf[0].__pc;
ts->r2 = val ?: 1;
}

View File

@ -1,223 +0,0 @@
/* 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
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <hurd.h>
#include <hurd/signal.h>
#include <hurd/threadvar.h>
#include <stdlib.h>
#include <mach/mips/mips_instruction.h>
int
__sigreturn (struct sigcontext *scp)
{
struct hurd_sigstate *ss;
struct hurd_userlink *link = (void *) &scp[1];
mach_port_t *reply_port;
if (scp == NULL || (scp->sc_mask & _SIG_CANT_MASK))
{
errno = EINVAL;
return -1;
}
ss = _hurd_self_sigstate ();
__spin_lock (&ss->lock);
/* Remove the link on the `active resources' chain added by
_hurd_setup_sighandler. Its purpose was to make sure
that we got called; now we have, it is done. */
_hurd_userlink_unlink (link);
/* Restore the set of blocked signals, and the intr_port slot. */
ss->blocked = scp->sc_mask;
ss->intr_port = scp->sc_intr_port;
/* Check for pending signals that were blocked by the old set. */
if (ss->pending & ~ss->blocked)
{
/* There are pending signals that just became unblocked. Wake up the
signal thread to deliver them. But first, squirrel away SCP where
the signal thread will notice it if it runs another handler, and
arrange to have us called over again in the new reality. */
ss->context = scp;
__spin_unlock (&ss->lock);
__msg_sig_post (_hurd_msgport, 0, 0, __mach_task_self ());
/* If a pending signal was handled, sig_post never returned. */
__spin_lock (&ss->lock);
ss->context = NULL;
}
if (scp->sc_onstack)
{
ss->sigaltstack.ss_flags &= ~SS_ONSTACK; /* XXX threadvars */
/* XXX cannot unlock until off sigstack */
abort ();
}
else
__spin_unlock (&ss->lock);
/* Destroy the MiG reply port used by the signal handler, and restore the
reply port in use by the thread when interrupted. */
reply_port =
(mach_port_t *) __hurd_threadvar_location (_HURD_THREADVAR_MIG_REPLY);
if (*reply_port)
{
mach_port_t port = *reply_port;
/* Assigning MACH_PORT_DEAD here tells libc's mig_get_reply_port not to
get another reply port, but avoids mig_dealloc_reply_port trying to
deallocate it after the receive fails (which it will, because the
reply port will be bogus, whether we do this or not). */
*reply_port = MACH_PORT_DEAD;
__mach_port_destroy (__mach_task_self (), port);
}
*reply_port = scp->sc_reply_port;
if (scp->sc_coproc_used & SC_COPROC_USE_FPU)
{
/* Restore FPU state. */
#define restore_fpr(n) \
asm volatile ("l.d $f" #n ",%0" : : "m" (scp->sc_fpr[n]))
/* Restore floating-point registers. */
#ifdef __mips64
restore_fpr (0);
restore_fpr (1);
restore_fpr (2);
restore_fpr (3);
restore_fpr (4);
restore_fpr (5);
restore_fpr (6);
restore_fpr (7);
restore_fpr (8);
restore_fpr (9);
restore_fpr (10);
restore_fpr (11);
restore_fpr (12);
restore_fpr (13);
restore_fpr (14);
restore_fpr (15);
restore_fpr (16);
restore_fpr (17);
restore_fpr (18);
restore_fpr (19);
restore_fpr (20);
restore_fpr (21);
restore_fpr (22);
restore_fpr (23);
restore_fpr (24);
restore_fpr (25);
restore_fpr (26);
restore_fpr (27);
restore_fpr (28);
restore_fpr (29);
restore_fpr (30);
restore_fpr (31);
#else
restore_fpr (0);
restore_fpr (2);
restore_fpr (4);
restore_fpr (6);
restore_fpr (8);
restore_fpr (10);
restore_fpr (12);
restore_fpr (14);
restore_fpr (16);
restore_fpr (18);
restore_fpr (20);
restore_fpr (22);
restore_fpr (24);
restore_fpr (26);
restore_fpr (28);
restore_fpr (30);
#endif
/* Restore the floating-point control/status register ($f31). */
asm volatile ("ctc1 %0,$f31" : : "r" (scp->sc_fpcsr));
}
/* Load all the registers from the sigcontext. */
#ifdef __mips64
#define restore_gpr(n) \
asm volatile ("ld $" #n ",%0" : : "m" (scpreg->sc_gpr[n - 1]))
#else
#define restore_gpr(n) \
asm volatile ("lw $" #n ",%0" : : "m" (scpreg->sc_gpr[n - 1]))
#endif
{
register const struct sigcontext *const scpreg asm ("$1") = scp;
register int *at asm ("$1");
/* First restore the multiplication result registers. The compiler
will use some temporary registers, so we do this before restoring
the general registers. */
asm volatile ("mtlo %0" : : "r" (scpreg->sc_mdlo));
asm volatile ("mthi %0" : : "r" (scpreg->sc_mdhi));
/* In the word after the saved PC, store the saved $1 value. */
(&scpreg->sc_pc)[1] = scpreg->sc_gpr[0];
asm volatile (".set noreorder; .set noat;");
/* Restore the normal registers. */
restore_gpr (2);
restore_gpr (3);
restore_gpr (4);
restore_gpr (5);
restore_gpr (6);
restore_gpr (7);
restore_gpr (8);
restore_gpr (9);
restore_gpr (10);
restore_gpr (11);
restore_gpr (12);
restore_gpr (13);
restore_gpr (14);
restore_gpr (15);
restore_gpr (16);
restore_gpr (17);
restore_gpr (18);
restore_gpr (19);
restore_gpr (20);
restore_gpr (21);
restore_gpr (22);
restore_gpr (23);
restore_gpr (24);
restore_gpr (25);
/* Registers 26-27 are kernel-only. */
restore_gpr (28);
restore_gpr (29); /* Stack pointer. */
restore_gpr (30); /* Frame pointer. */
restore_gpr (31); /* Return address. */
at = &scpreg->sc_pc;
/* This is an emulated instruction that will find at the address in $1
two words: the PC value to restore, and the $1 value to restore. */
asm volatile (".word %0" : : "i" (op_sigreturn));
asm volatile (".set reorder; .set at;");
/* NOTREACHED */
return at; /* To prevent optimization. */
}
/* NOTREACHED */
return -1;
}
weak_alias (__sigreturn, sigreturn)

View File

@ -1,292 +0,0 @@
/* Set thread_state for sighandler, and sigcontext to recover. MIPS version.
Copyright (C) 1996, 1997, 1998, 2005 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <hurd/signal.h>
#include <hurd/userlink.h>
#include <thread_state.h>
#include <assert.h>
#include <errno.h>
#include "hurdfault.h"
#include <intr-msg.h>
struct sigcontext *
_hurd_setup_sighandler (struct hurd_sigstate *ss, __sighandler_t handler,
int signo, struct hurd_signal_detail *detail,
volatile int rpc_wait,
struct machine_thread_all_state *state)
{
__label__ trampoline, rpc_wait_trampoline, firewall;
void *volatile sigsp;
struct sigcontext *scp;
struct
{
int signo;
long int sigcode;
struct sigcontext *scp; /* Points to ctx, below. */
void *sigreturn_addr;
void *sigreturn_returns_here;
struct sigcontext *return_scp; /* Same; arg to sigreturn. */
struct sigcontext ctx;
struct hurd_userlink link;
} *stackframe;
if (ss->context)
{
/* We have a previous sigcontext that sigreturn was about
to restore when another signal arrived. We will just base
our setup on that. */
if (! _hurdsig_catch_memory_fault (ss->context))
{
memcpy (&state->basic, &ss->context->sc_mips_thread_state,
sizeof (state->basic));
memcpy (&state->exc, &ss->context->sc_mips_exc_state,
sizeof (state->exc));
state->set = (1 << MIPS_THREAD_STATE) | (1 << MIPS_EXC_STATE);
if (state->exc.coproc_state & SC_COPROC_USE_FPU)
{
memcpy (&state->fpu, &ss->context->sc_mips_float_state,
sizeof (state->fpu));
state->set |= (1 << MIPS_FLOAT_STATE);
}
}
}
if (! machine_get_basic_state (ss->thread, state))
return NULL;
/* Save the original SP in the gratuitous s0 ($16) slot.
We may need to reset the SP (the `r29' slot) to avoid clobbering an
interrupted RPC frame. */
state->basic.r16 = state->basic.r29;
if ((ss->actions[signo].sa_flags & SA_ONSTACK) &&
!(ss->sigaltstack.ss_flags & (SS_DISABLE|SS_ONSTACK)))
{
sigsp = ss->sigaltstack.ss_sp + ss->sigaltstack.ss_size;
ss->sigaltstack.ss_flags |= SS_ONSTACK;
/* XXX need to set up base of new stack for
per-thread variables, cthreads. */
}
else
sigsp = (char *) state->basic.r29;
/* Push the arguments to call `trampoline' on the stack. */
sigsp -= sizeof (*stackframe);
stackframe = sigsp;
if (_hurdsig_catch_memory_fault (stackframe))
{
/* We got a fault trying to write the stack frame.
We cannot set up the signal handler.
Returning NULL tells our caller, who will nuke us with a SIGILL. */
return NULL;
}
else
{
int ok;
extern void _hurdsig_longjmp_from_handler (void *, jmp_buf, int);
/* Add a link to the thread's active-resources list. We mark this as
the only user of the "resource", so the cleanup function will be
called by any longjmp which is unwinding past the signal frame.
The cleanup function (in sigunwind.c) will make sure that all the
appropriate cleanups done by sigreturn are taken care of. */
stackframe->link.cleanup = &_hurdsig_longjmp_from_handler;
stackframe->link.cleanup_data = &stackframe->ctx;
stackframe->link.resource.next = NULL;
stackframe->link.resource.prevp = NULL;
stackframe->link.thread.next = ss->active_resources;
stackframe->link.thread.prevp = &ss->active_resources;
if (stackframe->link.thread.next)
stackframe->link.thread.next->thread.prevp
= &stackframe->link.thread.next;
ss->active_resources = &stackframe->link;
/* Set up the arguments for the signal handler. */
stackframe->signo = signo;
stackframe->sigcode = detail->code;
stackframe->scp = stackframe->return_scp = scp = &stackframe->ctx;
stackframe->sigreturn_addr = &__sigreturn;
stackframe->sigreturn_returns_here = &&firewall; /* Crash on return. */
/* Set up the sigcontext from the current state of the thread. */
scp->sc_onstack = ss->sigaltstack.ss_flags & SS_ONSTACK ? 1 : 0;
/* struct sigcontext is laid out so that starting at sc_gpr
mimics a struct mips_thread_state. */
memcpy (&scp->sc_mips_thread_state,
&state->basic, sizeof (state->basic));
/* struct sigcontext is laid out so that starting at sc_cause
mimics a struct mips_exc_state. */
ok = machine_get_state (ss->thread, state, MIPS_EXC_STATE,
&state->exc, &scp->sc_cause,
sizeof (state->exc));
if (ok && (scp->sc_coproc_used & SC_COPROC_USE_FPU))
/* struct sigcontext is laid out so that starting at sc_fpr
mimics a struct mips_float_state. This state
is only meaningful if the coprocessor was used. */
ok = machine_get_state (ss->thread, state, MIPS_FLOAT_STATE,
&state->fpu, &scp->sc_mips_float_state,
sizeof (state->fpu));
_hurdsig_end_catch_fault ();
if (! ok)
return NULL;
}
/* Modify the thread state to call the trampoline code on the new stack. */
if (rpc_wait)
{
/* The signalee thread was blocked in a mach_msg_trap system call,
still waiting for a reply. We will have it run the special
trampoline code which retries the message receive before running
the signal handler.
To do this we change the OPTION argument in its registers to
enable only message reception, since the request message has
already been sent. */
/* The system call arguments are stored in consecutive registers
starting with a0 ($4). */
struct mach_msg_trap_args *args = (void *) &state->basic.r4;
if (_hurdsig_catch_memory_fault (args))
{
/* Faulted accessing ARGS. Bomb. */
return NULL;
}
assert (args->option & MACH_RCV_MSG);
/* Disable the message-send, since it has already completed. The
calls we retry need only wait to receive the reply message. */
args->option &= ~MACH_SEND_MSG;
/* Limit the time to receive the reply message, in case the server
claimed that `interrupt_operation' succeeded but in fact the RPC
is hung. */
args->option |= MACH_RCV_TIMEOUT;
args->timeout = _hurd_interrupted_rpc_timeout;
_hurdsig_end_catch_fault ();
state->basic.pc = (int) &&rpc_wait_trampoline;
/* The reply-receiving trampoline code runs initially on the original
user stack. We pass it the signal stack pointer in s4 ($20). */
state->basic.r29 = state->basic.r16; /* Restore mach_msg syscall SP. */
state->basic.r20 = (int) sigsp;
/* After doing the message receive, the trampoline code will need to
update the v0 ($2) value to be restored by sigreturn. To simplify
the assembly code, we pass the address of its slot in SCP to the
trampoline code in s5 ($21). */
state->basic.r21 = (int) &scp->sc_gpr[1];
/* We must preserve the mach_msg_trap args in a0..t2 ($4..$10).
Pass the handler args to the trampoline code in s1..s3 ($17..$19). */
state->basic.r17 = signo;
state->basic.r18 = detail->code;
state->basic.r19 = (int) scp;
}
else
{
state->basic.pc = (int) &&trampoline;
state->basic.r29 = (int) sigsp;
state->basic.r4 = signo;
state->basic.r5 = detail->code;
state->basic.r6 = (int) scp;
}
/* We pass the handler function to the trampoline code in s6 ($22). */
state->basic.r22 = (int) handler;
/* In the callee-saved register s0 ($16), we save the SCP value to pass
to __sigreturn after the handler returns. */
state->basic.r16 = (int) scp;
return scp;
/* The trampoline code follows. This is not actually executed as part of
this function, it is just convenient to write it that way. */
rpc_wait_trampoline:
/* This is the entry point when we have an RPC reply message to receive
before running the handler. The MACH_MSG_SEND bit has already been
cleared in the OPTION argument in our registers. For our convenience,
$3 points to the sc_gpr[1] member of the sigcontext (saved v0 ($2)). */
asm volatile
(".set noat; .set noreorder; .set nomacro\n"
/* Retry the interrupted mach_msg system call. */
#ifdef __mips64
"dli $2, -25\n" /* mach_msg_trap */
#else
"li $2, -25\n" /* mach_msg_trap */
#endif
"syscall\n"
/* When the sigcontext was saved, v0 was MACH_RCV_INTERRUPTED. But
now the message receive has completed and the original caller of
the RPC (i.e. the code running when the signal arrived) needs to
see the final return value of the message receive in v0. So
store the new v0 value into the sc_gpr[1] member of the sigcontext
(whose address is in s5 to make this code simpler). */
#ifdef __mips64
"sd $2, ($21)\n"
#else
"sw $2, ($21)\n"
#endif
/* Since the argument registers needed to have the mach_msg_trap
arguments, we've stored the arguments to the handler function
in registers s1..s3 ($17..$19). */
"move $4, $17\n"
"move $5, $18\n"
"move $6, $19\n"
/* Switch to the signal stack. */
"move $29, $20\n");
trampoline:
/* Entry point for running the handler normally. The arguments to the
handler function are already in the standard registers:
a0 SIGNO
a1 SIGCODE
a2 SCP
*/
asm volatile
("move $25, $22\n" /* Copy s6 to t9 for MIPS ABI. */
"jal $25; nop\n" /* Call the handler function. */
/* Call __sigreturn (SCP); this cannot return. */
#ifdef __mips64
"dla $1,%0\n"
#else
"la $1,%0\n"
#endif
"j $1\n"
"move $4, $16" /* Set up arg from saved SCP in delay slot. */
: : "i" (&__sigreturn));
/* NOTREACHED */
asm volatile (".set reorder; .set at; .set macro");
firewall:
asm volatile ("hlt: j hlt");
return NULL;
}

View File

@ -1,5 +1,5 @@
/* setresgid -- set effective group ID, real group ID, and saved-set group ID
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
/* setresgid -- set real group ID, effective group ID, and saved-set group ID
Copyright (C) 2002, 2005, 2006 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,10 +22,10 @@
#include <hurd.h>
#include <hurd/id.h>
/* Set the effective group ID, real group ID, and saved-set group ID,
of the calling process to EGID, RGID, and SGID, respectively. */
/* Set the real group ID, effective group ID, and saved-set group ID,
of the calling process to RGID, EGID, and SGID, respectively. */
int
__setresgid (gid_t egid, gid_t rgid, gid_t sgid)
__setresgid (gid_t rgid, gid_t egid, gid_t sgid)
{
auth_t newauth;
error_t err;

View File

@ -1,5 +1,5 @@
/* setresuid -- set effective user ID, real user ID, and saved-set user ID
Copyright (C) 2002, 2005 Free Software Foundation, Inc.
/* setresuid -- set real user ID, effective user ID, and saved-set user ID
Copyright (C) 2002, 2005, 2006 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,10 +22,10 @@
#include <hurd.h>
#include <hurd/id.h>
/* Set the effective user ID, real user ID, and saved-set user ID,
of the calling process to EUID, RUID, and SUID, respectively. */
/* Set the real user ID, effective user ID, and saved-set user ID,
of the calling process to RUID, EUID, and SUID, respectively. */
int
__setresuid (uid_t euid, uid_t ruid, uid_t suid)
__setresuid (uid_t ruid, uid_t euid, uid_t suid)
{
auth_t newauth;
error_t err;

View File

@ -1,3 +0,0 @@
ifeq ($(subdir),gnulib)
sysdep_routines += cacheflush
endif

View File

@ -1,44 +0,0 @@
/* Flush the insn cache after GCC writes a closure on the stack. Mach/MIPS.
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <mach.h>
#include <mach/vm_attributes.h>
/* Stupid name, but this is what GCC generates (config/mips/mips.h). */
void
cacheflush (void *addr, unsigned size, int flag)
{
vm_machine_attribute_val_t val;
switch (flag)
{
case 0: /* ? */
val = MATTR_VAL_DCACHE_FLUSH;
case 1: /* This is the only value GCC uses. */
val = MATTR_VAL_ICACHE_FLUSH;
break;
default:
val = MATTR_VAL_CACHE_FLUSH;
}
__vm_machine_attribute (__mach_task_self (),
(vm_address_t) addr, size,
MATTR_CACHE,
&val);
}

View File

@ -1,92 +0,0 @@
/* Machine-specific definition for spin locks. MIPS version.
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _MACHINE_LOCK_H
#define _MACHINE_LOCK_H
/* To get the TAS pseudo-instruction. */
#include <mach/mips/mips_instruction.h>
/* The type of a spin lock variable. */
typedef __volatile int __spin_lock_t;
/* Value to initialize `__spin_lock_t' variables to. */
#define __SPIN_LOCK_INITIALIZER 0
#ifndef _EXTERN_INLINE
#define _EXTERN_INLINE extern __inline
#endif
/* Unlock LOCK. */
_EXTERN_INLINE void
__spin_unlock (__spin_lock_t *__lock)
{
*__lock = 0;
}
/* Try to lock LOCK; return nonzero if we locked it, zero if another has. */
_EXTERN_INLINE int
__spin_try_lock (register __spin_lock_t *__lock)
{
#if (__mips >= 2)
int __rtn;
__asm__ __volatile (".set noreorder");
#if (__mips64)
__asm__ __volatile ("lld %0,0(%1)" : "=r" (__rtn) : "r" (__lock));
#else
__asm__ __volatile ("ll %0,0(%1)" : "=r" (__rtn) : "r" (__lock));
#endif
if (__rtn)
return 0;
__asm__ __volatile ("move %0,%1" : "=r" (__rtn) : "r" (__lock));
#if (__mips64)
__asm__ __volatile ("scd %0,0(%1)" : "=r" (__rtn) : "r" (__lock));
#else
__asm__ __volatile ("sc %0,0(%1)" : "=r" (__rtn) : "r" (__lock));
#endif
__asm__ __volatile (".set reorder");
return __rtn;
#else
register int __rtn __asm__ ("a0");
/* Use the Mach microkernel's emulated TAS pseudo-instruction. */
__asm__ __volatile (".set noreorder");
__asm__ __volatile (".word %1" : "=r" (__rtn) : "i" (op_tas), "0" (__lock));
__asm__ __volatile ("nop");
__asm__ __volatile (".set reorder");
return __rtn ^ (int) __lock;
#endif
}
/* Return nonzero if LOCK is locked. */
_EXTERN_INLINE int
__spin_lock_locked (__spin_lock_t *__lock)
{
return *__lock != 0;
}
#endif /* machine-lock.h */

View File

@ -1,38 +0,0 @@
/* Machine-specific function to return the stack pointer. MIPS version.
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _MACHINE_SP_H
#define _MACHINE_SP_H
/* Return the current stack pointer. */
#ifndef _EXTERN_INLINE
#define _EXTERN_INLINE extern __inline
#endif
_EXTERN_INLINE void *
__thread_stack_pointer (void)
{
void *__sp__;
__asm__ ("move %0,$29" : "=r" (__sp__));
return __sp__;
}
#endif /* machine-sp.h */

View File

@ -1,48 +0,0 @@
/* 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sysdep.h>
#ifdef PIC
.option pic2
#endif
ENTRY (syscall)
move v0, a0 /* Load system call number from first arg. */
move a0, a1 /* Move the next three args up a register. */
move a1, a2
move a2, a3
/* Load the remaining possible args (up to 11) from the stack. */
#ifdef __mips64
ld t0,4*8(sp)
ld t1,5*8(sp)
ld t2,6*8(sp)
ld t3,7*8(sp)
ld t4,8*8(sp)
ld t5,9*8(sp)
ld t6,10*8(sp)
#else
lw t0,4*4(sp)
lw t1,5*4(sp)
lw t2,6*4(sp)
lw t3,7*4(sp)
lw t4,8*4(sp)
lw t5,9*4(sp)
lw t6,10*4(sp)
#endif
syscall /* Do the system call. */
j ra /* Return to caller. */

View File

@ -1,83 +0,0 @@
/* 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#define LOSE asm volatile ("1: b 1b")
#define START_MACHDEP asm ("\
.text\n\
.globl _start\n\
.ent _start\n\
_start:\n\
# Put initial SP in a0.\n\
move $4, $29\n\
# Jump to _start0; don't return.\n\
j _start0\n\
.end _start\n\
");
#define START_ARGS int *entry_sp
#define SNARF_ARGS(argc, argv, envp) \
do \
{ \
register char **p; \
\
argc = *entry_sp; \
argv = (char **) (entry_sp + 1); \
p = argv; \
while (*p++ != NULL) \
; \
if (p >= (char **) argv[0]) \
--p; \
envp = p; \
} while (0)
#define CALL_WITH_SP(fn, sp) \
({ register int __fn = fn, __sp = (int) sp; \
asm volatile ("move $sp,%0; j %1" : : "r" (__sp), "r" (__fn));})
#define RETURN_TO(sp, pc, retval) \
asm volatile ("move $29, %0; move $2, %2; move $25, %1; jr $25" \
: : "r" (sp), "r" (pc), "r" (retval))
#define STACK_GROWTH_DOWN
#include <syscall.h>
#if defined (__ASSEMBLER__)
#define ALIGN 2
#define MOVE(x,y) move y , x
#define SYSCALL(name, args) \
.globl syscall_error; \
kernel_trap(name,SYS_##name,args); \
beq $1,$0,1f; \
j syscall_error; \
1:
#define SYSCALL__(name, args) \
.globl syscall_error; \
kernel_trap(__##name,SYS_##name,args); \
beq $1,$0,1f; \
j syscall_error; \
1:
#define ret j ra; nop
#endif
#include <sysdeps/mach/sysdep.h>

View File

@ -1,42 +0,0 @@
/* Mach thread state definitions for machine-independent code. MIPS version.
Copyright (C) 1996, 1997, 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#define MACHINE_THREAD_STATE_FLAVOR MIPS_THREAD_STATE
#define MACHINE_THREAD_STATE_COUNT MIPS_THREAD_STATE_COUNT
#ifdef __PIC__
#define MACHINE_THREAD_STATE_SET_PC(ts, pc) \
((ts)->PC = (ts)->r25 = (unsigned long int) (pc))
#endif
#define machine_thread_state mips_thread_state
#define PC pc
#define SP r29
#define SYSRETURN r2
struct machine_thread_all_state
{
int set; /* Mask of bits (1 << FLAVOR). */
struct mips_thread_state basic;
struct mips_exc_state exc;
struct mips_float_state fpu;
};
#include <sysdeps/mach/thread_state.h>

View File

@ -1,4 +0,0 @@
*.gz *.Z *.tar *.tgz
=*
TODO COPYING* AUTHORS copyr-* copying.*
glibc-*

View File

@ -1,3 +0,0 @@
# MIPS uses IEEE 754 floating point.
ieee754/flt-32
ieee754/dbl-64

View File

@ -1,12 +0,0 @@
ifeq ($(subdir),misc)
sysdep_headers += regdef.h fpregdef.h sys/regdef.h sys/fpregdef.h \
sys/asm.h sgidefs.h
endif
ifeq ($(subdir),setjmp)
sysdep_routines += setjmp_aux
endif
ifeq ($(subdir),rt)
librt-sysdep_routines += rt-sysdep
endif

View File

@ -1,84 +0,0 @@
/* Copyright (C) 1992, 1995, 1997, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Brendan Kehoe (brendan@zen.org).
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <setjmp.h>
#include <stdlib.h>
#undef __longjmp
#ifndef __GNUC__
#error This file uses GNU C extensions; you must compile with GCC.
#endif
void
__longjmp (env, val_arg)
__jmp_buf env;
int val_arg;
{
/* gcc 1.39.19 miscompiled the longjmp routine (as it did setjmp before
the hack around it); force it to use $a1 for the longjmp value.
Without this it saves $a1 in a register which gets clobbered
along the way. */
register int val asm ("a1");
/* Pull back the floating point callee-saved registers. */
asm volatile ("l.d $f20, %0" : : "m" (env[0].__fpregs[0]));
asm volatile ("l.d $f22, %0" : : "m" (env[0].__fpregs[1]));
asm volatile ("l.d $f24, %0" : : "m" (env[0].__fpregs[2]));
asm volatile ("l.d $f26, %0" : : "m" (env[0].__fpregs[3]));
asm volatile ("l.d $f28, %0" : : "m" (env[0].__fpregs[4]));
asm volatile ("l.d $f30, %0" : : "m" (env[0].__fpregs[5]));
/* Get and reconstruct the floating point csr. */
asm volatile ("lw $2, %0" : : "m" (env[0].__fpc_csr));
asm volatile ("ctc1 $2, $31");
/* Get the GP. */
asm volatile ("lw $gp, %0" : : "m" (env[0].__gp));
/* Get the callee-saved registers. */
asm volatile ("lw $16, %0" : : "m" (env[0].__regs[0]));
asm volatile ("lw $17, %0" : : "m" (env[0].__regs[1]));
asm volatile ("lw $18, %0" : : "m" (env[0].__regs[2]));
asm volatile ("lw $19, %0" : : "m" (env[0].__regs[3]));
asm volatile ("lw $20, %0" : : "m" (env[0].__regs[4]));
asm volatile ("lw $21, %0" : : "m" (env[0].__regs[5]));
asm volatile ("lw $22, %0" : : "m" (env[0].__regs[6]));
asm volatile ("lw $23, %0" : : "m" (env[0].__regs[7]));
/* Get the PC. */
asm volatile ("lw $25, %0" : : "m" (env[0].__pc));
/* Restore the stack pointer and the FP. They have to be restored
last and in a single asm as gcc, depending on options used, may
use either of them to access env. */
asm volatile ("lw $29, %0\n\t"
"lw $30, %1\n\t" : : "m" (env[0].__sp), "m" (env[0].__fp));
/* Give setjmp 1 if given a 0, or what they gave us if non-zero. */
if (val == 0)
asm volatile ("li $2, 1");
else
asm volatile ("move $2, %0" : : "r" (val));
asm volatile ("jr $25");
/* Avoid `volatile function does return' warnings. */
for (;;);
}

View File

@ -1,2 +0,0 @@
/* An instruction which should crash any program is a breakpoint. */
#define ABORT_INSTRUCTION asm ("break 255")

View File

@ -1,122 +0,0 @@
/* MIPS2 __mpn_add_n -- Add two limb vectors of the same length > 0 and
store sum in a third limb vector.
Copyright (C) 1995, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at your
option) any later version.
The GNU MP 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 Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP 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 <sysdep.h>
/* INPUT PARAMETERS
res_ptr $4
s1_ptr $5
s2_ptr $6
size $7
*/
#ifdef __PIC__
.option pic2
#endif
ENTRY (__mpn_add_n)
.set noreorder
#ifdef __PIC__
.cpload t9
#endif
.set nomacro
lw $10,0($5)
lw $11,0($6)
addiu $7,$7,-1
and $9,$7,4-1 /* number of limbs in first loop */
beq $9,$0,L(L0) /* if multiple of 4 limbs, skip first loop */
move $2,$0
subu $7,$7,$9
L(Loop0): addiu $9,$9,-1
lw $12,4($5)
addu $11,$11,$2
lw $13,4($6)
sltu $8,$11,$2
addu $11,$10,$11
sltu $2,$11,$10
sw $11,0($4)
or $2,$2,$8
addiu $5,$5,4
addiu $6,$6,4
move $10,$12
move $11,$13
bne $9,$0,L(Loop0)
addiu $4,$4,4
L(L0): beq $7,$0,L(end)
nop
L(Loop): addiu $7,$7,-4
lw $12,4($5)
addu $11,$11,$2
lw $13,4($6)
sltu $8,$11,$2
addu $11,$10,$11
sltu $2,$11,$10
sw $11,0($4)
or $2,$2,$8
lw $10,8($5)
addu $13,$13,$2
lw $11,8($6)
sltu $8,$13,$2
addu $13,$12,$13
sltu $2,$13,$12
sw $13,4($4)
or $2,$2,$8
lw $12,12($5)
addu $11,$11,$2
lw $13,12($6)
sltu $8,$11,$2
addu $11,$10,$11
sltu $2,$11,$10
sw $11,8($4)
or $2,$2,$8
lw $10,16($5)
addu $13,$13,$2
lw $11,16($6)
sltu $8,$13,$2
addu $13,$12,$13
sltu $2,$13,$12
sw $13,12($4)
or $2,$2,$8
addiu $5,$5,16
addiu $6,$6,16
bne $7,$0,L(Loop)
addiu $4,$4,16
L(end): addu $11,$11,$2
sltu $8,$11,$2
addu $11,$10,$11
sltu $2,$11,$10
sw $11,0($4)
j $31
or $2,$2,$8
.end __mpn_add_n

View File

@ -1,99 +0,0 @@
/* MIPS __mpn_addmul_1 -- Multiply a limb vector with a single limb and
add the product to a second limb vector.
Copyright (C) 1995, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at your
option) any later version.
The GNU MP 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 Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP 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 <sysdep.h>
/* INPUT PARAMETERS
res_ptr $4
s1_ptr $5
size $6
s2_limb $7
*/
#ifdef __PIC__
.option pic2
#endif
ENTRY (__mpn_addmul_1)
.set noreorder
#ifdef __PIC__
.cpload t9
#endif
.set nomacro
/* warm up phase 0 */
lw $8,0($5)
/* warm up phase 1 */
addiu $5,$5,4
multu $8,$7
addiu $6,$6,-1
beq $6,$0,L(LC0)
move $2,$0 /* zero cy2 */
addiu $6,$6,-1
beq $6,$0,L(LC1)
lw $8,0($5) /* load new s1 limb as early as possible */
L(Loop): lw $10,0($4)
mflo $3
mfhi $9
addiu $5,$5,4
addu $3,$3,$2 /* add old carry limb to low product limb */
multu $8,$7
lw $8,0($5) /* load new s1 limb as early as possible */
addiu $6,$6,-1 /* decrement loop counter */
sltu $2,$3,$2 /* carry from previous addition -> $2 */
addu $3,$10,$3
sltu $10,$3,$10
addu $2,$2,$10
sw $3,0($4)
addiu $4,$4,4
bne $6,$0,L(Loop) /* should be "bnel" */
addu $2,$9,$2 /* add high product limb and carry from addition */
/* cool down phase 1 */
L(LC1): lw $10,0($4)
mflo $3
mfhi $9
addu $3,$3,$2
sltu $2,$3,$2
multu $8,$7
addu $3,$10,$3
sltu $10,$3,$10
addu $2,$2,$10
sw $3,0($4)
addiu $4,$4,4
addu $2,$9,$2 /* add high product limb and carry from addition */
/* cool down phase 0 */
L(LC0): lw $10,0($4)
mflo $3
mfhi $9
addu $3,$3,$2
sltu $2,$3,$2
addu $3,$10,$3
sltu $10,$3,$10
addu $2,$2,$10
sw $3,0($4)
j $31
addu $2,$9,$2 /* add high product limb and carry from addition */
END (__mpn_addmul_1)

View File

@ -1,303 +0,0 @@
/* Low-level functions for atomic operations. Mips version.
Copyright (C) 2005 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _MIPS_BITS_ATOMIC_H
#define _MIPS_BITS_ATOMIC_H 1
#include <inttypes.h>
#include <sgidefs.h>
typedef int32_t atomic32_t;
typedef uint32_t uatomic32_t;
typedef int_fast32_t atomic_fast32_t;
typedef uint_fast32_t uatomic_fast32_t;
typedef int64_t atomic64_t;
typedef uint64_t uatomic64_t;
typedef int_fast64_t atomic_fast64_t;
typedef uint_fast64_t uatomic_fast64_t;
typedef intptr_t atomicptr_t;
typedef uintptr_t uatomicptr_t;
typedef intmax_t atomic_max_t;
typedef uintmax_t uatomic_max_t;
#if _MIPS_SIM == _ABIO32
#define MIPS_PUSH_MIPS2 ".set mips2\n\t"
#else
#define MIPS_PUSH_MIPS2
#endif
/* See the comments in <sys/asm.h> about the use of the sync instruction. */
#ifndef MIPS_SYNC
# define MIPS_SYNC sync
#endif
#define MIPS_SYNC_STR_2(X) #X
#define MIPS_SYNC_STR_1(X) MIPS_SYNC_STR_2(X)
#define MIPS_SYNC_STR MIPS_SYNC_STR_1(MIPS_SYNC)
/* Compare and exchange. For all of the "xxx" routines, we expect a
"__prev" and a "__cmp" variable to be provided by the enclosing scope,
in which values are returned. */
#define __arch_compare_and_exchange_xxx_8_int(mem, newval, oldval, rel, acq) \
(abort (), __prev = __cmp = 0)
#define __arch_compare_and_exchange_xxx_16_int(mem, newval, oldval, rel, acq) \
(abort (), __prev = __cmp = 0)
#define __arch_compare_and_exchange_xxx_32_int(mem, newval, oldval, rel, acq) \
__asm__ __volatile__ ( \
".set push\n\t" \
MIPS_PUSH_MIPS2 \
rel "\n" \
"1:\t" \
"ll %0,%4\n\t" \
"move %1,$0\n\t" \
"bne %0,%2,2f\n\t" \
"move %1,%3\n\t" \
"sc %1,%4\n\t" \
"beqz %1,1b\n" \
acq "\n\t" \
".set pop\n" \
"2:\n\t" \
: "=&r" (__prev), "=&r" (__cmp) \
: "r" (oldval), "r" (newval), "m" (*mem) \
: "memory")
#if _MIPS_SIM == _ABIO32
/* We can't do an atomic 64-bit operation in O32. */
#define __arch_compare_and_exchange_xxx_64_int(mem, newval, oldval, rel, acq) \
(abort (), __prev = __cmp = 0)
#else
#define __arch_compare_and_exchange_xxx_64_int(mem, newval, oldval, rel, acq) \
__asm__ __volatile__ ("\n" \
".set push\n\t" \
MIPS_PUSH_MIPS2 \
rel "\n" \
"1:\t" \
"lld %0,%4\n\t" \
"move %1,$0\n\t" \
"bne %0,%2,2f\n\t" \
"move %1,%3\n\t" \
"scd %1,%4\n\t" \
"beqz %1,1b\n" \
acq "\n\t" \
".set pop\n" \
"2:\n\t" \
: "=&r" (__prev), "=&r" (__cmp) \
: "r" (oldval), "r" (newval), "m" (*mem) \
: "memory")
#endif
/* For all "bool" routines, we return FALSE if exchange succesful. */
#define __arch_compare_and_exchange_bool_8_int(mem, new, old, rel, acq) \
({ typeof (*mem) __prev; int __cmp; \
__arch_compare_and_exchange_xxx_8_int(mem, new, old, rel, acq); \
!__cmp; })
#define __arch_compare_and_exchange_bool_16_int(mem, new, old, rel, acq) \
({ typeof (*mem) __prev; int __cmp; \
__arch_compare_and_exchange_xxx_16_int(mem, new, old, rel, acq); \
!__cmp; })
#define __arch_compare_and_exchange_bool_32_int(mem, new, old, rel, acq) \
({ typeof (*mem) __prev; int __cmp; \
__arch_compare_and_exchange_xxx_32_int(mem, new, old, rel, acq); \
!__cmp; })
#define __arch_compare_and_exchange_bool_64_int(mem, new, old, rel, acq) \
({ typeof (*mem) __prev; int __cmp; \
__arch_compare_and_exchange_xxx_64_int(mem, new, old, rel, acq); \
!__cmp; })
/* For all "val" routines, return the old value whether exchange
successful or not. */
#define __arch_compare_and_exchange_val_8_int(mem, new, old, rel, acq) \
({ typeof (*mem) __prev; int __cmp; \
__arch_compare_and_exchange_xxx_8_int(mem, new, old, rel, acq); \
(typeof (*mem))__prev; })
#define __arch_compare_and_exchange_val_16_int(mem, new, old, rel, acq) \
({ typeof (*mem) __prev; int __cmp; \
__arch_compare_and_exchange_xxx_16_int(mem, new, old, rel, acq); \
(typeof (*mem))__prev; })
#define __arch_compare_and_exchange_val_32_int(mem, new, old, rel, acq) \
({ typeof (*mem) __prev; int __cmp; \
__arch_compare_and_exchange_xxx_32_int(mem, new, old, rel, acq); \
(typeof (*mem))__prev; })
#define __arch_compare_and_exchange_val_64_int(mem, new, old, rel, acq) \
({ typeof (*mem) __prev; int __cmp; \
__arch_compare_and_exchange_xxx_64_int(mem, new, old, rel, acq); \
(typeof (*mem))__prev; })
/* Compare and exchange with "acquire" semantics, ie barrier after. */
#define atomic_compare_and_exchange_bool_acq(mem, new, old) \
__atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \
mem, new, old, "", MIPS_SYNC_STR)
#define atomic_compare_and_exchange_val_acq(mem, new, old) \
__atomic_val_bysize (__arch_compare_and_exchange_val, int, \
mem, new, old, "", MIPS_SYNC_STR)
/* Compare and exchange with "release" semantics, ie barrier before. */
#define atomic_compare_and_exchange_bool_rel(mem, new, old) \
__atomic_bool_bysize (__arch_compare_and_exchange_bool, int, \
mem, new, old, MIPS_SYNC_STR, "")
#define atomic_compare_and_exchange_val_rel(mem, new, old) \
__atomic_val_bysize (__arch_compare_and_exchange_val, int, \
mem, new, old, MIPS_SYNC_STR, "")
/* Atomic exchange (without compare). */
#define __arch_exchange_xxx_8_int(mem, newval, rel, acq) \
(abort (), 0)
#define __arch_exchange_xxx_16_int(mem, newval, rel, acq) \
(abort (), 0)
#define __arch_exchange_xxx_32_int(mem, newval, rel, acq) \
({ typeof (*mem) __prev; int __cmp; \
__asm__ __volatile__ ("\n" \
".set push\n\t" \
MIPS_PUSH_MIPS2 \
rel "\n" \
"1:\t" \
"ll %0,%3\n\t" \
"move %1,%2\n\t" \
"sc %1,%3\n\t" \
"beqz %1,1b\n" \
acq "\n\t" \
".set pop\n" \
"2:\n\t" \
: "=&r" (__prev), "=&r" (__cmp) \
: "r" (newval), "m" (*mem) \
: "memory"); \
__prev; })
#if _MIPS_SIM == _ABIO32
/* We can't do an atomic 64-bit operation in O32. */
#define __arch_exchange_xxx_64_int(mem, newval, rel, acq) \
(abort (), 0)
#else
#define __arch_exchange_xxx_64_int(mem, newval, rel, acq) \
({ typeof (*mem) __prev; int __cmp; \
__asm__ __volatile__ ("\n" \
".set push\n\t" \
MIPS_PUSH_MIPS2 \
rel "\n" \
"1:\n" \
"lld %0,%3\n\t" \
"move %1,%2\n\t" \
"scd %1,%3\n\t" \
"beqz %1,1b\n" \
acq "\n\t" \
".set pop\n" \
"2:\n\t" \
: "=&r" (__prev), "=&r" (__cmp) \
: "r" (newval), "m" (*mem) \
: "memory"); \
__prev; })
#endif
#define atomic_exchange_acq(mem, value) \
__atomic_val_bysize (__arch_exchange_xxx, int, mem, value, "", MIPS_SYNC_STR)
#define atomic_exchange_rel(mem, value) \
__atomic_val_bysize (__arch_exchange_xxx, int, mem, value, MIPS_SYNC_STR, "")
/* Atomically add value and return the previous (unincremented) value. */
#define __arch_exchange_and_add_8_int(mem, newval, rel, acq) \
(abort (), (typeof(*mem)) 0)
#define __arch_exchange_and_add_16_int(mem, newval, rel, acq) \
(abort (), (typeof(*mem)) 0)
#define __arch_exchange_and_add_32_int(mem, value, rel, acq) \
({ typeof (*mem) __prev; int __cmp; \
__asm__ __volatile__ ("\n" \
".set push\n\t" \
MIPS_PUSH_MIPS2 \
rel "\n" \
"1:\t" \
"ll %0,%3\n\t" \
"addu %1,%0,%2\n\t" \
"sc %1,%3\n\t" \
"beqz %1,1b\n" \
acq "\n\t" \
".set pop\n" \
"2:\n\t" \
: "=&r" (__prev), "=&r" (__cmp) \
: "r" (value), "m" (*mem) \
: "memory"); \
__prev; })
#if _MIPS_SIM == _ABIO32
/* We can't do an atomic 64-bit operation in O32. */
#define __arch_exchange_and_add_64_int(mem, value, rel, acq) \
(abort (), (typeof(*mem)) 0)
#else
#define __arch_exchange_and_add_64_int(mem, value, rel, acq) \
({ typeof (*mem) __prev; int __cmp; \
__asm__ __volatile__ ( \
".set push\n\t" \
MIPS_PUSH_MIPS2 \
rel "\n" \
"1:\t" \
"lld %0,%3\n\t" \
"daddu %1,%0,%2\n\t" \
"scd %1,%3\n\t" \
"beqz %1,1b\n" \
acq "\n\t" \
".set pop\n" \
"2:\n\t" \
: "=&r" (__prev), "=&r" (__cmp) \
: "r" (value), "m" (*mem) \
: "memory"); \
__prev; })
#endif
/* ??? Barrier semantics for atomic_exchange_and_add appear to be
undefined. Use full barrier for now, as that's safe. */
#define atomic_exchange_and_add(mem, value) \
__atomic_val_bysize (__arch_exchange_and_add, int, mem, value, \
MIPS_SYNC_STR, MIPS_SYNC_STR)
/* TODO: More atomic operations could be implemented efficiently; only the
basic requirements are done. */
#define atomic_full_barrier() \
__asm__ __volatile__ (".set push\n\t" \
MIPS_PUSH_MIPS2 \
MIPS_SYNC_STR "\n\t" \
".set pop" : : : "memory")
#endif /* bits/atomic.h */

View File

@ -1,66 +0,0 @@
/* System dependent definitions for run-time dynamic loading.
Copyright (C) 1996, 1997, 1999, 2000, 2001, 2004
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _DLFCN_H
# error "Never use <bits/dlfcn.h> directly; include <dlfcn.h> instead."
#endif
/* The MODE argument to `dlopen' contains one of the following: */
#define RTLD_LAZY 0x0001 /* Lazy function call binding. */
#define RTLD_NOW 0x0002 /* Immediate function call binding. */
#define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */
#define RTLD_NOLOAD 0x00008 /* Do not load the object. */
#define RTLD_DEEPBIND 0x00010 /* Use deep binding. */
/* If the following bit is set in the MODE argument to `dlopen',
the symbols of the loaded object and its dependencies are made
visible as if the object were linked directly into the program. */
#define RTLD_GLOBAL 0x0004
/* Unix98 demands the following flag which is the inverse to RTLD_GLOBAL.
The implementation does this by default and so we can define the
value to zero. */
#define RTLD_LOCAL 0
/* Do not delete object when closed. */
#define RTLD_NODELETE 0x01000
#ifdef __USE_GNU
/* To support profiling of shared objects it is a good idea to call
the function found using `dlsym' using the following macro since
these calls do not use the PLT. But this would mean the dynamic
loader has no chance to find out when the function is called. The
macro applies the necessary magic so that profiling is possible.
Rewrite
foo = (*fctp) (arg1, arg2);
into
foo = DL_CALL_FCT (fctp, (arg1, arg2));
*/
# define DL_CALL_FCT(fctp, args) \
(_dl_mcount_wrapper_check ((void *) (fctp)), (*(fctp)) args)
__BEGIN_DECLS
/* This function calls the profiling functions. */
extern void _dl_mcount_wrapper_check (void *__selfpc) __THROW;
__END_DECLS
#endif

View File

@ -1,13 +0,0 @@
/* The MIPS architecture has selectable endianness.
This file is for a machine using big-endian mode. */
#ifndef _ENDIAN_H
# error "Never use <bits/endian.h> directly; include <endian.h> instead."
#endif
#if __MIPSEB
# define __BYTE_ORDER __BIG_ENDIAN
#endif
#if __MIPSEL
# define __BYTE_ORDER __LITTLE_ENDIAN
#endif

View File

@ -1,77 +0,0 @@
/* Copyright (C) 1998, 1999, 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _FENV_H
# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
#endif
/* Define bits representing the exception. We use the bit positions
of the appropriate bits in the FPU control word. */
enum
{
FE_INEXACT = 0x04,
#define FE_INEXACT FE_INEXACT
FE_UNDERFLOW = 0x08,
#define FE_UNDERFLOW FE_UNDERFLOW
FE_OVERFLOW = 0x10,
#define FE_OVERFLOW FE_OVERFLOW
FE_DIVBYZERO = 0x20,
#define FE_DIVBYZERO FE_DIVBYZERO
FE_INVALID = 0x40,
#define FE_INVALID FE_INVALID
};
#define FE_ALL_EXCEPT \
(FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
/* The MIPS FPU supports all of the four defined rounding modes. We
use again the bit positions in the FPU control word as the values
for the appropriate macros. */
enum
{
FE_TONEAREST = 0x0,
#define FE_TONEAREST FE_TONEAREST
FE_TOWARDZERO = 0x1,
#define FE_TOWARDZERO FE_TOWARDZERO
FE_UPWARD = 0x2,
#define FE_UPWARD FE_UPWARD
FE_DOWNWARD = 0x3
#define FE_DOWNWARD FE_DOWNWARD
};
/* Type representing exception flags. */
typedef unsigned short int fexcept_t;
/* Type representing floating-point environment. This function corresponds
to the layout of the block written by the `fstenv'. */
typedef struct
{
unsigned int __fp_control_register;
}
fenv_t;
/* If the default argument is used we use this value. */
#define FE_DFL_ENV ((__const fenv_t *) -1)
#ifdef __USE_GNU
/* Floating-point environment where none of the exception is masked. */
# define FE_NOMASK_ENV ((__const fenv_t *) -2)
#endif

View File

@ -1,32 +0,0 @@
/* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. MIPS version
Copyright (C) 2002 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/*
* Never include <bits/ipctypes.h> directly.
*/
#ifndef _BITS_IPCTYPES_H
#define _BITS_IPCTYPES_H 1
#include <bits/types.h>
typedef __SLONG32_TYPE __ipc_pid_t;
#endif /* bits/ipctypes.h */

View File

@ -1,118 +0,0 @@
/* Copyright (C) 2005 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _LINK_H
# error "Never include <bits/link.h> directly; use <link.h> instead."
#endif
#include <sgidefs.h>
#if _MIPS_SIM == _ABIO32
/* Registers for entry into PLT on MIPS. */
typedef struct La_mips_32_regs
{
uint32_t lr_reg[4]; /* $a0 through $a3 */
double lr_fpreg[2]; /* $f12 and $f14 */
uint32_t lr_ra;
uint32_t lr_sp;
} La_mips_32_regs;
/* Return values for calls from PLT on MIPS. */
typedef struct La_mips_32_retval
{
uint32_t lrv_v0;
uint32_t lrv_v1;
double lrv_f0;
double lrv_f2;
} La_mips_32_retval;
#else
typedef struct La_mips_64_regs
{
uint64_t lr_reg[8]; /* $a0 through $a7 */
double lr_fpreg[8]; /* $f12 throgh $f19 */
uint64_t lr_ra;
uint64_t lr_sp;
} La_mips_64_regs;
/* Return values for calls from PLT on MIPS. */
typedef struct La_mips_64_retval
{
uint64_t lrv_v0;
uint64_t lrv_v1;
double lrv_f0;
double lrv_f2;
} La_mips_64_retval;
#endif
__BEGIN_DECLS
#if _MIPS_SIM == _ABIO32
extern Elf32_Addr la_mips_o32_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx,
uintptr_t *__refcook,
uintptr_t *__defcook,
La_mips_32_regs *__regs,
unsigned int *__flags,
const char *__symname,
long int *__framesizep);
extern unsigned int la_mips_o32_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx,
uintptr_t *__refcook,
uintptr_t *__defcook,
const La_mips_32_regs *__inregs,
La_mips_32_retval *__outregs,
const char *symname);
#elif _MIPS_SIM == _ABIN32
extern Elf32_Addr la_mips_n32_gnu_pltenter (Elf32_Sym *__sym, unsigned int __ndx,
uintptr_t *__refcook,
uintptr_t *__defcook,
La_mips_64_regs *__regs,
unsigned int *__flags,
const char *__symname,
long int *__framesizep);
extern unsigned int la_mips_n32_gnu_pltexit (Elf32_Sym *__sym, unsigned int __ndx,
uintptr_t *__refcook,
uintptr_t *__defcook,
const La_mips_64_regs *__inregs,
La_mips_64_retval *__outregs,
const char *symname);
#else
extern Elf64_Addr la_mips_n64_gnu_pltenter (Elf64_Sym *__sym, unsigned int __ndx,
uintptr_t *__refcook,
uintptr_t *__defcook,
La_mips_64_regs *__regs,
unsigned int *__flags,
const char *__symname,
long int *__framesizep);
extern unsigned int la_mips_n64_gnu_pltexit (Elf64_Sym *__sym, unsigned int __ndx,
uintptr_t *__refcook,
uintptr_t *__defcook,
const La_mips_64_regs *__inregs,
La_mips_64_retval *__outregs,
const char *symname);
#endif
__END_DECLS

View File

@ -1,46 +0,0 @@
/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#if !defined _MATH_H && !defined _COMPLEX_H
# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
#endif
#include <sgidefs.h>
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
# define _MATH_H_MATHDEF 1
/* Normally, there is no long double type and the `float' and `double'
expressions are evaluated as `double'. */
typedef double float_t; /* `float' expressions are evaluated as
`double'. */
typedef double double_t; /* `double' expressions are evaluated as
`double'. */
/* The values returned by `ilogb' for 0 and NaN respectively. */
# define FP_ILOGB0 (-2147483647)
# define FP_ILOGBNAN 2147483647
#endif /* ISO C99 */
#if ! defined __NO_LONG_DOUBLE_MATH && _MIPS_SIM == _ABIO32
/* Signal that we do not really have a `long double'. This disables the
declaration of all the `long double' function variants. */
# define __NO_LONG_DOUBLE_MATH 1
#endif

View File

@ -1,56 +0,0 @@
/* `NAN' constant for IEEE 754 machines.
Copyright (C) 1992, 1996, 1997, 1999, 2002, 2004
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _MATH_H
# error "Never use <bits/nan.h> directly; include <math.h> instead."
#endif
/* IEEE Not A Number (QNaN). Note that MIPS has the QNaN and SNaN patterns
reversed compared to most other architectures. The IEEE spec left
the definition of this open to implementations, and for MIPS the top
bit of the mantissa must be SET to indicate a SNaN. */
#if __GNUC_PREREQ(3,3)
# define NAN (__builtin_nanf(""))
#elif defined __GNUC__
# define NAN \
(__extension__ \
((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \
{ __l: 0x7fbfffffUL }).__d)
#else
# include <endian.h>
# if __BYTE_ORDER == __BIG_ENDIAN
# define __nan_bytes { 0x7f, 0xbf, 0xff, 0xff }
# endif
# if __BYTE_ORDER == __LITTLE_ENDIAN
# define __nan_bytes { 0xff, 0xff, 0xbf, 0x7f }
# endif
static union { unsigned char __c[4]; float __d; } __nan_union = { __nan_bytes };
# define NAN (__nan_union.__d)
#endif /* GCC. */

View File

@ -1,75 +0,0 @@
/* Define the machine-dependent type `jmp_buf'. MIPS version.
Copyright (C) 1992,1993,1995,1997,2000,2002,2003,2004,2005,2006
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _MIPS_BITS_SETJMP_H
#define _MIPS_BITS_SETJMP_H 1
#if !defined(_SETJMP_H) && !defined(_PTHREAD_H)
# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
#endif
#include <sgidefs.h>
typedef struct
{
#if _MIPS_SIM == _ABIO32
/* Program counter. */
__ptr_t __pc;
/* Stack pointer. */
__ptr_t __sp;
/* Callee-saved registers s0 through s7. */
int __regs[8];
/* The frame pointer. */
__ptr_t __fp;
/* The global pointer. */
__ptr_t __gp;
#else
/* Program counter. */
__extension__ long long __pc;
/* Stack pointer. */
__extension__ long long __sp;
/* Callee-saved registers s0 through s7. */
__extension__ long long __regs[8];
/* The frame pointer. */
__extension__ long long __fp;
/* The global pointer. */
__extension__ long long __gp;
#endif
/* Floating point status register. */
int __fpc_csr;
/* Callee-saved floating point registers. */
#if _MIPS_SIM == _ABI64
double __fpregs[8];
#else
double __fpregs[6];
#endif
} __jmp_buf[1];
#endif /* _MIPS_BITS_SETJMP_H */

View File

@ -1,19 +0,0 @@
/* Copyright (C) 2002, 2003 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#define __WORDSIZE _MIPS_SZPTR

View File

@ -1,43 +0,0 @@
/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. MIPS version.
Copyright (C) 1996, 1997, 2000, 2002 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* This just does a tail-call to `__sigsetjmp (ARG, 0)'.
We cannot do it in C because it must be a tail-call, so frame-unwinding
in setjmp doesn't clobber the state restored by longjmp. */
#include <sysdep.h>
#ifdef __PIC__
.option pic2
#endif
ENTRY (_setjmp)
#ifdef __PIC__
.set noreorder
.cpload t9
.set reorder
la t9, C_SYMBOL_NAME (__sigsetjmp)
#endif
move a1,zero /* Pass a second argument of zero. */
#ifdef __PIC__
jr t9
#else
j C_SYMBOL_NAME (__sigsetjmp)
#endif
.end _setjmp
libc_hidden_def (_setjmp)

View File

@ -1,42 +0,0 @@
/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. MIPS version.
Copyright (C) 1996, 1997, 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* This just does a tail-call to `__sigsetjmp (ARG, 1)'.
We cannot do it in C because it must be a tail-call, so frame-unwinding
in setjmp doesn't clobber the state restored by longjmp. */
#include <sysdep.h>
#ifdef __PIC__
.option pic2
#endif
ENTRY (setjmp)
.set noreorder
#ifdef __PIC__
.cpload t9
.set reorder
la t9, C_SYMBOL_NAME (__sigsetjmp)
#endif
li a1, 1 /* Pass a second argument of one. */
#ifdef __PIC__
jr t9
#else
j C_SYMBOL_NAME (__sigsetjmp)
#endif
.end setjmp

View File

@ -1,22 +0,0 @@
/* Configuration of lookup functions. MIPS version.
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* Number of extra dynamic section entries for this architecture. By
default there are none. */
#define DT_THISPROCNUM DT_MIPS_NUM

View File

@ -1,611 +0,0 @@
/* Machine-dependent ELF dynamic relocation inline functions. MIPS version.
Copyright (C) 1996-2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* FIXME: Profiling of shared libraries is not implemented yet. */
#ifndef dl_machine_h
#define dl_machine_h
#define ELF_MACHINE_NAME "MIPS"
#define ELF_MACHINE_NO_PLT
#include <entry.h>
#ifndef ENTRY_POINT
#error ENTRY_POINT needs to be defined for MIPS.
#endif
#include <sgidefs.h>
#include <sys/asm.h>
#include <dl-tls.h>
/* The offset of gp from GOT might be system-dependent. It's set by
ld. The same value is also */
#define OFFSET_GP_GOT 0x7ff0
#ifndef _RTLD_PROLOGUE
# define _RTLD_PROLOGUE(entry) \
".globl\t" __STRING(entry) "\n\t" \
".ent\t" __STRING(entry) "\n\t" \
".type\t" __STRING(entry) ", @function\n" \
__STRING(entry) ":\n\t"
#endif
#ifndef _RTLD_EPILOGUE
# define _RTLD_EPILOGUE(entry) \
".end\t" __STRING(entry) "\n\t" \
".size\t" __STRING(entry) ", . - " __STRING(entry) "\n\t"
#endif
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.
This makes no sense on MIPS but we have to define this to R_MIPS_REL32
to avoid the asserts in dl-lookup.c from blowing. */
#define ELF_MACHINE_JMP_SLOT R_MIPS_REL32
#define elf_machine_type_class(type) ELF_RTYPE_CLASS_PLT
/* Translate a processor specific dynamic tag to the index
in l_info array. */
#define DT_MIPS(x) (DT_MIPS_##x - DT_LOPROC + DT_NUM)
/* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in
with the run-time address of the r_debug structure */
#define ELF_MACHINE_DEBUG_SETUP(l,r) \
do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \
*(ElfW(Addr) *)((l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) = \
(ElfW(Addr)) (r); \
} while (0)
/* Return nonzero iff ELF header is compatible with the running host. */
static inline int __attribute_used__
elf_machine_matches_host (const ElfW(Ehdr) *ehdr)
{
#if _MIPS_SIM == _ABIO32 || _MIPS_SIM == _ABIN32
/* Don't link o32 and n32 together. */
if (((ehdr->e_flags & EF_MIPS_ABI2) != 0) != (_MIPS_SIM == _ABIN32))
return 0;
#endif
switch (ehdr->e_machine)
{
case EM_MIPS:
case EM_MIPS_RS3_LE:
return 1;
default:
return 0;
}
}
static inline ElfW(Addr) *
elf_mips_got_from_gpreg (ElfW(Addr) gpreg)
{
/* FIXME: the offset of gp from GOT may be system-dependent. */
return (ElfW(Addr) *) (gpreg - OFFSET_GP_GOT);
}
/* Return the link-time address of _DYNAMIC. Conveniently, this is the
first element of the GOT. This must be inlined in a function which
uses global data. We assume its $gp points to the primary GOT. */
static inline ElfW(Addr)
elf_machine_dynamic (void)
{
register ElfW(Addr) gp __asm__ ("$28");
return *elf_mips_got_from_gpreg (gp);
}
#define STRINGXP(X) __STRING(X)
#define STRINGXV(X) STRINGV_(X)
#define STRINGV_(...) # __VA_ARGS__
/* Return the run-time load address of the shared object. */
static inline ElfW(Addr)
elf_machine_load_address (void)
{
ElfW(Addr) addr;
asm (" .set noreorder\n"
" " STRINGXP (PTR_LA) " %0, 0f\n"
" bltzal $0, 0f\n"
" nop\n"
"0: " STRINGXP (PTR_SUBU) " %0, $31, %0\n"
" .set reorder\n"
: "=r" (addr)
: /* No inputs */
: "$31");
return addr;
}
/* The MSB of got[1] of a gnu object is set to identify gnu objects. */
#if _MIPS_SIM == _ABI64
# define ELF_MIPS_GNU_GOT1_MASK 0x8000000000000000L
#else
# define ELF_MIPS_GNU_GOT1_MASK 0x80000000L
#endif
/* We can't rely on elf_machine_got_rel because _dl_object_relocation_scope
fiddles with global data. */
#define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \
do { \
struct link_map *map = &bootstrap_map; \
ElfW(Sym) *sym; \
ElfW(Addr) *got; \
int i, n; \
\
got = (ElfW(Addr) *) D_PTR (map, l_info[DT_PLTGOT]); \
\
if (__builtin_expect (map->l_addr == 0, 1)) \
break; \
\
/* got[0] is reserved. got[1] is also reserved for the dynamic object \
generated by gnu ld. Skip these reserved entries from \
relocation. */ \
i = (got[1] & ELF_MIPS_GNU_GOT1_MASK)? 2 : 1; \
n = map->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val; \
\
/* Add the run-time displacement to all local got entries. */ \
while (i < n) \
got[i++] += map->l_addr; \
\
/* Handle global got entries. */ \
got += n; \
sym = (ElfW(Sym) *) D_PTR(map, l_info[DT_SYMTAB]) \
+ map->l_info[DT_MIPS (GOTSYM)]->d_un.d_val; \
i = (map->l_info[DT_MIPS (SYMTABNO)]->d_un.d_val \
- map->l_info[DT_MIPS (GOTSYM)]->d_un.d_val); \
\
while (i--) \
{ \
if (sym->st_shndx == SHN_UNDEF || sym->st_shndx == SHN_COMMON) \
*got = map->l_addr + sym->st_value; \
else if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC \
&& *got != sym->st_value) \
*got += map->l_addr; \
else if (ELFW(ST_TYPE) (sym->st_info) == STT_SECTION) \
{ \
if (sym->st_other == 0) \
*got += map->l_addr; \
} \
else \
*got = map->l_addr + sym->st_value; \
\
got++; \
sym++; \
} \
} while(0)
/* Mask identifying addresses reserved for the user program,
where the dynamic linker should not map anything. */
#define ELF_MACHINE_USER_ADDRESS_MASK 0x80000000UL
/* Initial entry point code for the dynamic linker.
The C function `_dl_start' is the real entry point;
its return value is the user program's entry point.
Note how we have to be careful about two things:
1) That we allocate a minimal stack of 24 bytes for
every function call, the MIPS ABI states that even
if all arguments are passed in registers the procedure
called can use the 16 byte area pointed to by $sp
when it is called to store away the arguments passed
to it.
2) That under Linux the entry is named __start
and not just plain _start. */
#define RTLD_START asm (\
".text\n\
" _RTLD_PROLOGUE(ENTRY_POINT) "\
" STRINGXV(SETUP_GPX($25)) "\n\
" STRINGXV(SETUP_GPX64($18,$25)) "\n\
# i386 ABI book says that the first entry of GOT holds\n\
# the address of the dynamic structure. Though MIPS ABI\n\
# doesn't say nothing about this, I emulate this here.\n\
" STRINGXP(PTR_LA) " $4, _DYNAMIC\n\
# Subtract OFFSET_GP_GOT\n\
" STRINGXP(PTR_S) " $4, -0x7ff0($28)\n\
move $4, $29\n\
" STRINGXP(PTR_SUBIU) " $29, 16\n\
\n\
" STRINGXP(PTR_LA) " $8, .Lcoff\n\
bltzal $8, .Lcoff\n\
.Lcoff: " STRINGXP(PTR_SUBU) " $8, $31, $8\n\
\n\
" STRINGXP(PTR_LA) " $25, _dl_start\n\
" STRINGXP(PTR_ADDU) " $25, $8\n\
jalr $25\n\
\n\
" STRINGXP(PTR_ADDIU) " $29, 16\n\
# Get the value of label '_dl_start_user' in t9 ($25).\n\
" STRINGXP(PTR_LA) " $25, _dl_start_user\n\
" _RTLD_EPILOGUE(ENTRY_POINT) "\
\n\
\n\
" _RTLD_PROLOGUE(_dl_start_user) "\
" STRINGXP(SETUP_GP) "\n\
" STRINGXV(SETUP_GP64($18,_dl_start_user)) "\n\
move $16, $28\n\
# Save the user entry point address in a saved register.\n\
move $17, $2\n\
# See if we were run as a command with the executable file\n\
# name as an extra leading argument.\n\
lw $2, _dl_skip_args\n\
beq $2, $0, 1f\n\
# Load the original argument count.\n\
" STRINGXP(PTR_L) " $4, 0($29)\n\
# Subtract _dl_skip_args from it.\n\
subu $4, $2\n\
# Adjust the stack pointer to skip _dl_skip_args words.\n\
sll $2, " STRINGXP (PTRLOG) "\n\
" STRINGXP(PTR_ADDU) " $29, $2\n\
# Save back the modified argument count.\n\
" STRINGXP(PTR_S) " $4, 0($29)\n\
1: # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env) \n\
" STRINGXP(PTR_L) " $4, _rtld_local\n\
" STRINGXP(PTR_L) /* or lw??? fixme */ " $5, 0($29)\n\
" STRINGXP(PTR_LA) " $6, " STRINGXP (PTRSIZE) "($29)\n\
sll $7, $5, " STRINGXP (PTRLOG) "\n\
" STRINGXP(PTR_ADDU) " $7, $7, $6\n\
" STRINGXP(PTR_ADDU) " $7, $7, " STRINGXP (PTRSIZE) " \n\
# Make sure the stack pointer is aligned for _dl_init_internal.\n\
and $2, $29, -2 * " STRINGXP(SZREG) "\n\
" STRINGXP(PTR_S) " $29, -" STRINGXP(SZREG) "($2)\n\
" STRINGXP(PTR_SUBIU) " $29, $2, 32\n\
" STRINGXP(SAVE_GP(16)) "\n\
# Call the function to run the initializers.\n\
jal _dl_init_internal\n\
# Restore the stack pointer for _start.\n\
" STRINGXP(PTR_L) " $29, 32-" STRINGXP(SZREG) "($29)\n\
# Pass our finalizer function to the user in $2 as per ELF ABI.\n\
" STRINGXP(PTR_LA) " $2, _dl_fini\n\
# Jump to the user entry point.\n\
move $25, $17\n\
jr $25\n\t"\
_RTLD_EPILOGUE(_dl_start_user)\
".previous"\
);
/* The MIPS never uses Elfxx_Rela relocations. */
#define ELF_MACHINE_NO_RELA 1
/* Names of the architecture-specific auditing callback functions. */
# if _MIPS_SIM == _ABIO32
# define ARCH_LA_PLTENTER mips_o32_gnu_pltenter
# define ARCH_LA_PLTEXIT mips_o32_gnu_pltexit
# elif _MIPS_SIM == _ABIN32
# define ARCH_LA_PLTENTER mips_n32_gnu_pltenter
# define ARCH_LA_PLTEXIT mips_n32_gnu_pltexit
# else
# define ARCH_LA_PLTENTER mips_n64_gnu_pltenter
# define ARCH_LA_PLTEXIT mips_n64_gnu_pltexit
# endif
#endif /* !dl_machine_h */
#ifdef RESOLVE_MAP
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
MAP is the object containing the reloc. */
auto inline void
__attribute__ ((always_inline))
elf_machine_rel (struct link_map *map, const ElfW(Rel) *reloc,
const ElfW(Sym) *sym, const struct r_found_version *version,
void *const reloc_addr)
{
const unsigned long int r_type = ELFW(R_TYPE) (reloc->r_info);
#if !defined RTLD_BOOTSTRAP && !defined SHARED
/* This is defined in rtld.c, but nowhere in the static libc.a;
make the reference weak so static programs can still link. This
declaration cannot be done when compiling rtld.c (i.e. #ifdef
RTLD_BOOTSTRAP) because rtld.c contains the common defn for
_dl_rtld_map, which is incompatible with a weak decl in the same
file. */
weak_extern (GL(dl_rtld_map));
#endif
switch (r_type)
{
#if defined (USE_TLS) && !defined (RTLD_BOOTSTRAP)
# if _MIPS_SIM == _ABI64
case R_MIPS_TLS_DTPMOD64:
case R_MIPS_TLS_DTPREL64:
case R_MIPS_TLS_TPREL64:
# else
case R_MIPS_TLS_DTPMOD32:
case R_MIPS_TLS_DTPREL32:
case R_MIPS_TLS_TPREL32:
# endif
{
struct link_map *sym_map = RESOLVE_MAP (&sym, version, r_type);
Elf32_Addr value = sym == NULL ? 0 : sym_map->l_addr + sym->st_value;
if (sym)
value += sym->st_value;
switch (r_type)
{
case R_MIPS_TLS_DTPMOD64:
case R_MIPS_TLS_DTPMOD32:
if (sym_map)
*(ElfW(Word) *)reloc_addr = sym_map->l_tls_modid;
break;
case R_MIPS_TLS_DTPREL64:
case R_MIPS_TLS_DTPREL32:
*(ElfW(Word) *)reloc_addr += TLS_DTPREL_VALUE (sym);
break;
case R_MIPS_TLS_TPREL32:
case R_MIPS_TLS_TPREL64:
CHECK_STATIC_TLS (map, sym_map);
*(ElfW(Word) *)reloc_addr += TLS_TPREL_VALUE (sym_map, sym);
break;
}
break;
}
#endif
#if _MIPS_SIM == _ABI64
case (R_MIPS_64 << 8) | R_MIPS_REL32:
#else
case R_MIPS_REL32:
#endif
{
int symidx = ELFW(R_SYM) (reloc->r_info);
ElfW(Addr) reloc_value;
/* Support relocations on mis-aligned offsets. Should we ever
implement RELA, this should be replaced with an assignment
from reloc->r_addend. */
__builtin_memcpy (&reloc_value, reloc_addr, sizeof (reloc_value));
if (symidx)
{
const ElfW(Word) gotsym
= (const ElfW(Word)) map->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;
if ((ElfW(Word))symidx < gotsym)
{
/* This wouldn't work for a symbol imported from other
libraries for which there's no GOT entry, but MIPS
requires every symbol referenced in a dynamic
relocation to have a GOT entry in the primary GOT,
so we only get here for locally-defined symbols.
For section symbols, we should *NOT* be adding
sym->st_value (per the definition of the meaning of
S in reloc expressions in the ELF64 MIPS ABI),
since it should have already been added to
reloc_value by the linker, but older versions of
GNU ld didn't add it, and newer versions don't emit
useless relocations to section symbols any more, so
it is safe to keep on adding sym->st_value, even
though it's not ABI compliant. Some day we should
bite the bullet and stop doing this. */
#ifndef RTLD_BOOTSTRAP
if (map != &GL(dl_rtld_map))
#endif
reloc_value += sym->st_value + map->l_addr;
}
else
{
#ifndef RTLD_BOOTSTRAP
const ElfW(Addr) *got
= (const ElfW(Addr) *) D_PTR (map, l_info[DT_PLTGOT]);
const ElfW(Word) local_gotno
= (const ElfW(Word))
map->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;
reloc_value += got[symidx + local_gotno - gotsym];
#endif
}
}
else
#ifndef RTLD_BOOTSTRAP
if (map != &GL(dl_rtld_map))
#endif
reloc_value += map->l_addr;
__builtin_memcpy (reloc_addr, &reloc_value, sizeof (reloc_value));
}
break;
case R_MIPS_NONE: /* Alright, Wilbur. */
break;
#if _MIPS_SIM == _ABI64
case R_MIPS_64:
/* For full compliance with the ELF64 ABI, one must precede the
_REL32/_64 pair of relocations with a _64 relocation, such
that the in-place addend is read as a 64-bit value. IRIX
didn't pick up on this requirement, so we treat the
_REL32/_64 relocation as a 64-bit relocation even if it's by
itself. For ABI compliance, we ignore such _64 dummy
relocations. For RELA, this may be simply removed, since
it's totally unnecessary. */
if (ELFW(R_SYM) (reloc->r_info) == 0)
break;
/* Fall through. */
#endif
default:
_dl_reloc_bad_type (map, r_type, 0);
break;
}
}
auto inline void
__attribute__((always_inline))
elf_machine_rel_relative (ElfW(Addr) l_addr, const ElfW(Rel) *reloc,
void *const reloc_addr)
{
/* XXX Nothing to do. There is no relative relocation, right? */
}
auto inline void
__attribute__((always_inline))
elf_machine_lazy_rel (struct link_map *map,
ElfW(Addr) l_addr, const ElfW(Rel) *reloc)
{
/* Do nothing. */
}
auto inline void
__attribute__ ((always_inline))
elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
const ElfW(Sym) *sym, const struct r_found_version *version,
void *const reloc_addr)
{
}
auto inline void
__attribute__((always_inline))
elf_machine_rela_relative (ElfW(Addr) l_addr, const ElfW(Rela) *reloc,
void *const reloc_addr)
{
}
#ifndef RTLD_BOOTSTRAP
/* Relocate GOT. */
auto inline void
__attribute__((always_inline))
elf_machine_got_rel (struct link_map *map, int lazy)
{
ElfW(Addr) *got;
ElfW(Sym) *sym;
const ElfW(Half) *vernum;
int i, n, symidx;
#define RESOLVE_GOTSYM(sym,vernum,sym_index) \
({ \
const ElfW(Sym) *ref = sym; \
const struct r_found_version *version \
= vernum ? &map->l_versions[vernum[sym_index] & 0x7fff] : NULL; \
struct link_map *sym_map; \
sym_map = RESOLVE_MAP (&ref, version, R_MIPS_REL32); \
ref ? sym_map->l_addr + ref->st_value : 0; \
})
if (map->l_info[VERSYMIDX (DT_VERSYM)] != NULL)
vernum = (const void *) D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]);
else
vernum = NULL;
got = (ElfW(Addr) *) D_PTR (map, l_info[DT_PLTGOT]);
n = map->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;
/* The dynamic linker's local got entries have already been relocated. */
if (map != &GL(dl_rtld_map))
{
/* got[0] is reserved. got[1] is also reserved for the dynamic object
generated by gnu ld. Skip these reserved entries from relocation. */
i = (got[1] & ELF_MIPS_GNU_GOT1_MASK)? 2 : 1;
/* Add the run-time displacement to all local got entries if
needed. */
if (__builtin_expect (map->l_addr != 0, 0))
{
while (i < n)
got[i++] += map->l_addr;
}
}
/* Handle global got entries. */
got += n;
/* Keep track of the symbol index. */
symidx = map->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;
sym = (ElfW(Sym) *) D_PTR (map, l_info[DT_SYMTAB]) + symidx;
i = (map->l_info[DT_MIPS (SYMTABNO)]->d_un.d_val
- map->l_info[DT_MIPS (GOTSYM)]->d_un.d_val);
/* This loop doesn't handle Quickstart. */
while (i--)
{
if (sym->st_shndx == SHN_UNDEF)
{
if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC
&& sym->st_value && lazy)
*got = sym->st_value + map->l_addr;
else
*got = RESOLVE_GOTSYM (sym, vernum, symidx);
}
else if (sym->st_shndx == SHN_COMMON)
*got = RESOLVE_GOTSYM (sym, vernum, symidx);
else if (ELFW(ST_TYPE) (sym->st_info) == STT_FUNC
&& *got != sym->st_value
&& lazy)
*got += map->l_addr;
else if (ELFW(ST_TYPE) (sym->st_info) == STT_SECTION)
{
if (sym->st_other == 0)
*got += map->l_addr;
}
else
*got = RESOLVE_GOTSYM (sym, vernum, symidx);
++got;
++sym;
++symidx;
}
#undef RESOLVE_GOTSYM
}
#endif
/* Set up the loaded object described by L so its stub function
will jump to the on-demand fixup code __dl_runtime_resolve. */
auto inline int
__attribute__((always_inline))
elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
{
# ifndef RTLD_BOOTSTRAP
ElfW(Addr) *got;
extern void _dl_runtime_resolve (ElfW(Word));
extern int _dl_mips_gnu_objects;
if (lazy)
{
/* The GOT entries for functions have not yet been filled in.
Their initial contents will arrange when called to put an
offset into the .dynsym section in t8, the return address
in t7 and then jump to _GLOBAL_OFFSET_TABLE[0]. */
got = (ElfW(Addr) *) D_PTR (l, l_info[DT_PLTGOT]);
/* This function will get called to fix up the GOT entry indicated by
the register t8, and then jump to the resolved address. */
got[0] = (ElfW(Addr)) &_dl_runtime_resolve;
/* Store l to _GLOBAL_OFFSET_TABLE[1] for gnu object. The MSB
of got[1] of a gnu object is set to identify gnu objects.
Where we can store l for non gnu objects? XXX */
if ((got[1] & ELF_MIPS_GNU_GOT1_MASK) != 0)
got[1] = ((ElfW(Addr)) l | ELF_MIPS_GNU_GOT1_MASK);
else
_dl_mips_gnu_objects = 0;
}
/* Relocate global offset table. */
elf_machine_got_rel (l, lazy);
# endif
return lazy;
}
#endif /* RESOLVE_MAP */

View File

@ -1,46 +0,0 @@
/* Thread-local storage handling in the ELF dynamic linker. MIPS version.
Copyright (C) 2005 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* Type used for the representation of TLS information in the GOT. */
typedef struct
{
unsigned long int ti_module;
unsigned long int ti_offset;
} tls_index;
/* The thread pointer points 0x7000 past the first static TLS block. */
#define TLS_TP_OFFSET 0x7000
/* Dynamic thread vector pointers point 0x8000 past the start of each
TLS block. */
#define TLS_DTV_OFFSET 0x8000
/* Compute the value for a GOTTPREL reloc. */
#define TLS_TPREL_VALUE(sym_map, sym) \
((sym_map)->l_tls_offset + (sym)->st_value - TLS_TP_OFFSET)
/* Compute the value for a DTPREL reloc. */
#define TLS_DTPREL_VALUE(sym) \
((sym)->st_value - TLS_DTV_OFFSET)
extern void *__tls_get_addr (tls_index *ti);
# define GET_ADDR_OFFSET (ti->ti_offset + TLS_DTV_OFFSET)
# define __TLS_GET_ADDR(__ti) (__tls_get_addr (__ti) - TLS_DTV_OFFSET)

View File

@ -1,272 +0,0 @@
/* PLT trampoline. MIPS version.
Copyright (C) 1996-2001, 2002, 2003, 2004, 2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Kazumoto Kojima <kkojima@info.kanagawa-u.ac.jp>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
/* FIXME: Profiling of shared libraries is not implemented yet. */
#include <sysdep.h>
#include <link.h>
#include <elf.h>
#include <ldsodefs.h>
#include <dl-machine.h>
/* Get link map for callers object containing STUB_PC. */
static inline struct link_map *
elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
{
extern int _dl_mips_gnu_objects;
/* got[1] is reserved to keep its link map address for the shared
object generated by the gnu linker. If all are such objects, we
can find the link map from current GPREG simply. If not so, get
the link map for caller's object containing STUB_PC. */
if (_dl_mips_gnu_objects)
{
ElfW(Addr) *got = elf_mips_got_from_gpreg (gpreg);
ElfW(Word) g1;
g1 = ((ElfW(Word) *) got)[1];
if ((g1 & ELF_MIPS_GNU_GOT1_MASK) != 0)
{
struct link_map *l =
(struct link_map *) (g1 & ~ELF_MIPS_GNU_GOT1_MASK);
ElfW(Addr) base, limit;
const ElfW(Phdr) *p = l->l_phdr;
ElfW(Half) this, nent = l->l_phnum;
/* For the common case of a stub being called from the containing
object, STUB_PC will point to somewhere within the object that
is described by the link map fetched via got[1]. Otherwise we
have to scan all maps. */
for (this = 0; this < nent; this++)
{
if (p[this].p_type == PT_LOAD)
{
base = p[this].p_vaddr + l->l_addr;
limit = base + p[this].p_memsz;
if (stub_pc >= base && stub_pc < limit)
return l;
}
}
}
}
struct link_map *l;
Lmid_t nsid;
for (nsid = 0; nsid < DL_NNS; ++nsid)
for (l = GL(dl_ns)[nsid]._ns_loaded; l != NULL; l = l->l_next)
{
ElfW(Addr) base, limit;
const ElfW(Phdr) *p = l->l_phdr;
ElfW(Half) this, nent = l->l_phnum;
for (this = 0; this < nent; ++this)
{
if (p[this].p_type == PT_LOAD)
{
base = p[this].p_vaddr + l->l_addr;
limit = base + p[this].p_memsz;
if (stub_pc >= base && stub_pc < limit)
return l;
}
}
}
_dl_signal_error (0, NULL, NULL, "cannot find runtime link map");
return NULL;
}
/* Define mips specific runtime resolver. The function __dl_runtime_resolve
is called from assembler function _dl_runtime_resolve which converts
special argument registers t7 ($15) and t8 ($24):
t7 address to return to the caller of the function
t8 index for this function symbol in .dynsym
to usual c arguments.
Other architectures call fixup from dl-runtime.c in
_dl_runtime_resolve. MIPS instead calls __dl_runtime_resolve. We
have to use our own version because of the way the got section is
treated on MIPS (we've also got ELF_MACHINE_PLT defined). */
/* The flag _dl_mips_gnu_objects is set if all dynamic objects are
generated by the gnu linker. */
int _dl_mips_gnu_objects = 1;
#define VERSYMIDX(sym) (DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGIDX (sym))
/* This is called from assembly stubs below which the compiler can't see. */
static ElfW(Addr)
__dl_runtime_resolve (ElfW(Word), ElfW(Word), ElfW(Addr), ElfW(Addr))
__attribute_used__;
static ElfW(Addr)
__dl_runtime_resolve (ElfW(Word) sym_index,
ElfW(Word) return_address,
ElfW(Addr) old_gpreg,
ElfW(Addr) stub_pc)
{
struct link_map *l = elf_machine_runtime_link_map (old_gpreg, stub_pc);
const ElfW(Sym) *const symtab
= (const ElfW(Sym) *) D_PTR (l, l_info[DT_SYMTAB]);
const char *strtab = (const void *) D_PTR (l, l_info[DT_STRTAB]);
ElfW(Addr) *got
= (ElfW(Addr) *) D_PTR (l, l_info[DT_PLTGOT]);
const ElfW(Word) local_gotno
= (const ElfW(Word)) l->l_info[DT_MIPS (LOCAL_GOTNO)]->d_un.d_val;
const ElfW(Word) gotsym
= (const ElfW(Word)) l->l_info[DT_MIPS (GOTSYM)]->d_un.d_val;
const ElfW(Sym) *sym = &symtab[sym_index];
struct link_map *sym_map;
ElfW(Addr) value;
/* FIXME: The symbol versioning stuff is not tested yet. */
if (__builtin_expect (ELFW(ST_VISIBILITY) (sym->st_other), 0) == 0)
{
switch (l->l_info[VERSYMIDX (DT_VERSYM)] != NULL)
{
default:
{
const ElfW(Half) *vernum =
(const void *) D_PTR (l, l_info[VERSYMIDX (DT_VERSYM)]);
ElfW(Half) ndx = vernum[sym_index] & 0x7fff;
const struct r_found_version *version = &l->l_versions[ndx];
if (version->hash != 0)
{
sym_map = _dl_lookup_symbol_x (strtab + sym->st_name, l,
&sym, l->l_scope, version,
ELF_RTYPE_CLASS_PLT, 0, 0);
break;
}
/* Fall through. */
}
case 0:
sym_map = _dl_lookup_symbol_x (strtab + sym->st_name, l, &sym,
l->l_scope, 0, ELF_RTYPE_CLASS_PLT,
DL_LOOKUP_ADD_DEPENDENCY, 0);
}
/* Currently value contains the base load address of the object
that defines sym. Now add in the symbol offset. */
value = (sym ? sym_map->l_addr + sym->st_value : 0);
}
else
/* We already found the symbol. The module (and therefore its load
address) is also known. */
value = l->l_addr + sym->st_value;
/* Apply the relocation with that value. */
*(got + local_gotno + sym_index - gotsym) = value;
return value;
}
#if _MIPS_SIM == _ABIO32
#define ELF_DL_FRAME_SIZE 40
#define ELF_DL_SAVE_ARG_REGS "\
sw $15, 36($29)\n \
sw $4, 16($29)\n \
sw $5, 20($29)\n \
sw $6, 24($29)\n \
sw $7, 28($29)\n \
"
#define ELF_DL_RESTORE_ARG_REGS "\
lw $31, 36($29)\n \
lw $4, 16($29)\n \
lw $5, 20($29)\n \
lw $6, 24($29)\n \
lw $7, 28($29)\n \
"
#define IFABIO32(X) X
#else /* _MIPS_SIM == _ABIN32 || _MIPS_SIM == _ABI64 */
#define ELF_DL_FRAME_SIZE 80
#define ELF_DL_SAVE_ARG_REGS "\
sd $15, 72($29)\n \
sd $4, 8($29)\n \
sd $5, 16($29)\n \
sd $6, 24($29)\n \
sd $7, 32($29)\n \
sd $8, 40($29)\n \
sd $9, 48($29)\n \
sd $10, 56($29)\n \
sd $11, 64($29)\n \
"
#define ELF_DL_RESTORE_ARG_REGS "\
ld $31, 72($29)\n \
ld $4, 8($29)\n \
ld $5, 16($29)\n \
ld $6, 24($29)\n \
ld $7, 32($29)\n \
ld $8, 40($29)\n \
ld $9, 48($29)\n \
ld $10, 56($29)\n \
ld $11, 64($29)\n \
"
#define IFABIO32(X)
#endif
asm ("\n\
.text\n\
.align 2\n\
.globl _dl_runtime_resolve\n\
.type _dl_runtime_resolve,@function\n\
.ent _dl_runtime_resolve\n\
_dl_runtime_resolve:\n\
.frame $29, " STRINGXP(ELF_DL_FRAME_SIZE) ", $31\n\
.set noreorder\n\
# Save GP.\n\
move $3, $28\n\
# Save arguments and sp value in stack.\n\
" STRINGXP(PTR_SUBIU) " $29, " STRINGXP(ELF_DL_FRAME_SIZE) "\n\
# Modify t9 ($25) so as to point .cpload instruction.\n\
" IFABIO32(STRINGXP(PTR_ADDIU) " $25, 12\n") "\
# Compute GP.\n\
" STRINGXP(SETUP_GP) "\n\
" STRINGXV(SETUP_GP64 (0, _dl_runtime_resolve)) "\n\
.set reorder\n\
# Save slot call pc.\n\
move $2, $31\n\
" IFABIO32(STRINGXP(CPRESTORE(32))) "\n\
" ELF_DL_SAVE_ARG_REGS "\
move $4, $24\n\
move $5, $15\n\
move $6, $3\n\
move $7, $2\n\
jal __dl_runtime_resolve\n\
" ELF_DL_RESTORE_ARG_REGS "\
" STRINGXP(RESTORE_GP64) "\n\
" STRINGXP(PTR_ADDIU) " $29, " STRINGXP(ELF_DL_FRAME_SIZE) "\n\
move $25, $2\n\
jr $25\n\
.end _dl_runtime_resolve\n\
.previous\n\
");

View File

@ -1,46 +0,0 @@
# This file is generated from configure.in by Autoconf. DO NOT EDIT!
# Local configure fragment for sysdeps/mips/elf.
if test "$usetls" != no; then
# Check for support of thread-local storage handling in assembler and
# linker.
echo "$as_me:$LINENO: checking for MIPS TLS support" >&5
echo $ECHO_N "checking for MIPS TLS support... $ECHO_C" >&6
if test "${libc_cv_mips_tls+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat > conftest.s <<\EOF
.section ".tdata", "awT", %progbits
.globl foo
foo: .long 1
.section ".tbss", "awT", %nobits
.globl bar
bar: .skip 4
.text
lw $25, %call16(__tls_get_addr)($28)
jalr $25
addiu $4, $28, %tlsgd(x)
EOF
if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
libc_cv_mips_tls=yes
else
libc_cv_mips_tls=no
fi
rm -f conftest*
fi
echo "$as_me:$LINENO: result: $libc_cv_mips_tls" >&5
echo "${ECHO_T}$libc_cv_mips_tls" >&6
if test $libc_cv_mips_tls = yes; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_TLS_SUPPORT 1
_ACEOF
fi
fi

View File

@ -1,35 +0,0 @@
GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
# Local configure fragment for sysdeps/mips/elf.
if test "$usetls" != no; then
# Check for support of thread-local storage handling in assembler and
# linker.
AC_CACHE_CHECK(for MIPS TLS support, libc_cv_mips_tls, [dnl
cat > conftest.s <<\EOF
.section ".tdata", "awT", %progbits
.globl foo
foo: .long 1
.section ".tbss", "awT", %nobits
.globl bar
bar: .skip 4
.text
lw $25, %call16(__tls_get_addr)($28)
jalr $25
addiu $4, $28, %tlsgd(x)
EOF
dnl
if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
libc_cv_mips_tls=yes
else
libc_cv_mips_tls=no
fi
rm -f conftest*])
if test $libc_cv_mips_tls = yes; then
AC_DEFINE(HAVE_TLS_SUPPORT)
fi
fi
dnl No MIPS GCC supports accessing static and hidden symbols in an
dnl position independent way.
dnl AC_DEFINE(PI_STATIC_AND_HIDDEN)

View File

@ -1,109 +0,0 @@
/* Run-time dynamic linker data structures for loaded ELF shared objects.
Copyright (C) 2000, 2002, 2003 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _MIPS_LDSODEFS_H
#define _MIPS_LDSODEFS_H
/* The MIPS ABI specifies that the dynamic section has to be read-only. */
#define DL_RO_DYN_SECTION 1
#include_next <ldsodefs.h>
/* The 64-bit MIPS ELF ABI uses an unusual reloc format. Each
relocation entry specifies up to three actual relocations, all at
the same address. The first relocation which required a symbol
uses the symbol in the r_sym field. The second relocation which
requires a symbol uses the symbol in the r_ssym field. If all
three relocations require a symbol, the third one uses a zero
value.
We define these structures in internal headers because we're not
sure we want to make them part of the ABI yet. Eventually, some of
this may move into elf/elf.h. */
/* An entry in a 64 bit SHT_REL section. */
typedef struct
{
Elf32_Word r_sym; /* Symbol index */
unsigned char r_ssym; /* Special symbol for 2nd relocation */
unsigned char r_type3; /* 3rd relocation type */
unsigned char r_type2; /* 2nd relocation type */
unsigned char r_type1; /* 1st relocation type */
} _Elf64_Mips_R_Info;
typedef union
{
Elf64_Xword r_info_number;
_Elf64_Mips_R_Info r_info_fields;
} _Elf64_Mips_R_Info_union;
typedef struct
{
Elf64_Addr r_offset; /* Address */
_Elf64_Mips_R_Info_union r_info; /* Relocation type and symbol index */
} Elf64_Mips_Rel;
typedef struct
{
Elf64_Addr r_offset; /* Address */
_Elf64_Mips_R_Info_union r_info; /* Relocation type and symbol index */
Elf64_Sxword r_addend; /* Addend */
} Elf64_Mips_Rela;
#define ELF64_MIPS_R_SYM(i) \
((__extension__ (_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_sym)
#define ELF64_MIPS_R_TYPE(i) \
(((_Elf64_Mips_R_Info_union)(i)).r_info_fields.r_type1 \
| ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
).r_info_fields.r_type2 << 8) \
| ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
).r_info_fields.r_type3 << 16) \
| ((Elf32_Word)(__extension__ (_Elf64_Mips_R_Info_union)(i) \
).r_info_fields.r_ssym << 24))
#define ELF64_MIPS_R_INFO(sym, type) \
(__extension__ (_Elf64_Mips_R_Info_union) \
(__extension__ (_Elf64_Mips_R_Info) \
{ (sym), ELF64_MIPS_R_SSYM (type), \
ELF64_MIPS_R_TYPE3 (type), \
ELF64_MIPS_R_TYPE2 (type), \
ELF64_MIPS_R_TYPE1 (type) \
}).r_info_number)
/* These macros decompose the value returned by ELF64_MIPS_R_TYPE, and
compose it back into a value that it can be used as an argument to
ELF64_MIPS_R_INFO. */
#define ELF64_MIPS_R_SSYM(i) (((i) >> 24) & 0xff)
#define ELF64_MIPS_R_TYPE3(i) (((i) >> 16) & 0xff)
#define ELF64_MIPS_R_TYPE2(i) (((i) >> 8) & 0xff)
#define ELF64_MIPS_R_TYPE1(i) ((i) & 0xff)
#define ELF64_MIPS_R_TYPEENC(type1, type2, type3, ssym) \
((type1) \
| ((Elf32_Word)(type2) << 8) \
| ((Elf32_Word)(type3) << 16) \
| ((Elf32_Word)(ssym) << 24))
#undef ELF64_R_SYM
#define ELF64_R_SYM(i) ELF64_MIPS_R_SYM (i)
#undef ELF64_R_TYPE
#define ELF64_R_TYPE(i) ELF64_MIPS_R_TYPE (i)
#undef ELF64_R_INFO
#define ELF64_R_INFO(sym, type) ELF64_MIPS_R_INFO ((sym), (type))
#endif

View File

@ -1,119 +0,0 @@
/* Startup code compliant to the ELF Mips ABI.
Copyright (C) 1995, 1997, 2000, 2001, 2002, 2003, 2004
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
In addition to the permissions in the GNU Lesser 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 GNU Lesser 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.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#define __ASSEMBLY__ 1
#include <entry.h>
#include <sgidefs.h>
#include <sys/asm.h>
#ifndef ENTRY_POINT
#error ENTRY_POINT needs to be defined for start.S on MIPS/ELF.
#endif
/* This is the canonical entry point, usually the first thing in the text
segment. The SVR4/Mips ABI (pages 3-31, 3-32) says that when the entry
point runs, most registers' values are unspecified, except for:
v0 ($2) Contains a function pointer to be registered with `atexit'.
This is how the dynamic linker arranges to have DT_FINI
functions called for shared libraries that have been loaded
before this code runs.
sp ($29) The stack contains the arguments and environment:
0(%esp) argc
4(%esp) argv[0]
...
(4*argc)(%esp) NULL
(4*(argc+1))(%esp) envp[0]
...
NULL
ra ($31) The return address register is set to zero so that programs
that search backword through stack frames recognize the last
stack frame.
*/
/* We need to call:
__libc_start_main (int (*main) (int, char **, char **), int argc,
char **argv, void (*init) (void), void (*fini) (void),
void (*rtld_fini) (void), void *stack_end)
*/
.text
.globl ENTRY_POINT
.type ENTRY_POINT,@function
ENTRY_POINT:
#ifdef __PIC__
SETUP_GPX($0)
SETUP_GPX64($25,$0)
#else
PTR_LA $28, _gp /* Setup GP correctly if we're non-PIC. */
move $31, $0
#endif
PTR_LA $4, main /* main */
PTR_L $5, 0($29) /* argc */
PTR_ADDIU $6, $29, PTRSIZE /* argv */
/* Allocate space on the stack for seven arguments (o32 only)
and make sure the stack is aligned to double words (8 bytes)
on o32 and quad words (16 bytes) on n32 and n64. */
and $29, -2 * SZREG
#if _MIPS_SIM == _ABIO32
PTR_SUBIU $29, 32
#endif
PTR_LA $7, __libc_csu_init /* init */
PTR_LA $8, __libc_csu_fini
#if _MIPS_SIM == _ABIO32
PTR_S $8, 16($29) /* fini */
PTR_S $2, 20($29) /* rtld_fini */
PTR_S $29, 24($29) /* stack_end */
#else
move $9, $2 /* rtld_fini */
move $10, $29 /* stack_end */
#endif
jal __libc_start_main
hlt: b hlt /* Crash if somehow it does return. */
/* Define a symbol for the first piece of initialized data. */
.data
.globl __data_start
__data_start:
.long 0
.weak data_start
data_start = __data_start

View File

@ -1,24 +0,0 @@
/* Copyright (C) 1991, 92, 94, 95, 96 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _FPREGDEF_H
#define _FPREGDEF_H
#include <sys/fpregdef.h>
#endif /* _FPREGDEF_H */

View File

@ -1,38 +0,0 @@
/* Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sgidefs.h>
#if (_MIPS_ISA >= _MIPS_ISA_MIPS2)
double
__ieee754_sqrt (double x)
{
double z;
__asm__ ("sqrt.d %0,%1" : "=f" (z) : "f" (x));
return z;
}
#else
#include <sysdeps/ieee754/dbl-64/e_sqrt.c>
#endif

View File

@ -1,39 +0,0 @@
/* Copyright (C) 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <sgidefs.h>
#if (_MIPS_ISA >= _MIPS_ISA_MIPS2)
float
__ieee754_sqrtf (float x)
{
float z;
__asm__ ("sqrt.s %0,%1" : "=f" (z) : "f" (x));
return z;
}
#else
#include <sysdeps/ieee754/flt-32/e_sqrtf.c>
#endif

View File

@ -1,47 +0,0 @@
/* Clear given exceptions in current floating-point environment.
Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1998.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, 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
feclearexcept (int excepts)
{
int cw;
/* Mask out unsupported bits/exceptions. */
excepts &= FE_ALL_EXCEPT;
/* Read the complete control word. */
_FPU_GETCW (cw);
/* Clear exception flag bits and cause bits. If the cause bit is not
cleared, the next CTC instruction (just below) will re-generate the
exception. */
cw &= ~(excepts | (excepts << CAUSE_SHIFT));
/* Put the new data in effect. */
_FPU_SETCW (cw);
/* Success. */
return 0;
}

View File

@ -1,42 +0,0 @@
/* Disable floating-point exceptions.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 2000.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, 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
fedisableexcept (int excepts)
{
unsigned int new_exc, old_exc;
/* Get the current control word. */
_FPU_GETCW (new_exc);
old_exc = (new_exc & ENABLE_MASK) >> ENABLE_SHIFT;
excepts &= FE_ALL_EXCEPT;
new_exc &= ~(excepts << ENABLE_SHIFT);
new_exc &= ~_FPU_RESERVED;
_FPU_SETCW (new_exc);
return old_exc;
}

View File

@ -1,42 +0,0 @@
/* Enable floating-point exceptions.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 2000.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, 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
feenableexcept (int excepts)
{
unsigned int new_exc, old_exc;
/* Get the current control word. */
_FPU_GETCW (new_exc);
old_exc = (new_exc & ENABLE_MASK) >> ENABLE_SHIFT;
excepts &= FE_ALL_EXCEPT;
new_exc |= excepts << ENABLE_SHIFT;
new_exc &= ~_FPU_RESERVED;
_FPU_SETCW (new_exc);
return old_exc;
}

View File

@ -1,31 +0,0 @@
/* Store current floating-point environment.
Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1998.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <fenv.h>
#include <fpu_control.h>
int
fegetenv (fenv_t *envp)
{
_FPU_GETCW (*envp);
/* Success. */
return 0;
}

View File

@ -1,34 +0,0 @@
/* Get enabled floating-point exceptions.
Copyright (C) 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 2000.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, 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
fegetexcept (void)
{
unsigned int exc;
/* Get the current control word. */
_FPU_GETCW (exc);
return (exc & ENABLE_MASK) >> ENABLE_SHIFT;
}

View File

@ -1,33 +0,0 @@
/* Return current rounding direction.
Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1998.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <fenv.h>
#include <fpu_control.h>
int
fegetround (void)
{
int cw;
/* Get control word. */
_FPU_GETCW (cw);
return cw & 0x3;
}

View File

@ -1,38 +0,0 @@
/* 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 Andreas Jaeger <aj@suse.de>, 2000.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <fenv.h>
#include <fpu_control.h>
int
feholdexcept (fenv_t *envp)
{
fpu_control_t cw;
/* Save the current state. */
_FPU_GETCW (cw);
envp->__fp_control_register = cw;
/* Clear all exception enable bits and flags. */
cw &= ~(_FPU_MASK_V|_FPU_MASK_Z|_FPU_MASK_O|_FPU_MASK_U|_FPU_MASK_I|FE_ALL_EXCEPT);
_FPU_SETCW (cw);
return 0;
}

View File

@ -1,32 +0,0 @@
/* Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; 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
/* Mask for enabling exceptions and for the CAUSE bits. */
#define ENABLE_MASK 0x00F80U
#define CAUSE_MASK 0x1F000U
/* Shift for FE_* flags to get up to the ENABLE bits and the CAUSE bits. */
#define ENABLE_SHIFT 5
#define CAUSE_SHIFT 10
#endif /* _FENV_LIBC_H */

View File

@ -1,43 +0,0 @@
/* Install given floating-point environment.
Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1998.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <fenv.h>
#include <fpu_control.h>
int
fesetenv (const fenv_t *envp)
{
fpu_control_t cw;
/* Read first current state to flush fpu pipeline. */
_FPU_GETCW (cw);
if (envp == FE_DFL_ENV)
_FPU_SETCW (_FPU_DEFAULT);
else if (envp == FE_NOMASK_ENV)
_FPU_SETCW (_FPU_IEEE);
else
_FPU_SETCW (envp->__fp_control_register);
/* Success. */
return 0;
}
libm_hidden_def (fesetenv)

View File

@ -1,43 +0,0 @@
/* Set current rounding direction.
Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1998.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <fenv.h>
#include <fpu_control.h>
int
fesetround (int round)
{
unsigned short int cw;
if ((round & ~0x3) != 0)
/* ROUND is no valid rounding mode. */
return 1;
/* Get current state. */
_FPU_GETCW (cw);
/* Set rounding bits. */
cw &= ~0x3;
cw |= round;
/* Set new state. */
_FPU_SETCW (cw);
return 0;
}

View File

@ -1,43 +0,0 @@
/* Install given floating-point environment and raise exceptions.
Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1998.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <fenv.h>
#include <fpu_control.h>
int
feupdateenv (const fenv_t *envp)
{
int temp;
/* Save current exceptions. */
_FPU_GETCW (temp);
temp &= FE_ALL_EXCEPT;
/* Install new environment. */
fesetenv (envp);
/* Raise the safed exception. Incidently for us the implementation
defined format of the values in objects of type fexcept_t is the
same as the ones specified using the FE_* constants. */
feraiseexcept (temp);
/* Success. */
return 0;
}

View File

@ -1,40 +0,0 @@
/* Store current representation for exceptions.
Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 1998.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <fenv.h>
#include <fpu_control.h>
int
fegetexceptflag (fexcept_t *flagp, int excepts)
{
fexcept_t temp;
/* Get the current exceptions. */
_FPU_GETCW (temp);
/* We only save the relevant bits here. In particular, care has to be
taken with the CAUSE bits, as an inadvertent restore later on could
generate unexpected exceptions. */
*flagp = temp & excepts & FE_ALL_EXCEPT;
/* Success. */
return 0;
}

View File

@ -1,47 +0,0 @@
/* Raise given exceptions.
Copyright (C) 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>, 2000.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, 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
feraiseexcept (int excepts)
{
fpu_control_t cw;
/* Get current state. */
_FPU_GETCW (cw);
/* Set flag bits (which are accumulative), and *also* set the
cause bits. The setting of the cause bits is what actually causes
the hardware to generate the exception, if the corresponding enable
bit is set as well. */
excepts &= FE_ALL_EXCEPT;
cw |= excepts | (excepts << CAUSE_SHIFT);
/* Set new state. */
_FPU_SETCW (cw);
return 0;
}
libm_hidden_def (feraiseexcept)

View File

@ -1,43 +0,0 @@
/* Set floating-point environment exception handling.
Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Hartvig Ekner <hartvige@mips.com>, 2002.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <fenv.h>
#include <fpu_control.h>
int
fesetexceptflag (const fexcept_t *flagp, int excepts)
{
fexcept_t temp;
/* Get the current exceptions. */
_FPU_GETCW (temp);
/* Make sure the flags we want restored are legal. */
excepts &= FE_ALL_EXCEPT;
/* Now clear the bits called for, and copy them in from flagp. Note that
we ignore all non-flag bits from *flagp, so they don't matter. */
temp = (temp & ~excepts) | (*flagp & excepts);
_FPU_SETCW (temp);
/* Success. */
return 0;
}

View File

@ -1,33 +0,0 @@
/* Test exception in current environment.
Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@arthur.rhein-neckar.de>, 1998.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <fenv.h>
#include <fpu_control.h>
int
fetestexcept (int excepts)
{
int cw;
/* Get current control word. */
_FPU_GETCW (cw);
return cw & excepts & FE_ALL_EXCEPT;
}

View File

@ -1,890 +0,0 @@
# Begin of automatic generation
# atan2
Test "atan2 (-0.75, -1.0) == -2.49809154479650885165983415456218025":
float: 3
ifloat: 3
Test "atan2 (0.75, -1.0) == 2.49809154479650885165983415456218025":
float: 3
ifloat: 3
Test "atan2 (1.390625, 0.9296875) == 0.981498387184244311516296577615519772":
float: 1
ifloat: 1
# atanh
Test "atanh (0.75) == 0.972955074527656652552676371721589865":
float: 1
ifloat: 1
# cacosh
Test "Real part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 7
idouble: 1
ifloat: 7
Test "Imaginary part of: cacosh (-2 - 3 i) == 1.9833870299165354323470769028940395 - 2.1414491111159960199416055713254211 i":
double: 1
float: 3
idouble: 1
ifloat: 3
# casin
Test "Real part of: casin (0.75 + 1.25 i) == 0.453276177638793913448921196101971749 + 1.13239363160530819522266333696834467 i":
double: 1
float: 1
idouble: 1
ifloat: 1
# casinh
Test "Real part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
double: 5
float: 1
idouble: 5
ifloat: 1
Test "Imaginary part of: casinh (-2 - 3 i) == -1.9686379257930962917886650952454982 - 0.96465850440760279204541105949953237 i":
double: 3
float: 6
idouble: 3
ifloat: 6
Test "Real part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
float: 1
ifloat: 1
Test "Imaginary part of: casinh (0.75 + 1.25 i) == 1.03171853444778027336364058631006594 + 0.911738290968487636358489564316731207 i":
double: 1
float: 1
idouble: 1
ifloat: 1
# catan
Test "Real part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
float: 3
ifloat: 3
Test "Imaginary part of: catan (-2 - 3 i) == -1.4099210495965755225306193844604208 - 0.22907268296853876629588180294200276 i":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "Real part of: catan (0.75 + 1.25 i) == 1.10714871779409050301706546017853704 + 0.549306144334054845697622618461262852 i":
float: 4
ifloat: 4
# catanh
Test "Real part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
double: 4
idouble: 4
Test "Imaginary part of: catanh (-2 - 3 i) == -0.14694666622552975204743278515471595 - 1.3389725222944935611241935759091443 i":
float: 4
ifloat: 4
Test "Real part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
double: 1
idouble: 1
Test "Imaginary part of: catanh (0.75 + 1.25 i) == 0.261492138795671927078652057366532140 + 0.996825126463918666098902241310446708 i":
float: 6
ifloat: 6
# cbrt
Test "cbrt (-27.0) == -3.0":
double: 1
idouble: 1
Test "cbrt (0.75) == 0.908560296416069829445605878163630251":
double: 1
idouble: 1
Test "cbrt (0.9921875) == 0.997389022060725270579075195353955217":
double: 1
idouble: 1
# ccos
Test "Imaginary part of: ccos (-2 - 3 i) == -4.18962569096880723013255501961597373 - 9.10922789375533659797919726277886212 i":
float: 1
ifloat: 1
Test "Real part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "Imaginary part of: ccos (0.75 + 1.25 i) == 1.38173873063425888530729933139078645 - 1.09193013555397466170919531722024128 i":
float: 1
ifloat: 1
# ccosh
Test "Real part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
float: 1
ifloat: 1
Test "Imaginary part of: ccosh (-2 - 3 i) == -3.72454550491532256547397070325597253 + 0.511822569987384608834463849801875634 i":
float: 1
ifloat: 1
Test "Real part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "Imaginary part of: ccosh (0.75 + 1.25 i) == 0.408242591877968807788852146397499084 + 0.780365930845853240391326216300863152 i":
float: 1
ifloat: 1
# cexp
Test "Imaginary part of: cexp (-2.0 - 3.0 i) == -0.13398091492954261346140525546115575 - 0.019098516261135196432576240858800925 i":
float: 1
ifloat: 1
Test "Real part of: cexp (0.75 + 1.25 i) == 0.667537446429131586942201977015932112 + 2.00900045494094876258347228145863909 i":
float: 1
ifloat: 1
# clog
Test "Imaginary part of: clog (-2 - 3 i) == 1.2824746787307683680267437207826593 - 2.1587989303424641704769327722648368 i":
float: 3
ifloat: 3
Test "Real part of: clog (0.75 + 1.25 i) == 0.376885901188190075998919126749298416 + 1.03037682652431246378774332703115153 i":
float: 1
ifloat: 1
# clog10
Test "Imaginary part of: clog10 (-0 + inf i) == inf + pi/2*log10(e) i":
float: 1
ifloat: 1
Test "Imaginary part of: clog10 (-0 - inf i) == inf - pi/2*log10(e) i":
float: 1
ifloat: 1
Test "Imaginary part of: clog10 (-2 - 3 i) == 0.556971676153418384603252578971164214 - 0.937554462986374708541507952140189646 i":
double: 1
float: 5
idouble: 1
ifloat: 5
Test "Imaginary part of: clog10 (-3 + inf i) == inf + pi/2*log10(e) i":
float: 1
ifloat: 1
Test "Imaginary part of: clog10 (-3 - inf i) == inf - pi/2*log10(e) i":
float: 1
ifloat: 1
Test "Imaginary part of: clog10 (-inf + 0 i) == inf + pi*log10(e) i":
float: 1
ifloat: 1
Test "Imaginary part of: clog10 (-inf + 1 i) == inf + pi*log10(e) i":
float: 1
ifloat: 1
Test "Imaginary part of: clog10 (-inf - 0 i) == inf - pi*log10(e) i":
float: 1
ifloat: 1
Test "Imaginary part of: clog10 (-inf - 1 i) == inf - pi*log10(e) i":
float: 1
ifloat: 1
Test "Imaginary part of: clog10 (0 + inf i) == inf + pi/2*log10(e) i":
float: 1
ifloat: 1
Test "Imaginary part of: clog10 (0 - inf i) == inf - pi/2*log10(e) i":
float: 1
ifloat: 1
Test "Real part of: clog10 (0.75 + 1.25 i) == 0.163679467193165171449476605077428975 + 0.447486970040493067069984724340855636 i":
float: 1
ifloat: 1
Test "Imaginary part of: clog10 (3 + inf i) == inf + pi/2*log10(e) i":
float: 1
ifloat: 1
Test "Imaginary part of: clog10 (3 - inf i) == inf - pi/2*log10(e) i":
float: 1
ifloat: 1
Test "Imaginary part of: clog10 (inf + inf i) == inf + pi/4*log10(e) i":
float: 1
ifloat: 1
Test "Imaginary part of: clog10 (inf - inf i) == inf - pi/4*log10(e) i":
float: 1
ifloat: 1
# cos
Test "cos (M_PI_6l * 2.0) == 0.5":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "cos (M_PI_6l * 4.0) == -0.5":
double: 2
float: 1
idouble: 2
ifloat: 1
Test "cos (pi/2) == 0":
double: 1
float: 1
idouble: 1
ifloat: 1
# cpow
Test "Real part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
float: 1
ifloat: 1
Test "Imaginary part of: cpow (0.75 + 1.25 i, 0.0 + 1.0 i) == 0.331825439177608832276067945276730566 + 0.131338600281188544930936345230903032 i":
float: 1
ifloat: 1
Test "Real part of: cpow (0.75 + 1.25 i, 0.75 + 1.25 i) == 0.117506293914473555420279832210420483 + 0.346552747708338676483025352060418001 i":
double: 1
float: 4
idouble: 1
ifloat: 4
Test "Real part of: cpow (0.75 + 1.25 i, 1.0 + 1.0 i) == 0.0846958290317209430433805274189191353 + 0.513285749182902449043287190519090481 i":
double: 2
float: 3
idouble: 2
ifloat: 3
Test "Real part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
double: 1
float: 4
idouble: 1
ifloat: 4
Test "Imaginary part of: cpow (2 + 3 i, 4 + 0 i) == -119.0 - 120.0 i":
float: 2
ifloat: 2
Test "Imaginary part of: cpow (e + 0 i, 0 + 2 * M_PIl i) == 1.0 + 0.0 i":
double: 2
float: 2
idouble: 2
ifloat: 2
# csinh
Test "Imaginary part of: csinh (-2 - 3 i) == 3.59056458998577995201256544779481679 - 0.530921086248519805267040090660676560 i":
double: 1
idouble: 1
Test "Real part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
float: 1
ifloat: 1
Test "Imaginary part of: csinh (0.75 + 1.25 i) == 0.259294854551162779153349830618433028 + 1.22863452409509552219214606515777594 i":
float: 1
ifloat: 1
# csqrt
Test "Real part of: csqrt (-2 + 3 i) == 0.89597747612983812471573375529004348 + 1.6741492280355400404480393008490519 i":
float: 1
ifloat: 1
Test "Real part of: csqrt (-2 - 3 i) == 0.89597747612983812471573375529004348 - 1.6741492280355400404480393008490519 i":
float: 1
ifloat: 1
# ctan
Test "Real part of: ctan (-2 - 3 i) == 0.376402564150424829275122113032269084e-2 - 1.00323862735360980144635859782192726 i":
double: 1
idouble: 1
Test "Imaginary part of: ctan (0.75 + 1.25 i) == 0.160807785916206426725166058173438663 + 0.975363285031235646193581759755216379 i":
double: 1
idouble: 1
# ctanh
Test "Real part of: ctanh (-2 - 3 i) == -0.965385879022133124278480269394560686 + 0.988437503832249372031403430350121098e-2 i":
double: 1
float: 2
idouble: 1
ifloat: 2
Test "Imaginary part of: ctanh (0 + pi/4 i) == 0.0 + 1.0 i":
float: 1
ifloat: 1
Test "Real part of: ctanh (0.75 + 1.25 i) == 1.37260757053378320258048606571226857 + 0.385795952609750664177596760720790220 i":
double: 1
idouble: 1
# erf
Test "erf (1.25) == 0.922900128256458230136523481197281140":
double: 1
idouble: 1
# erfc
Test "erfc (2.0) == 0.00467773498104726583793074363274707139":
double: 1
idouble: 1
Test "erfc (4.125) == 0.542340079956506600531223408575531062e-8":
double: 1
idouble: 1
# exp10
Test "exp10 (-1) == 0.1":
double: 2
float: 1
idouble: 2
ifloat: 1
Test "exp10 (0.75) == 5.62341325190349080394951039776481231":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "exp10 (3) == 1000":
double: 6
float: 2
idouble: 6
ifloat: 2
# expm1
Test "expm1 (0.75) == 1.11700001661267466854536981983709561":
double: 1
idouble: 1
Test "expm1 (1) == M_El - 1.0":
float: 1
ifloat: 1
# hypot
Test "hypot (-0.7, -12.4) == 12.419742348374220601176836866763271":
float: 1
ifloat: 1
Test "hypot (-0.7, 12.4) == 12.419742348374220601176836866763271":
float: 1
ifloat: 1
Test "hypot (-12.4, -0.7) == 12.419742348374220601176836866763271":
float: 1
ifloat: 1
Test "hypot (-12.4, 0.7) == 12.419742348374220601176836866763271":
float: 1
ifloat: 1
Test "hypot (0.7, -12.4) == 12.419742348374220601176836866763271":
float: 1
ifloat: 1
Test "hypot (0.7, 12.4) == 12.419742348374220601176836866763271":
float: 1
ifloat: 1
Test "hypot (12.4, -0.7) == 12.419742348374220601176836866763271":
float: 1
ifloat: 1
Test "hypot (12.4, 0.7) == 12.419742348374220601176836866763271":
float: 1
ifloat: 1
# j0
Test "j0 (-4.0) == -3.9714980986384737228659076845169804197562E-1":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "j0 (0.75) == 0.864242275166648623555731103820923211":
float: 1
ifloat: 1
Test "j0 (10.0) == -0.245935764451348335197760862485328754":
double: 2
float: 1
idouble: 2
ifloat: 1
Test "j0 (2.0) == 0.223890779141235668051827454649948626":
float: 2
ifloat: 2
Test "j0 (4.0) == -3.9714980986384737228659076845169804197562E-1":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "j0 (8.0) == 0.171650807137553906090869407851972001":
float: 1
ifloat: 1
# j1
Test "j1 (10.0) == 0.0434727461688614366697487680258592883":
float: 2
ifloat: 2
Test "j1 (2.0) == 0.576724807756873387202448242269137087":
double: 1
idouble: 1
Test "j1 (8.0) == 0.234636346853914624381276651590454612":
double: 1
idouble: 1
# jn
Test "jn (0, -4.0) == -3.9714980986384737228659076845169804197562E-1":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "jn (0, 0.75) == 0.864242275166648623555731103820923211":
float: 1
ifloat: 1
Test "jn (0, 10.0) == -0.245935764451348335197760862485328754":
double: 2
float: 1
idouble: 2
ifloat: 1
Test "jn (0, 2.0) == 0.223890779141235668051827454649948626":
float: 2
ifloat: 2
Test "jn (0, 4.0) == -3.9714980986384737228659076845169804197562E-1":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "jn (0, 8.0) == 0.171650807137553906090869407851972001":
float: 1
ifloat: 1
Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883":
float: 2
ifloat: 2
Test "jn (1, 2.0) == 0.576724807756873387202448242269137087":
double: 1
idouble: 1
Test "jn (1, 8.0) == 0.234636346853914624381276651590454612":
double: 1
idouble: 1
Test "jn (10, 0.125) == 0.250543369809369890173993791865771547e-18":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "jn (10, 0.75) == 0.149621713117596814698712483621682835e-10":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "jn (10, 10.0) == 0.207486106633358857697278723518753428":
double: 4
float: 3
idouble: 4
ifloat: 3
Test "jn (10, 2.0) == 0.251538628271673670963516093751820639e-6":
float: 4
ifloat: 4
Test "jn (3, 0.125) == 0.406503832554912875023029337653442868e-4":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "jn (3, 0.75) == 0.848438342327410884392755236884386804e-2":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "jn (3, 10.0) == 0.0583793793051868123429354784103409563":
double: 3
float: 1
idouble: 3
ifloat: 1
Test "jn (3, 2.0) == 0.128943249474402051098793332969239835":
double: 1
float: 2
idouble: 1
ifloat: 2
# lgamma
Test "lgamma (0.7) == 0.260867246531666514385732417016759578":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "lgamma (1.2) == -0.853740900033158497197028392998854470e-1":
double: 1
float: 2
idouble: 1
ifloat: 2
# log10
Test "log10 (0.75) == -0.124938736608299953132449886193870744":
double: 1
float: 2
idouble: 1
ifloat: 2
Test "log10 (e) == log10(e)":
float: 1
ifloat: 1
# log1p
Test "log1p (-0.25) == -0.287682072451780927439219005993827432":
float: 1
ifloat: 1
# sincos
Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.5 in cos_res":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "sincos (M_PI_6l*2.0, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in sin_res":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "sincos (pi/2, &sin_res, &cos_res) puts 0 in cos_res":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "sincos (pi/6, &sin_res, &cos_res) puts 0.86602540378443864676372317075293616 in cos_res":
float: 1
ifloat: 1
# tan
Test "tan (pi/4) == 1":
double: 1
idouble: 1
# tgamma
Test "tgamma (-0.5) == -2 sqrt (pi)":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "tgamma (0.5) == sqrt (pi)":
float: 1
ifloat: 1
Test "tgamma (0.7) == 1.29805533264755778568117117915281162":
double: 1
float: 1
idouble: 1
ifloat: 1
# y0
Test "y0 (1.0) == 0.0882569642156769579829267660235151628":
double: 2
float: 1
idouble: 2
ifloat: 1
Test "y0 (1.5) == 0.382448923797758843955068554978089862":
double: 2
float: 1
idouble: 2
ifloat: 1
Test "y0 (10.0) == 0.0556711672835993914244598774101900481":
float: 1
ifloat: 1
Test "y0 (8.0) == 0.223521489387566220527323400498620359":
double: 1
float: 1
idouble: 1
ifloat: 1
# y1
Test "y1 (0.125) == -5.19993611253477499595928744876579921":
double: 1
idouble: 1
Test "y1 (1.5) == -0.412308626973911295952829820633445323":
float: 1
ifloat: 1
Test "y1 (10.0) == 0.249015424206953883923283474663222803":
double: 3
float: 1
idouble: 3
ifloat: 1
Test "y1 (2.0) == -0.107032431540937546888370772277476637":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "y1 (8.0) == -0.158060461731247494255555266187483550":
double: 1
float: 2
idouble: 1
ifloat: 2
# yn
Test "yn (0, 1.0) == 0.0882569642156769579829267660235151628":
double: 2
float: 1
idouble: 2
ifloat: 1
Test "yn (0, 1.5) == 0.382448923797758843955068554978089862":
double: 2
float: 1
idouble: 2
ifloat: 1
Test "yn (0, 10.0) == 0.0556711672835993914244598774101900481":
float: 1
ifloat: 1
Test "yn (0, 8.0) == 0.223521489387566220527323400498620359":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "yn (1, 0.125) == -5.19993611253477499595928744876579921":
double: 1
idouble: 1
Test "yn (1, 1.5) == -0.412308626973911295952829820633445323":
float: 1
ifloat: 1
Test "yn (1, 10.0) == 0.249015424206953883923283474663222803":
double: 3
float: 1
idouble: 3
ifloat: 1
Test "yn (1, 2.0) == -0.107032431540937546888370772277476637":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "yn (1, 8.0) == -0.158060461731247494255555266187483550":
double: 1
float: 2
idouble: 1
ifloat: 2
Test "yn (10, 0.125) == -127057845771019398.252538486899753195":
double: 1
idouble: 1
Test "yn (10, 0.75) == -2133501638.90573424452445412893839236":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "yn (10, 1.0) == -121618014.278689189288130426667971145":
double: 1
idouble: 1
Test "yn (10, 10.0) == -0.359814152183402722051986577343560609":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "yn (10, 2.0) == -129184.542208039282635913145923304214":
double: 2
idouble: 2
Test "yn (3, 0.125) == -2612.69757350066712600220955744091741":
double: 1
idouble: 1
Test "yn (3, 0.75) == -12.9877176234475433186319774484809207":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "yn (3, 10.0) == -0.251362657183837329779204747654240998":
double: 1
float: 1
idouble: 1
ifloat: 1
Test "yn (3, 2.0) == -1.12778377684042778608158395773179238":
double: 1
idouble: 1
# Maximal error of functions:
Function: "atan2":
float: 3
ifloat: 3
Function: "atanh":
float: 1
ifloat: 1
Function: Real part of "cacosh":
double: 1
float: 7
idouble: 1
ifloat: 7
Function: Imaginary part of "cacosh":
double: 1
float: 3
idouble: 1
ifloat: 3
Function: Real part of "casin":
double: 1
float: 1
idouble: 1
ifloat: 1
Function: Real part of "casinh":
double: 5
float: 1
idouble: 5
ifloat: 1
Function: Imaginary part of "casinh":
double: 3
float: 6
idouble: 3
ifloat: 6
Function: Real part of "catan":
float: 4
ifloat: 4
Function: Imaginary part of "catan":
double: 1
float: 1
idouble: 1
ifloat: 1
Function: Real part of "catanh":
double: 4
idouble: 4
Function: Imaginary part of "catanh":
float: 6
ifloat: 6
Function: "cbrt":
double: 1
idouble: 1
Function: Real part of "ccos":
double: 1
float: 1
idouble: 1
ifloat: 1
Function: Imaginary part of "ccos":
float: 1
ifloat: 1
Function: Real part of "ccosh":
double: 1
float: 1
idouble: 1
ifloat: 1
Function: Imaginary part of "ccosh":
float: 1
ifloat: 1
Function: Real part of "cexp":
float: 1
ifloat: 1
Function: Imaginary part of "cexp":
float: 1
ifloat: 1
Function: Real part of "clog":
float: 1
ifloat: 1
Function: Imaginary part of "clog":
float: 3
ifloat: 3
Function: Real part of "clog10":
float: 1
ifloat: 1
Function: Imaginary part of "clog10":
double: 1
float: 5
idouble: 1
ifloat: 5
Function: "cos":
double: 2
float: 1
idouble: 2
ifloat: 1
Function: Real part of "cpow":
double: 2
float: 4
idouble: 2
ifloat: 4
Function: Imaginary part of "cpow":
double: 2
float: 2
idouble: 2
ifloat: 2
Function: Real part of "csinh":
float: 1
ifloat: 1
Function: Imaginary part of "csinh":
double: 1
float: 1
idouble: 1
ifloat: 1
Function: Real part of "csqrt":
float: 1
ifloat: 1
Function: Real part of "ctan":
double: 1
idouble: 1
Function: Imaginary part of "ctan":
double: 1
idouble: 1
Function: Real part of "ctanh":
double: 1
float: 2
idouble: 1
ifloat: 2
Function: Imaginary part of "ctanh":
float: 1
ifloat: 1
Function: "erf":
double: 1
idouble: 1
Function: "erfc":
double: 1
idouble: 1
Function: "exp10":
double: 6
float: 2
idouble: 6
ifloat: 2
Function: "expm1":
double: 1
float: 1
idouble: 1
ifloat: 1
Function: "hypot":
float: 1
ifloat: 1
Function: "j0":
double: 2
float: 2
idouble: 2
ifloat: 2
Function: "j1":
double: 1
float: 2
idouble: 1
ifloat: 2
Function: "jn":
double: 4
float: 4
idouble: 4
ifloat: 4
Function: "lgamma":
double: 1
float: 2
idouble: 1
ifloat: 2
Function: "log10":
double: 1
float: 2
idouble: 1
ifloat: 2
Function: "log1p":
float: 1
ifloat: 1
Function: "sincos":
double: 1
float: 1
idouble: 1
ifloat: 1
Function: "tan":
double: 1
idouble: 1
Function: "tgamma":
double: 1
float: 1
idouble: 1
ifloat: 1
Function: "y0":
double: 2
float: 1
idouble: 2
ifloat: 1
Function: "y1":
double: 3
float: 2
idouble: 3
ifloat: 2
Function: "yn":
double: 3
float: 2
idouble: 3
ifloat: 2
# end of automatic generation

View File

@ -1,98 +0,0 @@
/* FPU control word bits. Mips version.
Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Olaf Flebbe and Ralf Baechle.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _FPU_CONTROL_H
#define _FPU_CONTROL_H
/* MIPS FPU floating point control register bits.
*
* 31-25 -> floating point conditions code bits 7-1. These bits are only
* available in MIPS IV.
* 24 -> flush denormalized results to zero instead of
* causing unimplemented operation exception. This bit is only
* available for MIPS III and newer.
* 23 -> Condition bit
* 22-18 -> reserved (read as 0, write with 0)
* 17 -> cause bit for unimplemented operation
* 16 -> cause bit for invalid exception
* 15 -> cause bit for division by zero exception
* 14 -> cause bit for overflow exception
* 13 -> cause bit for underflow exception
* 12 -> cause bit for inexact exception
* 11 -> enable exception for invalid exception
* 10 -> enable exception for division by zero exception
* 9 -> enable exception for overflow exception
* 8 -> enable exception for underflow exception
* 7 -> enable exception for inexact exception
* 6 -> flag invalid exception
* 5 -> flag division by zero exception
* 4 -> flag overflow exception
* 3 -> flag underflow exception
* 2 -> flag inexact exception
* 1-0 -> rounding control
*
*
* Rounding Control:
* 00 - rounding to nearest (RN)
* 01 - rounding toward zero (RZ)
* 10 - rounding (up) toward plus infinity (RP)
* 11 - rounding (down)toward minus infinity (RM)
*/
#include <features.h>
/* masking of interrupts */
#define _FPU_MASK_V 0x0800 /* Invalid operation */
#define _FPU_MASK_Z 0x0400 /* Division by zero */
#define _FPU_MASK_O 0x0200 /* Overflow */
#define _FPU_MASK_U 0x0100 /* Underflow */
#define _FPU_MASK_I 0x0080 /* Inexact operation */
/* flush denormalized numbers to zero */
#define _FPU_FLUSH_TZ 0x1000000
/* rounding control */
#define _FPU_RC_NEAREST 0x0 /* RECOMMENDED */
#define _FPU_RC_ZERO 0x1
#define _FPU_RC_UP 0x2
#define _FPU_RC_DOWN 0x3
#define _FPU_RESERVED 0xfe3c0000 /* Reserved bits in cw */
/* The fdlibm code requires strict IEEE double precision arithmetic,
and no interrupts for exceptions, rounding to nearest. */
#define _FPU_DEFAULT 0x00000000
/* IEEE: same as above, but exceptions */
#define _FPU_IEEE 0x00000F80
/* Type of the control word. */
typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__SI__)));
/* Macros for accessing the hardware control word. */
#define _FPU_GETCW(cw) __asm__ ("cfc1 %0,$31" : "=r" (cw))
#define _FPU_SETCW(cw) __asm__ ("ctc1 %0,$31" : : "r" (cw))
/* Default control word set at startup. */
extern fpu_control_t __fpu_control;
#endif /* fpu_control.h */

View File

@ -1,22 +0,0 @@
/* Definition of object in frame unwind info. mips version.
Copyright (C) 2001 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#define FIRST_PSEUDO_REGISTER 76
#include <sysdeps/generic/gccframe.h>

View File

@ -1,325 +0,0 @@
/* Copyright (C) 1992, 1995, 1996, 1999, 2002, 2003
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef _IEEE754_H
#define _IEEE754_H 1
#include <features.h>
#include <endian.h>
#include <float.h>
__BEGIN_DECLS
union ieee754_float
{
float f;
/* This is the IEEE 754 single-precision format. */
struct
{
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned int negative:1;
unsigned int exponent:8;
unsigned int mantissa:23;
#endif /* Big endian. */
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int mantissa:23;
unsigned int exponent:8;
unsigned int negative:1;
#endif /* Little endian. */
} ieee;
/* This format makes it easier to see if a NaN is a signalling NaN. */
struct
{
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned int negative:1;
unsigned int exponent:8;
unsigned int quiet_nan:1;
unsigned int mantissa:22;
#endif /* Big endian. */
#if __BYTE_ORDER == __LITTLE_ENDIAN
unsigned int mantissa:22;
unsigned int quiet_nan:1;
unsigned int exponent:8;
unsigned int negative:1;
#endif /* Little endian. */
} ieee_nan;
};
#define IEEE754_FLOAT_BIAS 0x7f /* Added to exponent. */
union ieee754_double
{
double d;
/* This is the IEEE 754 double-precision format. */
struct
{
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned int negative:1;
unsigned int exponent:11;
/* Together these comprise the mantissa. */
unsigned int mantissa0:20;
unsigned int mantissa1:32;
#endif /* Big endian. */
#if __BYTE_ORDER == __LITTLE_ENDIAN
# if __FLOAT_WORD_ORDER == BIG_ENDIAN
unsigned int mantissa0:20;
unsigned int exponent:11;
unsigned int negative:1;
unsigned int mantissa1:32;
# else
/* Together these comprise the mantissa. */
unsigned int mantissa1:32;
unsigned int mantissa0:20;
unsigned int exponent:11;
unsigned int negative:1;
# endif
#endif /* Little endian. */
} ieee;
/* This format makes it easier to see if a NaN is a signalling NaN. */
struct
{
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned int negative:1;
unsigned int exponent:11;
unsigned int quiet_nan:1;
/* Together these comprise the mantissa. */
unsigned int mantissa0:19;
unsigned int mantissa1:32;
#else
# if __FLOAT_WORD_ORDER == BIG_ENDIAN
unsigned int mantissa0:19;
unsigned int quiet_nan:1;
unsigned int exponent:11;
unsigned int negative:1;
unsigned int mantissa1:32;
# else
/* Together these comprise the mantissa. */
unsigned int mantissa1:32;
unsigned int mantissa0:19;
unsigned int quiet_nan:1;
unsigned int exponent:11;
unsigned int negative:1;
# endif
#endif
} ieee_nan;
};
#define IEEE754_DOUBLE_BIAS 0x3ff /* Added to exponent. */
#if LDBL_MANT_DIG == 113
union ieee854_long_double
{
long double d;
/* This is the IEEE 854 quad-precision format. */
struct
{
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned int negative:1;
unsigned int exponent:15;
/* Together these comprise the mantissa. */
unsigned int mantissa0:16;
unsigned int mantissa1:32;
unsigned int mantissa2:32;
unsigned int mantissa3:32;
#endif /* Big endian. */
#if __BYTE_ORDER == __LITTLE_ENDIAN
/* Together these comprise the mantissa. */
unsigned int mantissa3:32;
unsigned int mantissa2:32;
unsigned int mantissa1:32;
unsigned int mantissa0:16;
unsigned int exponent:15;
unsigned int negative:1;
#endif /* Little endian. */
} ieee;
/* This format makes it easier to see if a NaN is a signalling NaN. */
struct
{
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned int negative:1;
unsigned int exponent:15;
unsigned int quiet_nan:1;
/* Together these comprise the mantissa. */
unsigned int mantissa0:15;
unsigned int mantissa1:32;
unsigned int mantissa2:32;
unsigned int mantissa3:32;
#endif /* Big endian. */
#if __BYTE_ORDER == __LITTLE_ENDIAN
/* Together these comprise the mantissa. */
unsigned int mantissa3:32;
unsigned int mantissa2:32;
unsigned int mantissa1:32;
unsigned int mantissa0:15;
unsigned int quiet_nan:1;
unsigned int exponent:15;
unsigned int negative:1;
#endif /* Little endian. */
} ieee_nan;
};
#define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent. */
#elif LDBL_MANT_DIG == 64
union ieee854_long_double
{
long double d;
/* This is the IEEE 854 double-extended-precision format. */
struct
{
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned int negative:1;
unsigned int exponent:15;
unsigned int empty:16;
unsigned int mantissa0:32;
unsigned int mantissa1:32;
#endif
#if __BYTE_ORDER == __LITTLE_ENDIAN
# if __FLOAT_WORD_ORDER == BIG_ENDIAN
unsigned int exponent:15;
unsigned int negative:1;
unsigned int empty:16;
unsigned int mantissa0:32;
unsigned int mantissa1:32;
# else
unsigned int mantissa1:32;
unsigned int mantissa0:32;
unsigned int exponent:15;
unsigned int negative:1;
unsigned int empty:16;
# endif
#endif
} ieee;
/* This is for NaNs in the IEEE 854 double-extended-precision format. */
struct
{
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned int negative:1;
unsigned int exponent:15;
unsigned int empty:16;
unsigned int one:1;
unsigned int quiet_nan:1;
unsigned int mantissa0:30;
unsigned int mantissa1:32;
#endif
#if __BYTE_ORDER == __LITTLE_ENDIAN
# if __FLOAT_WORD_ORDER == BIG_ENDIAN
unsigned int exponent:15;
unsigned int negative:1;
unsigned int empty:16;
unsigned int mantissa0:30;
unsigned int quiet_nan:1;
unsigned int one:1;
unsigned int mantissa1:32;
# else
unsigned int mantissa1:32;
unsigned int mantissa0:30;
unsigned int quiet_nan:1;
unsigned int one:1;
unsigned int exponent:15;
unsigned int negative:1;
unsigned int empty:16;
# endif
#endif
} ieee_nan;
};
#define IEEE854_LONG_DOUBLE_BIAS 0x3fff
#elif LDBL_MANT_DIG == 53
union ieee854_long_double
{
long double d;
/* This is the IEEE 754 double-precision format. */
struct
{
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned int negative:1;
unsigned int exponent:11;
/* Together these comprise the mantissa. */
unsigned int mantissa0:20;
unsigned int mantissa1:32;
#endif /* Big endian. */
#if __BYTE_ORDER == __LITTLE_ENDIAN
# if __FLOAT_WORD_ORDER == BIG_ENDIAN
unsigned int mantissa0:20;
unsigned int exponent:11;
unsigned int negative:1;
unsigned int mantissa1:32;
# else
/* Together these comprise the mantissa. */
unsigned int mantissa1:32;
unsigned int mantissa0:20;
unsigned int exponent:11;
unsigned int negative:1;
# endif
#endif /* Little endian. */
} ieee;
/* This format makes it easier to see if a NaN is a signalling NaN. */
struct
{
#if __BYTE_ORDER == __BIG_ENDIAN
unsigned int negative:1;
unsigned int exponent:11;
unsigned int quiet_nan:1;
/* Together these comprise the mantissa. */
unsigned int mantissa0:19;
unsigned int mantissa1:32;
#else
# if __FLOAT_WORD_ORDER == BIG_ENDIAN
unsigned int mantissa0:19;
unsigned int quiet_nan:1;
unsigned int exponent:11;
unsigned int negative:1;
unsigned int mantissa1:32;
# else
/* Together these comprise the mantissa. */
unsigned int mantissa1:32;
unsigned int mantissa0:19;
unsigned int quiet_nan:1;
unsigned int exponent:11;
unsigned int negative:1;
# endif
#endif
} ieee_nan;
};
#define IEEE854_LONG_DOUBLE_BIAS 0x3ff /* Added to exponent. */
#endif /* LDBL_MANT_DIG == 53 */
__END_DECLS
#endif /* ieee754.h */

View File

@ -1,64 +0,0 @@
/* Initialization code run first thing by the ELF startup code. For mips/Unix.
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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <unistd.h>
extern void __libc_init (int, char **, char **);
extern void __libc_global_ctors (void);
static void
init (int *data)
{
int argc = *data;
char **argv = (void *) (data + 1);
char **envp = &argv[argc + 1];
__environ = envp;
__libc_init (argc, argv, envp);
}
#ifdef SHARED
/* This function is called to initialize the shared C library.
It is called just before the user _start code from mips/elf/start.S,
with the stack set up as that code gets it. */
/* NOTE! The linker notices the magical name `_init' and sets the DT_INIT
pointer in the dynamic section based solely on that. It is convention
for this function to be in the `.init' section, but the symbol name is
the only thing that really matters!! */
/*void _init (int argc, ...) __attribute__ ((unused, section (".init")));*/
void
_init (int argc, ...)
{
init (&argc);
__libc_global_ctors ();
}
#endif
void
__libc_init_first (int argc __attribute__ ((unused)), ...)
{
#ifndef SHARED
init (&argc);
#endif
}

View File

@ -1,46 +0,0 @@
/* Copyright (C) 2003, 2005, 2006 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <setjmp.h>
#include <stdint.h>
#include <unwind.h>
#include <sysdep.h>
/* Test if longjmp to JMPBUF would unwind the frame
containing a local variable at ADDRESS. */
#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
((void *) (address) < (void *) demangle ((jmpbuf)[0].__sp))
#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
_JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
static inline uintptr_t __attribute__ ((unused))
_jmpbuf_sp (__jmp_buf regs)
{
uintptr_t sp = regs[0].__sp;
#ifdef PTR_DEMANGLE
PTR_DEMANGLE (sp);
#endif
return sp;
}
#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \
((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj))
/* We use the normal longjmp for unwinding. */
#define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val)

View File

@ -1,37 +0,0 @@
/* Thread-local storage handling in the ELF dynamic linker. MIPS version.
Copyright (C) 2005 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 Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <csu/libc-tls.c>
#include <dl-tls.h>
#if USE_TLS
/* On MIPS, linker optimizations are not required, so __tls_get_addr
can be called even in statically linked binaries. In this case module
must be always 1 and PT_TLS segment exist in the binary, otherwise it
would not link. */
void *
__tls_get_addr (tls_index *ti)
{
dtv_t *dtv = THREAD_DTV ();
return (char *) dtv[1].pointer.val + GET_ADDR_OFFSET;
}
#endif

View File

@ -1,98 +0,0 @@
/* MIPS2 __mpn_lshift --
Copyright (C) 1995, 2000, 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at your
option) any later version.
The GNU MP 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 Lesser General Public
License for more details.
You should have received a copy of the GNU Lesser General Public License
along with the GNU MP 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 <sysdep.h>
/* INPUT PARAMETERS
res_ptr $4
src_ptr $5
size $6
cnt $7
*/
#ifdef __PIC__
.option pic2
#endif
ENTRY (__mpn_lshift)
.set noreorder
#ifdef __PIC__
.cpload t9
#endif
.set nomacro
sll $2,$6,2
addu $5,$5,$2 /* make r5 point at end of src */
lw $10,-4($5) /* load first limb */
subu $13,$0,$7
addu $4,$4,$2 /* make r4 point at end of res */
addiu $6,$6,-1
and $9,$6,4-1 /* number of limbs in first loop */
beq $9,$0,L(L0) /* if multiple of 4 limbs, skip first loop */
srl $2,$10,$13 /* compute function result */
subu $6,$6,$9
L(Loop0): lw $3,-8($5)
addiu $4,$4,-4
addiu $5,$5,-4
addiu $9,$9,-1
sll $11,$10,$7
srl $12,$3,$13
move $10,$3
or $8,$11,$12
bne $9,$0,L(Loop0)
sw $8,0($4)
L(L0): beq $6,$0,L(Lend)
nop
L(Loop): lw $3,-8($5)
addiu $4,$4,-16
addiu $6,$6,-4
sll $11,$10,$7
srl $12,$3,$13
lw $10,-12($5)
sll $14,$3,$7
or $8,$11,$12
sw $8,12($4)
srl $9,$10,$13
lw $3,-16($5)
sll $11,$10,$7
or $8,$14,$9
sw $8,8($4)
srl $12,$3,$13
lw $10,-20($5)
sll $14,$3,$7
or $8,$11,$12
sw $8,4($4)
srl $9,$10,$13
addiu $5,$5,-16
or $8,$14,$9
bgtz $6,L(Loop)
sw $8,0($4)
L(Lend): sll $8,$10,$7
j $31
sw $8,-4($4)
END (__mpn_lshift)

Some files were not shown because too many files have changed in this diff Show More