mirror of
git://sourceware.org/git/glibc.git
synced 2025-04-06 14:10:30 +08:00
Update.
* sysdeps/unix/sysv/linux/x86_64/Makefile: New file. * sysdeps/unix/sysv/linux/x86_64/Versions: New file. * sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h: New file. * sysdeps/unix/sysv/linux/x86_64/bits/mman.h: New file. * sysdeps/unix/sysv/linux/x86_64/bits/stat.h: New file. * sysdeps/unix/sysv/linux/x86_64/bits/statfs.h: New file. * sysdeps/unix/sysv/linux/x86_64/bits/time.h: New file. * sysdeps/unix/sysv/linux/x86_64/bits/types.h: New file. * sysdeps/unix/sysv/linux/x86_64/brk.c: New file. * sysdeps/unix/sysv/linux/x86_64/clone.S: New file. * sysdeps/unix/sysv/linux/x86_64/fstatfs64.c: New file. * sysdeps/unix/sysv/linux/x86_64/ftruncate64.c: New file. * sysdeps/unix/sysv/linux/x86_64/fxstat.c: New file. * sysdeps/unix/sysv/linux/x86_64/fxstat64.c: New file. * sysdeps/unix/sysv/linux/x86_64/getdents.c: New file. * sysdeps/unix/sysv/linux/x86_64/getdents64.c: New file. * sysdeps/unix/sysv/linux/x86_64/getrlimit64.c: New file. * sysdeps/unix/sysv/linux/x86_64/gettimeofday.c: New file. * sysdeps/unix/sysv/linux/x86_64/glob64.c: New file. * sysdeps/unix/sysv/linux/x86_64/lxstat.c: New file. * sysdeps/unix/sysv/linux/x86_64/lxstat64.c: New file. * sysdeps/unix/sysv/linux/x86_64/mmap64.c: New file. * sysdeps/unix/sysv/linux/x86_64/pread64.c: New file. * sysdeps/unix/sysv/linux/x86_64/profil-counter.h: New file. * sysdeps/unix/sysv/linux/x86_64/pwrite64.c: New file. * sysdeps/unix/sysv/linux/x86_64/readdir.c: New file. * sysdeps/unix/sysv/linux/x86_64/readdir64.c: New file. * sysdeps/unix/sysv/linux/x86_64/readdir64_r.c: New file. * sysdeps/unix/sysv/linux/x86_64/readdir_r.c: New file. * sysdeps/unix/sysv/linux/x86_64/recv.c: New file. * sysdeps/unix/sysv/linux/x86_64/register-dump.h: New file. * sysdeps/unix/sysv/linux/x86_64/send.c: New file. * sysdeps/unix/sysv/linux/x86_64/setrlimit64.c: New file. * sysdeps/unix/sysv/linux/x86_64/sigaction.c: New file. * sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h: New file. * sysdeps/unix/sysv/linux/x86_64/sigpending.c: New file. * sysdeps/unix/sysv/linux/x86_64/sigprocmask.c: New file. * sysdeps/unix/sysv/linux/x86_64/sigsuspend.c: New file. * sysdeps/unix/sysv/linux/x86_64/statfs64.c: New file. * sysdeps/unix/sysv/linux/x86_64/sys/perm.h: New file. * sysdeps/unix/sysv/linux/x86_64/sys/procfs.h: New file. * sysdeps/unix/sysv/linux/x86_64/sys/reg.h: New file. * sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h: New file. * sysdeps/unix/sysv/linux/x86_64/sys/user.h: New file. * sysdeps/unix/sysv/linux/x86_64/syscall.S: New file. * sysdeps/unix/sysv/linux/x86_64/syscalls.list: New file. * sysdeps/unix/sysv/linux/x86_64/sysdep.S: New file. * sysdeps/unix/sysv/linux/x86_64/sysdep.h: New file. * sysdeps/unix/sysv/linux/x86_64/time.c: New file. * sysdeps/unix/sysv/linux/x86_64/truncate64.c: New file. * sysdeps/unix/sysv/linux/x86_64/umount.c: New file. * sysdeps/unix/sysv/linux/x86_64/vfork.S: New file. * sysdeps/unix/sysv/linux/x86_64/xstat.c: New file. * sysdeps/unix/sysv/linux/x86_64/xstat64.c: New file. * sysdeps/unix/x86_64/sysdep.S: New file. * sysdeps/unix/x86_64/sysdep.h: New file. * sysdeps/x86_64/Implies: New file. * sysdeps/x86_64/Makefile: New file. * sysdeps/x86_64/Versions: New file. * sysdeps/x86_64/__longjmp.S: New file. * sysdeps/x86_64/abort-instr.h: New file. * sysdeps/x86_64/atomicity.h: New file. * sysdeps/x86_64/bits/endian.h: New file. * sysdeps/x86_64/bits/setjmp.h: New file. * sysdeps/x86_64/bits/string.h: New file. * sysdeps/x86_64/bp-asm.h: New file. * sysdeps/x86_64/bsd-_setjmp.S: New file. * sysdeps/x86_64/bsd-setjmp.S: New file. * sysdeps/x86_64/dl-machine.h: New file. * sysdeps/x86_64/elf/initfini.c: New file. * sysdeps/x86_64/elf/start.S: New file. * sysdeps/x86_64/ffs.c: New file. * sysdeps/x86_64/ffsll.c: New file. * sysdeps/x86_64/fpu/bits/fenv.h: New file. * sysdeps/x86_64/fpu/bits/mathdef.h: New file. * sysdeps/x86_64/fpu/e_acosl.c: New file. * sysdeps/x86_64/fpu/e_atan2l.c: New file. * sysdeps/x86_64/fpu/e_exp2l.S: New file. * sysdeps/x86_64/fpu/e_expl.c: New file. * sysdeps/x86_64/fpu/e_fmodl.S: New file. * sysdeps/x86_64/fpu/e_log10l.S: New file. * sysdeps/x86_64/fpu/e_log2l.S: New file. * sysdeps/x86_64/fpu/e_logl.S: New file. * sysdeps/x86_64/fpu/e_powl.S: New file. * sysdeps/x86_64/fpu/e_rem_pio2l.c: New file. * sysdeps/x86_64/fpu/e_scalbl.S: New file. * sysdeps/x86_64/fpu/e_sqrtl.c: New file. * sysdeps/x86_64/fpu/fclrexcpt.c: New file. * sysdeps/x86_64/fpu/fedisblxcpt.c: New file. * sysdeps/x86_64/fpu/feenablxcpt.c: New file. * sysdeps/x86_64/fpu/fegetenv.c: New file. * sysdeps/x86_64/fpu/fegetexcept.c: New file. * sysdeps/x86_64/fpu/fegetround.c: New file. * sysdeps/x86_64/fpu/feholdexcpt.c: New file. * sysdeps/x86_64/fpu/fesetenv.c: New file. * sysdeps/x86_64/fpu/fesetround.c: New file. * sysdeps/x86_64/fpu/fgetexcptflg.c: New file. * sysdeps/x86_64/fpu/fraiseexcpt.c: New file. * sysdeps/x86_64/fpu/fsetexcptflg.c: New file. * sysdeps/x86_64/fpu/ftestexcept.c: New file. * sysdeps/x86_64/fpu/libm-test-ulps: New file. * sysdeps/x86_64/fpu/math_ldbl.h: New file. * sysdeps/x86_64/fpu/printf_fphex.c: New file. * sysdeps/x86_64/fpu/s_atanl.c: New file. * sysdeps/x86_64/fpu/s_cosl.S: New file. * sysdeps/x86_64/fpu/s_expm1l.S: New file. * sysdeps/x86_64/fpu/s_fpclassifyl.c: New file. * sysdeps/x86_64/fpu/s_isinfl.c: New file. * sysdeps/x86_64/fpu/s_isnanl.c: New file. * sysdeps/x86_64/fpu/s_log1pl.S: New file. * sysdeps/x86_64/fpu/s_logbl.c: New file. * sysdeps/x86_64/fpu/s_nextafterl.c: New file. * sysdeps/x86_64/fpu/s_nexttoward.c: New file. * sysdeps/x86_64/fpu/s_nexttowardf.c: New file. * sysdeps/x86_64/fpu/s_rintl.c: New file. * sysdeps/x86_64/fpu/s_significandl.c: New file. * sysdeps/x86_64/fpu/s_sincosl.S: New file. * sysdeps/x86_64/fpu/s_sinl.S: New file. * sysdeps/x86_64/fpu/s_tanl.S: New file. * sysdeps/x86_64/gmp-mparam.h: New file. * sysdeps/x86_64/hp-timing.c: New file. * sysdeps/x86_64/hp-timing.h: New file. * sysdeps/x86_64/htonl.S: New file. * sysdeps/x86_64/memusage.h: New file. * sysdeps/x86_64/setjmp.S: New file. * sysdeps/x86_64/soft-fp/sfp-machine.h: New file. * sysdeps/x86_64/stackinfo.h: New file. * sysdeps/x86_64/sysdep.h: New file. * sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed: New file.
This commit is contained in:
parent
71ad6ad2b5
commit
c9cf6ddeeb
130
ChangeLog
130
ChangeLog
@ -1,5 +1,135 @@
|
||||
2001-09-19 Andreas Jaeger <aj@suse.de>
|
||||
|
||||
* sysdeps/unix/sysv/linux/x86_64/Makefile: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/Versions: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/bits/mman.h: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/bits/stat.h: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/bits/statfs.h: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/bits/time.h: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/bits/types.h: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/brk.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/clone.S: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/fstatfs64.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/ftruncate64.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/fxstat.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/fxstat64.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/getdents.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/getdents64.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/getrlimit64.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/gettimeofday.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/glob64.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/lxstat.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/lxstat64.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/mmap64.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/pread64.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/profil-counter.h: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/pwrite64.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/readdir.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/readdir64.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/readdir64_r.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/readdir_r.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/recv.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/register-dump.h: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/send.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/setrlimit64.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/sigaction.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/sigpending.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/sigprocmask.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/sigsuspend.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/statfs64.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/sys/perm.h: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/sys/procfs.h: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/sys/reg.h: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/sys/user.h: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/syscall.S: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/syscalls.list: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/sysdep.S: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/sysdep.h: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/time.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/truncate64.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/umount.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/vfork.S: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/xstat.c: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/xstat64.c: New file.
|
||||
* sysdeps/unix/x86_64/sysdep.S: New file.
|
||||
* sysdeps/unix/x86_64/sysdep.h: New file.
|
||||
* sysdeps/x86_64/Implies: New file.
|
||||
* sysdeps/x86_64/Makefile: New file.
|
||||
* sysdeps/x86_64/Versions: New file.
|
||||
* sysdeps/x86_64/__longjmp.S: New file.
|
||||
* sysdeps/x86_64/abort-instr.h: New file.
|
||||
* sysdeps/x86_64/atomicity.h: New file.
|
||||
* sysdeps/x86_64/bits/endian.h: New file.
|
||||
* sysdeps/x86_64/bits/setjmp.h: New file.
|
||||
* sysdeps/x86_64/bits/string.h: New file.
|
||||
* sysdeps/x86_64/bp-asm.h: New file.
|
||||
* sysdeps/x86_64/bsd-_setjmp.S: New file.
|
||||
* sysdeps/x86_64/bsd-setjmp.S: New file.
|
||||
* sysdeps/x86_64/dl-machine.h: New file.
|
||||
* sysdeps/x86_64/elf/initfini.c: New file.
|
||||
* sysdeps/x86_64/elf/start.S: New file.
|
||||
* sysdeps/x86_64/ffs.c: New file.
|
||||
* sysdeps/x86_64/ffsll.c: New file.
|
||||
* sysdeps/x86_64/fpu/bits/fenv.h: New file.
|
||||
* sysdeps/x86_64/fpu/bits/mathdef.h: New file.
|
||||
* sysdeps/x86_64/fpu/e_acosl.c: New file.
|
||||
* sysdeps/x86_64/fpu/e_atan2l.c: New file.
|
||||
* sysdeps/x86_64/fpu/e_exp2l.S: New file.
|
||||
* sysdeps/x86_64/fpu/e_expl.c: New file.
|
||||
* sysdeps/x86_64/fpu/e_fmodl.S: New file.
|
||||
* sysdeps/x86_64/fpu/e_log10l.S: New file.
|
||||
* sysdeps/x86_64/fpu/e_log2l.S: New file.
|
||||
* sysdeps/x86_64/fpu/e_logl.S: New file.
|
||||
* sysdeps/x86_64/fpu/e_powl.S: New file.
|
||||
* sysdeps/x86_64/fpu/e_rem_pio2l.c: New file.
|
||||
* sysdeps/x86_64/fpu/e_scalbl.S: New file.
|
||||
* sysdeps/x86_64/fpu/e_sqrtl.c: New file.
|
||||
* sysdeps/x86_64/fpu/fclrexcpt.c: New file.
|
||||
* sysdeps/x86_64/fpu/fedisblxcpt.c: New file.
|
||||
* sysdeps/x86_64/fpu/feenablxcpt.c: New file.
|
||||
* sysdeps/x86_64/fpu/fegetenv.c: New file.
|
||||
* sysdeps/x86_64/fpu/fegetexcept.c: New file.
|
||||
* sysdeps/x86_64/fpu/fegetround.c: New file.
|
||||
* sysdeps/x86_64/fpu/feholdexcpt.c: New file.
|
||||
* sysdeps/x86_64/fpu/fesetenv.c: New file.
|
||||
* sysdeps/x86_64/fpu/fesetround.c: New file.
|
||||
* sysdeps/x86_64/fpu/fgetexcptflg.c: New file.
|
||||
* sysdeps/x86_64/fpu/fraiseexcpt.c: New file.
|
||||
* sysdeps/x86_64/fpu/fsetexcptflg.c: New file.
|
||||
* sysdeps/x86_64/fpu/ftestexcept.c: New file.
|
||||
* sysdeps/x86_64/fpu/libm-test-ulps: New file.
|
||||
* sysdeps/x86_64/fpu/math_ldbl.h: New file.
|
||||
* sysdeps/x86_64/fpu/printf_fphex.c: New file.
|
||||
* sysdeps/x86_64/fpu/s_atanl.c: New file.
|
||||
* sysdeps/x86_64/fpu/s_cosl.S: New file.
|
||||
* sysdeps/x86_64/fpu/s_expm1l.S: New file.
|
||||
* sysdeps/x86_64/fpu/s_fpclassifyl.c: New file.
|
||||
* sysdeps/x86_64/fpu/s_isinfl.c: New file.
|
||||
* sysdeps/x86_64/fpu/s_isnanl.c: New file.
|
||||
* sysdeps/x86_64/fpu/s_log1pl.S: New file.
|
||||
* sysdeps/x86_64/fpu/s_logbl.c: New file.
|
||||
* sysdeps/x86_64/fpu/s_nextafterl.c: New file.
|
||||
* sysdeps/x86_64/fpu/s_nexttoward.c: New file.
|
||||
* sysdeps/x86_64/fpu/s_nexttowardf.c: New file.
|
||||
* sysdeps/x86_64/fpu/s_rintl.c: New file.
|
||||
* sysdeps/x86_64/fpu/s_significandl.c: New file.
|
||||
* sysdeps/x86_64/fpu/s_sincosl.S: New file.
|
||||
* sysdeps/x86_64/fpu/s_sinl.S: New file.
|
||||
* sysdeps/x86_64/fpu/s_tanl.S: New file.
|
||||
* sysdeps/x86_64/gmp-mparam.h: New file.
|
||||
* sysdeps/x86_64/hp-timing.c: New file.
|
||||
* sysdeps/x86_64/hp-timing.h: New file.
|
||||
* sysdeps/x86_64/htonl.S: New file.
|
||||
* sysdeps/x86_64/memusage.h: New file.
|
||||
* sysdeps/x86_64/setjmp.S: New file.
|
||||
* sysdeps/x86_64/soft-fp/sfp-machine.h: New file.
|
||||
* sysdeps/x86_64/stackinfo.h: New file.
|
||||
* sysdeps/x86_64/sysdep.h: New file.
|
||||
* sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed: New file.
|
||||
|
||||
* sysdeps/ieee754/ldbl-128/s_erfl.c: New file, contributed Stephen
|
||||
L Moshier.
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
2001-09-19 Andreas Jaeger <aj@suse.de>
|
||||
|
||||
* sysdeps/x86_64/Makefile: New file.
|
||||
* sysdeps/x86_64/pspinlock.c: New file.
|
||||
* sysdeps/x86_64/pt-machine.h: New file.
|
||||
|
||||
2001-09-12 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* sysdeps/pthread/timer_delete.c (timer_delete): Thread may be NULL
|
||||
|
4
linuxthreads/sysdeps/x86_64/Makefile
Normal file
4
linuxthreads/sysdeps/x86_64/Makefile
Normal file
@ -0,0 +1,4 @@
|
||||
ifeq ($(subdir),linuxthreads)
|
||||
# On x86-64 we must avoid generating the unwind-info
|
||||
CFLAGS-pt-initfini.s += -mno-unwind-info
|
||||
endif
|
97
linuxthreads/sysdeps/x86_64/pspinlock.c
Normal file
97
linuxthreads/sysdeps/x86_64/pspinlock.c
Normal file
@ -0,0 +1,97 @@
|
||||
/* POSIX spinlock implementation. x86-64 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. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "internals.h"
|
||||
|
||||
/* This implementation is similar to the one used in the Linux kernel.
|
||||
But the kernel is byte instructions for the memory access. This is
|
||||
faster but unusable here. The problem is that only 128
|
||||
threads/processes could use the spinlock at the same time. If (by
|
||||
a design error in the program) a thread/process would hold the
|
||||
spinlock for a time long enough to accumulate 128 waiting
|
||||
processes, the next one will find a positive value in the spinlock
|
||||
and assume it is unlocked. We cannot accept that. */
|
||||
|
||||
int
|
||||
__pthread_spin_lock (pthread_spinlock_t *lock)
|
||||
{
|
||||
asm volatile
|
||||
("\n"
|
||||
"1:\n\t"
|
||||
"lock; decl %0\n\t"
|
||||
"js 2f\n\t"
|
||||
".section .text.spinlock,\"ax\"\n"
|
||||
"2:\n\t"
|
||||
"cmpl $0,%0\n\t"
|
||||
"rep; nop\n\t"
|
||||
"jle 2b\n\t"
|
||||
"jmp 1b\n\t"
|
||||
".previous"
|
||||
: "=m" (*lock));
|
||||
return 0;
|
||||
}
|
||||
weak_alias (__pthread_spin_lock, pthread_spin_lock)
|
||||
|
||||
|
||||
int
|
||||
__pthread_spin_trylock (pthread_spinlock_t *lock)
|
||||
{
|
||||
int oldval;
|
||||
|
||||
asm volatile
|
||||
("xchgl %0,%1"
|
||||
: "=r" (oldval), "=m" (*lock)
|
||||
: "0" (0));
|
||||
return oldval > 0 ? 0 : EBUSY;
|
||||
}
|
||||
weak_alias (__pthread_spin_trylock, pthread_spin_trylock)
|
||||
|
||||
|
||||
int
|
||||
__pthread_spin_unlock (pthread_spinlock_t *lock)
|
||||
{
|
||||
asm volatile
|
||||
("movl $1,%0"
|
||||
: "=m" (*lock));
|
||||
return 0;
|
||||
}
|
||||
weak_alias (__pthread_spin_unlock, pthread_spin_unlock)
|
||||
|
||||
|
||||
int
|
||||
__pthread_spin_init (pthread_spinlock_t *lock, int pshared)
|
||||
{
|
||||
/* We can ignore the `pshared' parameter. Since we are busy-waiting
|
||||
all processes which can access the memory location `lock' points
|
||||
to can use the spinlock. */
|
||||
*lock = 1;
|
||||
return 0;
|
||||
}
|
||||
weak_alias (__pthread_spin_init, pthread_spin_init)
|
||||
|
||||
|
||||
int
|
||||
__pthread_spin_destroy (pthread_spinlock_t *lock)
|
||||
{
|
||||
/* Nothing to do. */
|
||||
return 0;
|
||||
}
|
||||
weak_alias (__pthread_spin_destroy, pthread_spin_destroy)
|
61
linuxthreads/sysdeps/x86_64/pt-machine.h
Normal file
61
linuxthreads/sysdeps/x86_64/pt-machine.h
Normal file
@ -0,0 +1,61 @@
|
||||
/* Machine-dependent pthreads configuration and inline functions.
|
||||
x86-64 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. */
|
||||
|
||||
#ifndef PT_EI
|
||||
# define PT_EI extern inline
|
||||
#endif
|
||||
|
||||
/* Get some notion of the current stack. Need not be exactly the top
|
||||
of the stack, just something somewhere in the current frame. */
|
||||
#define CURRENT_STACK_FRAME stack_pointer
|
||||
register char * stack_pointer __asm__ ("%rsp");
|
||||
|
||||
|
||||
/* Spinlock implementation; required. */
|
||||
PT_EI long int
|
||||
testandset (int *spinlock)
|
||||
{
|
||||
long int ret;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"xchgq %0, %1"
|
||||
: "=r"(ret), "=m"(*spinlock)
|
||||
: "0"(1), "m"(*spinlock)
|
||||
: "memory");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Compare-and-swap for semaphores. */
|
||||
#define HAS_COMPARE_AND_SWAP
|
||||
|
||||
PT_EI int
|
||||
__compare_and_swap (long int *p, long int oldval, long int newval)
|
||||
{
|
||||
char ret;
|
||||
long int readval;
|
||||
|
||||
__asm__ __volatile__ ("lock; cmpxchgq %3, %1; sete %0"
|
||||
: "=q" (ret), "=m" (*p), "=a" (readval)
|
||||
: "r" (newval), "m" (*p), "a" (oldval)
|
||||
: "memory");
|
||||
return ret;
|
||||
}
|
4
sysdeps/unix/sysv/linux/x86_64/Makefile
Normal file
4
sysdeps/unix/sysv/linux/x86_64/Makefile
Normal file
@ -0,0 +1,4 @@
|
||||
ifeq ($(subdir),misc)
|
||||
sysdep_routines += ioperm iopl
|
||||
sysdep_headers += sys/perm.h sys/reg.h
|
||||
endif
|
7
sysdeps/unix/sysv/linux/x86_64/Versions
Normal file
7
sysdeps/unix/sysv/linux/x86_64/Versions
Normal file
@ -0,0 +1,7 @@
|
||||
libc {
|
||||
GLIBC_2.2.5 {
|
||||
ioperm; iopl;
|
||||
|
||||
__modify_ldt; modify_ldt;
|
||||
}
|
||||
}
|
170
sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
Normal file
170
sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h
Normal file
@ -0,0 +1,170 @@
|
||||
/* O_*, F_*, FD_* bit values for Linux/x86-64.
|
||||
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. */
|
||||
|
||||
#ifndef _FCNTL_H
|
||||
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
|
||||
#endif
|
||||
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
|
||||
located on an ext2 file system */
|
||||
#define O_ACCMODE 0003
|
||||
#define O_RDONLY 00
|
||||
#define O_WRONLY 01
|
||||
#define O_RDWR 02
|
||||
#define O_CREAT 0100 /* not fcntl */
|
||||
#define O_EXCL 0200 /* not fcntl */
|
||||
#define O_NOCTTY 0400 /* not fcntl */
|
||||
#define O_TRUNC 01000 /* not fcntl */
|
||||
#define O_APPEND 02000
|
||||
#define O_NONBLOCK 04000
|
||||
#define O_NDELAY O_NONBLOCK
|
||||
#define O_SYNC 010000
|
||||
#define O_FSYNC O_SYNC
|
||||
#define O_ASYNC 020000
|
||||
|
||||
#ifdef __USE_GNU
|
||||
# define O_DIRECT 040000 /* Direct disk access. */
|
||||
# define O_DIRECTORY 0200000 /* Must be a directory. */
|
||||
# define O_NOFOLLOW 0400000 /* Do not follow links. */
|
||||
#endif
|
||||
|
||||
/* For now Linux has synchronisity options for data and read operations.
|
||||
We define the symbols here but let them do the same as O_SYNC since
|
||||
this is a superset. */
|
||||
#if defined __USE_POSIX199309 || defined __USE_UNIX98
|
||||
# define O_DSYNC O_SYNC /* Synchronize data. */
|
||||
# define O_RSYNC O_SYNC /* Synchronize read operations. */
|
||||
#endif
|
||||
|
||||
#ifdef __USE_LARGEFILE64
|
||||
/* Not necessary, files are always with 64bit off_t. */
|
||||
# define O_LARGEFILE 0
|
||||
#endif
|
||||
|
||||
/* Values for the second argument to `fcntl'. */
|
||||
#define F_DUPFD 0 /* Duplicate file descriptor. */
|
||||
#define F_GETFD 1 /* Get file descriptor flags. */
|
||||
#define F_SETFD 2 /* Set file descriptor flags. */
|
||||
#define F_GETFL 3 /* Get file status flags. */
|
||||
#define F_SETFL 4 /* Set file status flags. */
|
||||
#define F_GETLK 5 /* Get record locking info. */
|
||||
#define F_SETLK 6 /* Set record locking info (non-blocking). */
|
||||
#define F_SETLKW 7 /* Set record locking info (blocking). */
|
||||
#define F_GETLK64 F_GETLK /* Get record locking info. */
|
||||
#define F_SETLK64 F_SETLK /* Set record locking info (non-blocking). */
|
||||
#define F_SETLKW64 F_SETLKW /* Set record locking info (blocking). */
|
||||
|
||||
#if defined __USE_BSD || defined __USE_XOPEN2K
|
||||
# define F_SETOWN 8 /* Get owner of socket (receiver of SIGIO). */
|
||||
# define F_GETOWN 9 /* Set owner of socket (receiver of SIGIO). */
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
# define F_SETSIG 10 /* Set number of signal to be sent. */
|
||||
# define F_GETSIG 11 /* Get number of signal to be sent. */
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
# define F_SETLEASE 1024 /* Set a lease. */
|
||||
# define F_GETLEASE 1025 /* Enquire what lease is active. */
|
||||
# define F_NOTIFY 1026 /* Request notfications on a directory. */
|
||||
#endif
|
||||
|
||||
/* For F_[GET|SET]FL. */
|
||||
#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
|
||||
|
||||
/* For posix fcntl() and `l_type' field of a `struct flock' for lockf(). */
|
||||
#define F_RDLCK 0 /* Read lock. */
|
||||
#define F_WRLCK 1 /* Write lock. */
|
||||
#define F_UNLCK 2 /* Remove lock. */
|
||||
|
||||
/* For old implementation of bsd flock(). */
|
||||
#define F_EXLCK 4 /* or 3 */
|
||||
#define F_SHLCK 8 /* or 4 */
|
||||
|
||||
#ifdef __USE_BSD
|
||||
/* Operations for bsd flock(), also used by the kernel implementation. */
|
||||
# define LOCK_SH 1 /* shared lock */
|
||||
# define LOCK_EX 2 /* exclusive lock */
|
||||
# define LOCK_NB 4 /* or'd with one of the above to prevent
|
||||
blocking */
|
||||
# define LOCK_UN 8 /* remove lock */
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
# define LOCK_MAND 32 /* This is a mandatory flock: */
|
||||
# define LOCK_READ 64 /* ... which allows concurrent read operations. */
|
||||
# define LOCK_WRITE 128 /* ... which allows concurrent write operations. */
|
||||
# define LOCK_RW 192 /* ... Which allows concurrent read & write operations. */
|
||||
#endif
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Types of directory notifications that may be requested with F_NOTIFY. */
|
||||
# define DN_ACCESS 0x00000001 /* File accessed. */
|
||||
# define DN_MODIFY 0x00000002 /* File modified. */
|
||||
# define DN_CREATE 0x00000004 /* File created. */
|
||||
# define DN_DELETE 0x00000008 /* File removed. */
|
||||
# define DN_RENAME 0x00000010 /* File renamed. */
|
||||
# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
|
||||
# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
|
||||
#endif
|
||||
|
||||
/* We don't need to support __USE_FILE_OFFSET64. */
|
||||
struct flock
|
||||
{
|
||||
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
|
||||
short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
|
||||
__off_t l_start; /* Offset where the lock begins. */
|
||||
__off_t l_len; /* Size of the locked area; zero means until EOF. */
|
||||
__pid_t l_pid; /* Process holding the lock. */
|
||||
};
|
||||
|
||||
#ifdef __USE_LARGEFILE64
|
||||
struct flock64
|
||||
{
|
||||
short int l_type; /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK. */
|
||||
short int l_whence; /* Where `l_start' is relative to (like `lseek'). */
|
||||
__off64_t l_start; /* Offset where the lock begins. */
|
||||
__off64_t l_len; /* Size of the locked area; zero means until EOF. */
|
||||
__pid_t l_pid; /* Process holding the lock. */
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Define some more compatibility macros to be backward compatible with
|
||||
BSD systems which did not managed to hide these kernel macros. */
|
||||
#ifdef __USE_BSD
|
||||
# define FAPPEND O_APPEND
|
||||
# define FFSYNC O_FSYNC
|
||||
# define FASYNC O_ASYNC
|
||||
# define FNONBLOCK O_NONBLOCK
|
||||
# define FNDELAY O_NDELAY
|
||||
#endif /* Use BSD. */
|
||||
|
||||
/* Advise to `posix_fadvise'. */
|
||||
#ifdef __USE_XOPEN2K
|
||||
# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
|
||||
# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
|
||||
# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
|
||||
# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
|
||||
# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
|
||||
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
|
||||
#endif
|
94
sysdeps/unix/sysv/linux/x86_64/bits/mman.h
Normal file
94
sysdeps/unix/sysv/linux/x86_64/bits/mman.h
Normal file
@ -0,0 +1,94 @@
|
||||
/* Definitions for POSIX memory map interface. Linux/x86_64 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. */
|
||||
|
||||
#ifndef _SYS_MMAN_H
|
||||
# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
|
||||
#endif
|
||||
|
||||
/* The following definitions basically come from the kernel headers.
|
||||
But the kernel header is not namespace clean. */
|
||||
|
||||
|
||||
/* Protections are chosen from these bits, OR'd together. The
|
||||
implementation does not necessarily support PROT_EXEC or PROT_WRITE
|
||||
without PROT_READ. The only guarantees are that no writing will be
|
||||
allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
|
||||
|
||||
#define PROT_READ 0x1 /* Page can be read. */
|
||||
#define PROT_WRITE 0x2 /* Page can be written. */
|
||||
#define PROT_EXEC 0x4 /* Page can be executed. */
|
||||
#define PROT_NONE 0x0 /* Page can not be accessed. */
|
||||
|
||||
/* Sharing types (must choose one and only one of these). */
|
||||
#define MAP_SHARED 0x01 /* Share changes. */
|
||||
#define MAP_PRIVATE 0x02 /* Changes are private. */
|
||||
#ifdef __USE_MISC
|
||||
# define MAP_TYPE 0x0f /* Mask for type of mapping. */
|
||||
#endif
|
||||
|
||||
/* Other flags. */
|
||||
#define MAP_FIXED 0x10 /* Interpret addr exactly. */
|
||||
#ifdef __USE_MISC
|
||||
# define MAP_FILE 0
|
||||
# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
|
||||
# define MAP_ANON MAP_ANONYMOUS
|
||||
# define MAP_32BIT 0x40 /* Only give out 32-bit addresses. */
|
||||
#endif
|
||||
|
||||
/* These are Linux-specific. */
|
||||
#ifdef __USE_MISC
|
||||
# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */
|
||||
# define MAP_DENYWRITE 0x0800 /* ETXTBSY */
|
||||
# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */
|
||||
# define MAP_LOCKED 0x2000 /* Lock the mapping. */
|
||||
# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */
|
||||
#endif
|
||||
|
||||
/* Flags to `msync'. */
|
||||
#define MS_ASYNC 1 /* Sync memory asynchronously. */
|
||||
#define MS_SYNC 4 /* Synchronous memory sync. */
|
||||
#define MS_INVALIDATE 2 /* Invalidate the caches. */
|
||||
|
||||
/* Flags for `mlockall'. */
|
||||
#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
|
||||
#define MCL_FUTURE 2 /* Lock all additions to address
|
||||
space. */
|
||||
|
||||
/* Flags for `mremap'. */
|
||||
#ifdef __USE_GNU
|
||||
# define MREMAP_MAYMOVE 1
|
||||
#endif
|
||||
|
||||
/* Advice to `madvise'. */
|
||||
#ifdef __USE_BSD
|
||||
# define MADV_NORMAL 0 /* No further special treatment. */
|
||||
# define MADV_RANDOM 1 /* Expect random page references. */
|
||||
# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
|
||||
# define MADV_WILLNEED 3 /* Will need these pages. */
|
||||
# define MADV_DONTNEED 4 /* Don't need these pages. */
|
||||
#endif
|
||||
|
||||
/* The POSIX people had to invent similar names for the same things. */
|
||||
#ifdef __USE_XOPEN2K
|
||||
# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
|
||||
# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
|
||||
# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
|
||||
# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
|
||||
# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
|
||||
#endif
|
108
sysdeps/unix/sysv/linux/x86_64/bits/stat.h
Normal file
108
sysdeps/unix/sysv/linux/x86_64/bits/stat.h
Normal file
@ -0,0 +1,108 @@
|
||||
/* Copyright (C) 1999, 2000, 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. */
|
||||
|
||||
#ifndef _SYS_STAT_H
|
||||
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
|
||||
#endif
|
||||
|
||||
/* Versions of the `struct stat' data structure. */
|
||||
#define _STAT_VER_KERNEL 0
|
||||
#define _STAT_VER_LINUX 1
|
||||
#define _STAT_VER _STAT_VER_LINUX
|
||||
|
||||
/* Versions of the `xmknod' interface. */
|
||||
#define _MKNOD_VER_LINUX 0
|
||||
|
||||
struct stat
|
||||
{
|
||||
__dev_t st_dev; /* Device. */
|
||||
__ino_t st_ino; /* File serial number. */
|
||||
__nlink_t st_nlink; /* Link count. */
|
||||
__mode_t st_mode; /* File mode. */
|
||||
__uid_t st_uid; /* User ID of the file's owner. */
|
||||
__gid_t st_gid; /* Group ID of the file's group.*/
|
||||
int pad0;
|
||||
__dev_t st_rdev; /* Device number, if device. */
|
||||
__off_t st_size; /* Size of file, in bytes. */
|
||||
__blksize_t st_blksize; /* Optimal block size for I/O. */
|
||||
__blkcnt_t st_blocks; /* Nr. 512-byte blocks allocated. */
|
||||
__time_t st_atime; /* Time of last access. */
|
||||
long int __reserved0; /* Reserved for atime.nanoseconds. */
|
||||
__time_t st_mtime; /* Time of last modification. */
|
||||
long int __reserved1; /* Reserved for mtime.nanoseconds. */
|
||||
__time_t st_ctime; /* Time of last status change. */
|
||||
long int __reserved2; /* Reserved for ctime.nanoseconds. */
|
||||
long int __unused[3];
|
||||
};
|
||||
|
||||
#ifdef __USE_LARGEFILE64
|
||||
/* Note stat64 has the same shape as stat. */
|
||||
struct stat64
|
||||
{
|
||||
__dev_t st_dev; /* Device. */
|
||||
__ino64_t st_ino; /* File serial number. */
|
||||
__nlink_t st_nlink; /* Link count. */
|
||||
__mode_t st_mode; /* File mode. */
|
||||
__uid_t st_uid; /* User ID of the file's owner. */
|
||||
__gid_t st_gid; /* Group ID of the file's group.*/
|
||||
int pad0;
|
||||
__dev_t st_rdev; /* Device number, if device. */
|
||||
__off_t st_size; /* Size of file, in bytes. */
|
||||
__blksize_t st_blksize; /* Optimal block size for I/O. */
|
||||
__blkcnt64_t st_blocks; /* Nr. 512-byte blocks allocated. */
|
||||
__time_t st_atime; /* Time of last access. */
|
||||
long int __reserved0; /* Reserved for atime.nanoseconds. */
|
||||
__time_t st_mtime; /* Time of last modification. */
|
||||
long int __reserved1; /* Reserved for mtime.nanoseconds. */
|
||||
__time_t st_ctime; /* Time of last status change. */
|
||||
long int __reserved2; /* Reserved for ctime.nanoseconds. */
|
||||
long int __unused[3];
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Tell code we have these members. */
|
||||
#define _STATBUF_ST_BLKSIZE
|
||||
#define _STATBUF_ST_RDEV
|
||||
|
||||
/* Encoding of the file mode. */
|
||||
|
||||
#define __S_IFMT 0170000 /* These bits determine file type. */
|
||||
|
||||
/* File types. */
|
||||
#define __S_IFDIR 0040000 /* Directory. */
|
||||
#define __S_IFCHR 0020000 /* Character device. */
|
||||
#define __S_IFBLK 0060000 /* Block device. */
|
||||
#define __S_IFREG 0100000 /* Regular file. */
|
||||
#define __S_IFIFO 0010000 /* FIFO. */
|
||||
#define __S_IFLNK 0120000 /* Symbolic link. */
|
||||
#define __S_IFSOCK 0140000 /* Socket. */
|
||||
|
||||
/* POSIX.1b objects. Note that these macros always evaluate to zero. But
|
||||
they do it by enforcing the correct use of the macros. */
|
||||
#define __S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
|
||||
#define __S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
|
||||
#define __S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
|
||||
|
||||
/* Protection bits. */
|
||||
|
||||
#define __S_ISUID 04000 /* Set user ID on execution. */
|
||||
#define __S_ISGID 02000 /* Set group ID on execution. */
|
||||
#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
|
||||
#define __S_IREAD 0400 /* Read by owner. */
|
||||
#define __S_IWRITE 0200 /* Write by owner. */
|
||||
#define __S_IEXEC 0100 /* Execute by owner. */
|
58
sysdeps/unix/sysv/linux/x86_64/bits/statfs.h
Normal file
58
sysdeps/unix/sysv/linux/x86_64/bits/statfs.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* 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. */
|
||||
|
||||
#ifndef _SYS_STATFS_H
|
||||
# error "Never include <bits/statfs.h> directly; use <sys/statfs.h> instead."
|
||||
#endif
|
||||
|
||||
#include <bits/types.h> /* for __fsid_t and __fsblkcnt_t. */
|
||||
|
||||
struct statfs
|
||||
{
|
||||
long int f_type;
|
||||
long int f_bsize;
|
||||
__fsblkcnt_t f_blocks;
|
||||
__fsblkcnt_t f_bfree;
|
||||
__fsblkcnt_t f_bavail;
|
||||
__fsblkcnt_t f_files;
|
||||
__fsblkcnt_t f_ffree;
|
||||
__fsid_t f_fsid;
|
||||
long int f_namelen;
|
||||
long int f_spare[6];
|
||||
};
|
||||
|
||||
#ifdef __USE_LARGEFILE64
|
||||
/* We already use 64-bit types in the normal structure,
|
||||
so this is the same as the above. */
|
||||
struct statfs64
|
||||
{
|
||||
long int f_type;
|
||||
long int f_bsize;
|
||||
__fsblkcnt64_t f_blocks;
|
||||
__fsblkcnt64_t f_bfree;
|
||||
__fsblkcnt64_t f_bavail;
|
||||
__fsblkcnt64_t f_files;
|
||||
__fsblkcnt64_t f_ffree;
|
||||
__fsid_t f_fsid;
|
||||
long int f_namelen;
|
||||
long int f_spare[6];
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Tell code we have this member. */
|
||||
#define _STATFS_F_NAMELEN
|
73
sysdeps/unix/sysv/linux/x86_64/bits/time.h
Normal file
73
sysdeps/unix/sysv/linux/x86_64/bits/time.h
Normal file
@ -0,0 +1,73 @@
|
||||
/* System-dependent timing definitions. Linux x86-64 version.
|
||||
Copyright (C) 1996, 1997, 1999, 2000, 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. */
|
||||
|
||||
/*
|
||||
* Never include this file directly; use <time.h> instead.
|
||||
*/
|
||||
|
||||
#ifndef __need_timeval
|
||||
# ifndef _BITS_TIME_H
|
||||
# define _BITS_TIME_H 1
|
||||
|
||||
/* ISO/IEC 9899:1990 7.12.1: <time.h>
|
||||
The macro `CLOCKS_PER_SEC' is the number per second of the value
|
||||
returned by the `clock' function. */
|
||||
/* CAE XSH, Issue 4, Version 2: <time.h>
|
||||
The value of CLOCKS_PER_SEC is required to be 1 million on all
|
||||
XSI-conformant systems. */
|
||||
# define CLOCKS_PER_SEC 1000000l
|
||||
|
||||
# if !defined __STRICT_ANSI__ && !defined __USE_XOPEN2K
|
||||
/* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
|
||||
presents the real value for clock ticks per second for the system. */
|
||||
# include <bits/types.h>
|
||||
extern long int __sysconf (int);
|
||||
# define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */
|
||||
# endif
|
||||
|
||||
# ifdef __USE_POSIX199309
|
||||
/* Identifier for system-wide realtime clock. */
|
||||
# define CLOCK_REALTIME 0
|
||||
/* High-resolution timer from the CPU. */
|
||||
# define CLOCK_PROCESS_CPUTIME_ID 2
|
||||
/* Thread-specific CPU-time clock. */
|
||||
# define CLOCK_THREAD_CPUTIME_ID 3
|
||||
|
||||
/* Flag to indicate time is absolute. */
|
||||
# define TIMER_ABSTIME 1
|
||||
# endif
|
||||
|
||||
# endif /* bits/time.h */
|
||||
#endif
|
||||
|
||||
#ifdef __need_timeval
|
||||
# undef __need_timeval
|
||||
# ifndef _STRUCT_TIMEVAL
|
||||
# define _STRUCT_TIMEVAL 1
|
||||
# include <bits/types.h>
|
||||
|
||||
/* A time value that is accurate to the nearest
|
||||
microsecond but also has a range of years. */
|
||||
struct timeval
|
||||
{
|
||||
__time_t tv_sec; /* Seconds. */
|
||||
__suseconds_t tv_usec; /* Microseconds. */
|
||||
};
|
||||
# endif /* struct timeval */
|
||||
#endif /* need timeval */
|
119
sysdeps/unix/sysv/linux/x86_64/bits/types.h
Normal file
119
sysdeps/unix/sysv/linux/x86_64/bits/types.h
Normal file
@ -0,0 +1,119 @@
|
||||
/* 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. */
|
||||
|
||||
/*
|
||||
* Never include this file directly; use <sys/types.h> instead.
|
||||
*/
|
||||
|
||||
#ifndef _BITS_TYPES_H
|
||||
#define _BITS_TYPES_H 1
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#define __need_size_t
|
||||
#include <stddef.h>
|
||||
|
||||
/* Convenience types. */
|
||||
typedef unsigned char __u_char;
|
||||
typedef unsigned short int __u_short;
|
||||
typedef unsigned int __u_int;
|
||||
typedef unsigned long int __u_long;
|
||||
typedef unsigned long int __u_quad_t;
|
||||
typedef long int __quad_t;
|
||||
typedef signed char __int8_t;
|
||||
typedef unsigned char __uint8_t;
|
||||
typedef signed short int __int16_t;
|
||||
typedef unsigned short int __uint16_t;
|
||||
typedef signed int __int32_t;
|
||||
typedef unsigned int __uint32_t;
|
||||
typedef signed long int __int64_t;
|
||||
typedef unsigned long int __uint64_t;
|
||||
typedef __quad_t *__qaddr_t;
|
||||
|
||||
typedef __uint64_t __dev_t; /* Type of device numbers. */
|
||||
typedef __uint32_t __uid_t; /* Type of user identifications. */
|
||||
typedef __uint32_t __gid_t; /* Type of group identifications. */
|
||||
typedef __uint64_t __ino_t; /* Type of file serial numbers. */
|
||||
typedef __uint64_t __ino64_t; /* "" (LFS) */
|
||||
typedef __uint32_t __mode_t; /* Type of file attribute bitmasks. */
|
||||
typedef __uint64_t __nlink_t; /* Type of file link counts. */
|
||||
typedef __int64_t __off_t; /* Type of file sizes and offsets. */
|
||||
typedef __int64_t __off64_t; /* "" (LFS) */
|
||||
typedef __int64_t __loff_t; /* Type of file sizes and offsets. */
|
||||
typedef __int32_t __pid_t; /* Type of process identifications. */
|
||||
typedef __int64_t __ssize_t; /* Type of a byte count, or error. */
|
||||
typedef __uint64_t __rlim_t; /* Type of resource counts. */
|
||||
typedef __uint64_t __rlim64_t; /* "" (LFS) */
|
||||
typedef __int64_t __blkcnt_t; /* Type to count nr disk blocks. */
|
||||
typedef __int64_t __blkcnt64_t; /* "" (LFS) */
|
||||
typedef __uint64_t __fsblkcnt_t; /* Type to count file system blocks. */
|
||||
typedef __uint64_t __fsblkcnt64_t; /* "" (LFS) */
|
||||
typedef __uint64_t __fsfilcnt_t; /* Type to count file system inodes. */
|
||||
typedef __uint64_t __fsfilcnt64_t; /* "" (LFS) */
|
||||
typedef __uint32_t __id_t; /* General type for IDs. */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int __val[2];
|
||||
} __fsid_t; /* Type of file system IDs. */
|
||||
|
||||
/* Everythin' else. */
|
||||
typedef int __daddr_t; /* Type of a disk address. */
|
||||
typedef char *__caddr_t; /* Type of a core address. */
|
||||
typedef long int __time_t;
|
||||
typedef unsigned int __useconds_t;
|
||||
typedef long int __suseconds_t;
|
||||
typedef long int __swblk_t; /* Type of a swap block maybe? */
|
||||
typedef long int __clock_t;
|
||||
typedef int __key_t; /* Type of a SYSV IPC key. */
|
||||
|
||||
/* Clock ID used in clock and timer functions. */
|
||||
typedef int __clockid_t;
|
||||
|
||||
/* Timer ID returned by `timer_create'. */
|
||||
typedef int __timer_t;
|
||||
|
||||
/* Used in `struct shmid_ds'. */
|
||||
typedef int __ipc_pid_t;
|
||||
|
||||
/* type to represent block size. */
|
||||
typedef long int __blksize_t;
|
||||
|
||||
/* Due to incaution, we may have gotten these from a kernel header file. */
|
||||
#undef __FD_SETSIZE
|
||||
#undef __FDMASK
|
||||
|
||||
/* Number of descriptors that can fit in an `fd_set'. */
|
||||
#define __FD_SETSIZE 1024
|
||||
|
||||
/* Used in XTI. */
|
||||
typedef int __t_scalar_t;
|
||||
typedef unsigned int __t_uscalar_t;
|
||||
|
||||
/* Duplicates info from stdint.h but this is used in unistd.h. */
|
||||
typedef long int __intptr_t;
|
||||
|
||||
/* Duplicate info from sys/socket.h. */
|
||||
typedef unsigned int __socklen_t;
|
||||
|
||||
/* Now add the thread types. */
|
||||
#if defined __USE_POSIX199506 || defined __USE_UNIX98
|
||||
# include <bits/pthreadtypes.h>
|
||||
#endif
|
||||
|
||||
#endif /* bits/types.h */
|
1
sysdeps/unix/sysv/linux/x86_64/brk.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/brk.c
Normal file
@ -0,0 +1 @@
|
||||
#include <sysdeps/unix/sysv/linux/hppa/brk.c>
|
86
sysdeps/unix/sysv/linux/x86_64/clone.S
Normal file
86
sysdeps/unix/sysv/linux/x86_64/clone.S
Normal file
@ -0,0 +1,86 @@
|
||||
/* 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. */
|
||||
|
||||
/* clone() is even more special than fork() as it mucks with stacks
|
||||
and invokes a function in the right context after its all over. */
|
||||
|
||||
#include <sysdep.h>
|
||||
#define _ERRNO_H 1
|
||||
#include <bits/errno.h>
|
||||
#include <asm-syntax.h>
|
||||
#include <bp-sym.h>
|
||||
#include <bp-asm.h>
|
||||
|
||||
/* The userland implementation is:
|
||||
int clone (int (*fn)(void *arg), void *child_stack, int flags, void *arg),
|
||||
the kernel entry is:
|
||||
int clone (long flags, void *child_stack).
|
||||
|
||||
The parameters are passed in register from userland:
|
||||
rdi: fn
|
||||
rsi: child_stack
|
||||
rdx: flags
|
||||
rcx: arg
|
||||
|
||||
The kernel expects:
|
||||
rax: system call number
|
||||
rdi: flags
|
||||
rsi: child_stack */
|
||||
|
||||
|
||||
.text
|
||||
ENTRY (BP_SYM (__clone))
|
||||
/* Sanity check arguments. */
|
||||
movq $-EINVAL,%rax
|
||||
testq %rdi,%rdi /* no NULL function pointers */
|
||||
jz SYSCALL_ERROR_LABEL
|
||||
testq %rsi,%rsi /* no NULL stack pointers */
|
||||
jz SYSCALL_ERROR_LABEL
|
||||
|
||||
/* Insert the argument onto the new stack. */
|
||||
subq $16,%rsi
|
||||
movq %rcx,8(%rsi)
|
||||
|
||||
/* Save the function pointer. It will be popped off in the
|
||||
child in the ebx frobbing below. */
|
||||
movq %rdi,0(%rsi)
|
||||
|
||||
/* Do the system call. */
|
||||
movq %rdx, %rdi
|
||||
movq $SYS_ify(clone),%rax
|
||||
syscall
|
||||
|
||||
testq %rax,%rax
|
||||
jl SYSCALL_ERROR_LABEL
|
||||
jz thread_start
|
||||
|
||||
L(pseudo_end):
|
||||
ret
|
||||
|
||||
thread_start:
|
||||
/* Set up arguments for the function call. */
|
||||
popq %rax /* Function to call. */
|
||||
popq %rdi /* Argument. */
|
||||
call *%rax
|
||||
/* Call exit with return value from function call. */
|
||||
movq %rax, %rdi
|
||||
call JUMPTARGET (_exit)
|
||||
|
||||
PSEUDO_END (BP_SYM (__clone))
|
||||
|
||||
weak_alias (BP_SYM (__clone), BP_SYM (clone))
|
1
sysdeps/unix/sysv/linux/x86_64/fstatfs64.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/fstatfs64.c
Normal file
@ -0,0 +1 @@
|
||||
/* fstatfs64 is the same as fstatfs. */
|
1
sysdeps/unix/sysv/linux/x86_64/ftruncate64.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/ftruncate64.c
Normal file
@ -0,0 +1 @@
|
||||
/* ftruncate64 is the same as ftruncate. */
|
1
sysdeps/unix/sysv/linux/x86_64/fxstat.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/fxstat.c
Normal file
@ -0,0 +1 @@
|
||||
#include <sysdeps/unix/sysv/linux/ia64/fxstat.c>
|
1
sysdeps/unix/sysv/linux/x86_64/fxstat64.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/fxstat64.c
Normal file
@ -0,0 +1 @@
|
||||
/* fxstat64 is in fxstat.c */
|
2
sysdeps/unix/sysv/linux/x86_64/getdents.c
Normal file
2
sysdeps/unix/sysv/linux/x86_64/getdents.c
Normal file
@ -0,0 +1,2 @@
|
||||
#include <sysdeps/unix/sysv/linux/ia64/getdents.c>
|
||||
|
1
sysdeps/unix/sysv/linux/x86_64/getdents64.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/getdents64.c
Normal file
@ -0,0 +1 @@
|
||||
/* getdents64 is in getdents.c */
|
1
sysdeps/unix/sysv/linux/x86_64/getrlimit64.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/getrlimit64.c
Normal file
@ -0,0 +1 @@
|
||||
/* getrlimit64 is the same as getrlimit. */
|
38
sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
Normal file
38
sysdeps/unix/sysv/linux/x86_64/gettimeofday.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* 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. */
|
||||
|
||||
#include <asm/vsyscall.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
|
||||
/* Get the current time of day and timezone information,
|
||||
putting it into *TV and *TZ. If TZ is NULL, *TZ is not filled.
|
||||
Returns 0 on success, -1 on errors. */
|
||||
int
|
||||
__gettimeofday (struct timeval *tv, struct timezone *tz)
|
||||
{
|
||||
/* We're using a virtual syscall here. */
|
||||
int (*__vgettimeofday)(struct timeval *, struct timezone *)
|
||||
= (int (*)(struct timeval *, struct timezone *)) VSYSCALL_ADDR (__NR_vgettimeofday);
|
||||
|
||||
|
||||
return __vgettimeofday (tv, tz);
|
||||
}
|
||||
|
||||
weak_alias (__gettimeofday, gettimeofday)
|
1
sysdeps/unix/sysv/linux/x86_64/glob64.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/glob64.c
Normal file
@ -0,0 +1 @@
|
||||
/* glob64 is in glob.c */
|
3
sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
Normal file
3
sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
Normal file
@ -0,0 +1,3 @@
|
||||
/LD_TRACE_LOADED_OBJECTS=1/a\
|
||||
add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out"
|
||||
s_^\(RTLDLIST=\)\(.*lib\)\(\|64\)\(/[^/]*\.so\.[0-9.]*\)[ ]*$_\1"\2\4 \264\4"_
|
1
sysdeps/unix/sysv/linux/x86_64/lxstat.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/lxstat.c
Normal file
@ -0,0 +1 @@
|
||||
#include <sysdeps/unix/sysv/linux/ia64/lxstat.c>
|
1
sysdeps/unix/sysv/linux/x86_64/lxstat64.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/lxstat64.c
Normal file
@ -0,0 +1 @@
|
||||
/* lxstat64 is in lxstat.c */
|
1
sysdeps/unix/sysv/linux/x86_64/mmap64.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/mmap64.c
Normal file
@ -0,0 +1 @@
|
||||
/* mmap64 is the same as mmap. */
|
1
sysdeps/unix/sysv/linux/x86_64/pread64.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/pread64.c
Normal file
@ -0,0 +1 @@
|
||||
/* Empty since the pread syscall is equivalent. */
|
27
sysdeps/unix/sysv/linux/x86_64/profil-counter.h
Normal file
27
sysdeps/unix/sysv/linux/x86_64/profil-counter.h
Normal file
@ -0,0 +1,27 @@
|
||||
/* Low-level statistical profiling support function. Linux/x86-64 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. */
|
||||
|
||||
#include <signal.h>
|
||||
#include <sigcontextinfo.h>
|
||||
|
||||
static void
|
||||
profil_counter (int signo, SIGCONTEXT scp)
|
||||
{
|
||||
profil_count ((void *) GET_PC (scp));
|
||||
}
|
1
sysdeps/unix/sysv/linux/x86_64/pwrite64.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/pwrite64.c
Normal file
@ -0,0 +1 @@
|
||||
/* Empty since the pread syscall is equivalent. */
|
2
sysdeps/unix/sysv/linux/x86_64/readdir.c
Normal file
2
sysdeps/unix/sysv/linux/x86_64/readdir.c
Normal file
@ -0,0 +1,2 @@
|
||||
#include <sysdeps/unix/sysv/linux/ia64/readdir.c>
|
||||
|
1
sysdeps/unix/sysv/linux/x86_64/readdir64.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/readdir64.c
Normal file
@ -0,0 +1 @@
|
||||
/* readdir64 is in readdir.c */
|
1
sysdeps/unix/sysv/linux/x86_64/readdir64_r.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/readdir64_r.c
Normal file
@ -0,0 +1 @@
|
||||
/* readdir64_r is in readdir_r.c */
|
1
sysdeps/unix/sysv/linux/x86_64/readdir_r.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/readdir_r.c
Normal file
@ -0,0 +1 @@
|
||||
#include <sysdeps/unix/sysv/linux/ia64/readdir_r.c>
|
34
sysdeps/unix/sysv/linux/x86_64/recv.c
Normal file
34
sysdeps/unix/sysv/linux/x86_64/recv.c
Normal file
@ -0,0 +1,34 @@
|
||||
/* 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. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
/* Read N bytes into BUF from socket FD.
|
||||
Returns the number read or -1 for errors. */
|
||||
|
||||
ssize_t
|
||||
__libc_recv (int fd, void *buf, size_t n, int flags)
|
||||
{
|
||||
|
||||
return INLINE_SYSCALL (recvfrom, 6, fd, buf, n, flags, NULL, NULL);
|
||||
}
|
||||
|
||||
weak_alias (__libc_recv, __recv)
|
||||
weak_alias (__recv, recv)
|
344
sysdeps/unix/sysv/linux/x86_64/register-dump.h
Normal file
344
sysdeps/unix/sysv/linux/x86_64/register-dump.h
Normal file
@ -0,0 +1,344 @@
|
||||
/* Dump registers.
|
||||
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. */
|
||||
|
||||
#include <sys/uio.h>
|
||||
#include <stdio-common/_itoa.h>
|
||||
|
||||
/* We will print the register dump in this format:
|
||||
|
||||
RAX: XXXXXXXXXXXXXXXX RBX: XXXXXXXXXXXXXXXX RCX: XXXXXXXXXXXXXXXX
|
||||
RDX: XXXXXXXXXXXXXXXX RSI: XXXXXXXXXXXXXXXX RDI: XXXXXXXXXXXXXXXX
|
||||
RBP: XXXXXXXXXXXXXXXX R8 : XXXXXXXXXXXXXXXX R9 : XXXXXXXXXXXXXXXX
|
||||
R10: XXXXXXXXXXXXXXXX R11: XXXXXXXXXXXXXXXX R12: XXXXXXXXXXXXXXXX
|
||||
R13: XXXXXXXXXXXXXXXX R14: XXXXXXXXXXXXXXXX R15: XXXXXXXXXXXXXXXX
|
||||
RSP: XXXXXXXXXXXXXXXX
|
||||
|
||||
RIP: XXXXXXXXXXXXXXXX EFLAGS: XXXXXXXX
|
||||
|
||||
CS: XXXX DS: XXXX ES: XXXX FS: XXXX GS: XXXX
|
||||
|
||||
Trap: XXXXXXXX Error: XXXXXXXX OldMask: XXXXXXXX
|
||||
RSP/SIGNAL: XXXXXXXXXXXXXXXX CR2: XXXXXXXX
|
||||
|
||||
FPUCW: XXXXXXXX FPUSW: XXXXXXXX TAG: XXXXXXXX
|
||||
IPOFF: XXXXXXXX CSSEL: XXXX DATAOFF: XXXXXXXX DATASEL: XXXX
|
||||
|
||||
ST(0) XXXX XXXXXXXXXXXXXXXX ST(1) XXXX XXXXXXXXXXXXXXXX
|
||||
ST(2) XXXX XXXXXXXXXXXXXXXX ST(3) XXXX XXXXXXXXXXXXXXXX
|
||||
ST(4) XXXX XXXXXXXXXXXXXXXX ST(5) XXXX XXXXXXXXXXXXXXXX
|
||||
ST(6) XXXX XXXXXXXXXXXXXXXX ST(7) XXXX XXXXXXXXXXXXXXXX
|
||||
|
||||
mxcsr: XXXX
|
||||
XMM0 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XMM1 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
XMM2 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XMM3 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
XMM4 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XMM5 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
XMM6 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XMM7 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
XMM8 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XMM9 : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
XMM10: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XMM11: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
XMM12: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XMM13: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
XMM14: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XMM15: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
|
||||
*/
|
||||
|
||||
static void
|
||||
hexvalue (unsigned long int value, char *buf, size_t len)
|
||||
{
|
||||
char *cp = _itoa_word (value, buf + len, 16, 0);
|
||||
while (cp > buf)
|
||||
*--cp = '0';
|
||||
}
|
||||
|
||||
static void
|
||||
register_dump (int fd, struct sigcontext *ctx)
|
||||
{
|
||||
char regs[29][16];
|
||||
char fpregs[32][8];
|
||||
char xmmregs[16][32];
|
||||
struct iovec iov[147];
|
||||
size_t nr = 0;
|
||||
int i;
|
||||
|
||||
#define ADD_STRING(str) \
|
||||
iov[nr].iov_base = (char *) str; \
|
||||
iov[nr].iov_len = strlen (str); \
|
||||
++nr
|
||||
#define ADD_MEM(str, len) \
|
||||
iov[nr].iov_base = str; \
|
||||
iov[nr].iov_len = len; \
|
||||
++nr
|
||||
|
||||
/* Generate strings of register contents. */
|
||||
hexvalue (ctx->rax, regs[0], 16);
|
||||
hexvalue (ctx->rbx, regs[1], 16);
|
||||
hexvalue (ctx->rcx, regs[2], 16);
|
||||
hexvalue (ctx->rdx, regs[3], 16);
|
||||
hexvalue (ctx->rsi, regs[4], 16);
|
||||
hexvalue (ctx->rdi, regs[5], 16);
|
||||
hexvalue (ctx->rbp, regs[6], 16);
|
||||
hexvalue (ctx->r8, regs[7], 16);
|
||||
hexvalue (ctx->r9, regs[8], 16);
|
||||
hexvalue (ctx->r10, regs[9], 16);
|
||||
hexvalue (ctx->r11, regs[10], 16);
|
||||
hexvalue (ctx->r12, regs[11], 16);
|
||||
hexvalue (ctx->r13, regs[12], 16);
|
||||
hexvalue (ctx->r14, regs[13], 16);
|
||||
hexvalue (ctx->r15, regs[14], 16);
|
||||
hexvalue (ctx->rsp, regs[15], 16);
|
||||
hexvalue (ctx->rip, regs[16], 16);
|
||||
|
||||
hexvalue (ctx->eflags, regs[17], 8);
|
||||
hexvalue (ctx->cs, regs[18], 4);
|
||||
hexvalue (ctx->ds, regs[19], 4);
|
||||
hexvalue (ctx->es, regs[20], 4);
|
||||
hexvalue (ctx->fs, regs[21], 4);
|
||||
hexvalue (ctx->gs, regs[22], 4);
|
||||
/* hexvalue (ctx->ss, regs[23], 4); */
|
||||
hexvalue (ctx->trapno, regs[24], 8);
|
||||
hexvalue (ctx->err, regs[25], 8);
|
||||
hexvalue (ctx->oldmask, regs[26], 8);
|
||||
hexvalue (ctx->rsp_at_signal, regs[27], 16);
|
||||
hexvalue (ctx->cr2, regs[28], 8);
|
||||
|
||||
/* Generate the output. */
|
||||
ADD_STRING ("Register dump:\n\n RAX: ");
|
||||
ADD_MEM (regs[0], 16);
|
||||
ADD_STRING (" RBX: ");
|
||||
ADD_MEM (regs[1], 16);
|
||||
ADD_STRING (" RCX: ");
|
||||
ADD_MEM (regs[2], 16);
|
||||
ADD_STRING ("\n RDX: ");
|
||||
ADD_MEM (regs[3], 16);
|
||||
ADD_STRING (" RSI: ");
|
||||
ADD_MEM (regs[4], 16);
|
||||
ADD_STRING (" RDI: ");
|
||||
ADD_MEM (regs[5], 16);
|
||||
ADD_STRING ("\n RBP: ");
|
||||
ADD_MEM (regs[6], 16);
|
||||
ADD_STRING (" R8 : ");
|
||||
ADD_MEM (regs[7], 16);
|
||||
ADD_STRING (" R9 : ");
|
||||
ADD_MEM (regs[8], 16);
|
||||
ADD_STRING ("\n R10: ");
|
||||
ADD_MEM (regs[9], 16);
|
||||
ADD_STRING (" R11: ");
|
||||
ADD_MEM (regs[10], 16);
|
||||
ADD_STRING (" R12: ");
|
||||
ADD_MEM (regs[11], 16);
|
||||
ADD_STRING ("\n R13: ");
|
||||
ADD_MEM (regs[12], 16);
|
||||
ADD_STRING (" R14: ");
|
||||
ADD_MEM (regs[13], 16);
|
||||
ADD_STRING (" R15: ");
|
||||
ADD_MEM (regs[14], 16);
|
||||
ADD_STRING ("\n RSP: ");
|
||||
ADD_MEM (regs[15], 16);
|
||||
ADD_STRING ("\n\n RIP: ");
|
||||
ADD_MEM (regs[16], 16);
|
||||
ADD_STRING (" EFLAGS: ");
|
||||
ADD_MEM (regs[17], 8);
|
||||
ADD_STRING ("\n\n CS: ");
|
||||
ADD_MEM (regs[18], 4);
|
||||
ADD_STRING (" DS: ");
|
||||
ADD_MEM (regs[19], 4);
|
||||
ADD_STRING (" ES: ");
|
||||
ADD_MEM (regs[20], 4);
|
||||
ADD_STRING (" FS: ");
|
||||
ADD_MEM (regs[21], 4);
|
||||
ADD_STRING (" GS: ");
|
||||
ADD_MEM (regs[22], 4);
|
||||
/*
|
||||
ADD_STRING (" SS: ");
|
||||
ADD_MEM (regs[23], 4);
|
||||
*/
|
||||
ADD_STRING ("\n\n Trap: ");
|
||||
ADD_MEM (regs[24], 8);
|
||||
ADD_STRING (" Error: ");
|
||||
ADD_MEM (regs[25], 8);
|
||||
ADD_STRING (" OldMask: ");
|
||||
ADD_MEM (regs[26], 8);
|
||||
ADD_STRING ("\n RSP/signal: ");
|
||||
ADD_MEM (regs[27], 8);
|
||||
ADD_STRING (" CR2: ");
|
||||
ADD_MEM (regs[28], 8);
|
||||
|
||||
if (ctx->fpstate != NULL)
|
||||
{
|
||||
|
||||
/* Generate output for the FPU control/status registers. */
|
||||
hexvalue (ctx->fpstate->cw, fpregs[0], 8);
|
||||
hexvalue (ctx->fpstate->sw, fpregs[1], 8);
|
||||
hexvalue (ctx->fpstate->tag, fpregs[2], 8);
|
||||
hexvalue (ctx->fpstate->ipoff, fpregs[3], 8);
|
||||
hexvalue (ctx->fpstate->cssel, fpregs[4], 4);
|
||||
hexvalue (ctx->fpstate->dataoff, fpregs[5], 8);
|
||||
hexvalue (ctx->fpstate->datasel, fpregs[6], 4);
|
||||
|
||||
ADD_STRING ("\n\n FPUCW: ");
|
||||
ADD_MEM (fpregs[0], 8);
|
||||
ADD_STRING (" FPUSW: ");
|
||||
ADD_MEM (fpregs[1], 8);
|
||||
ADD_STRING (" TAG: ");
|
||||
ADD_MEM (fpregs[2], 8);
|
||||
ADD_STRING ("\n IPOFF: ");
|
||||
ADD_MEM (fpregs[3], 8);
|
||||
ADD_STRING (" CSSEL: ");
|
||||
ADD_MEM (fpregs[4], 4);
|
||||
ADD_STRING (" DATAOFF: ");
|
||||
ADD_MEM (fpregs[5], 8);
|
||||
ADD_STRING (" DATASEL: ");
|
||||
ADD_MEM (fpregs[6], 4);
|
||||
|
||||
/* Now the real FPU registers. */
|
||||
hexvalue (ctx->fpstate->_st[0].exponent, fpregs[7], 8);
|
||||
hexvalue (ctx->fpstate->_st[0].significand[3] << 16
|
||||
| ctx->fpstate->_st[0].significand[2], fpregs[8], 8);
|
||||
hexvalue (ctx->fpstate->_st[0].significand[1] << 16
|
||||
| ctx->fpstate->_st[0].significand[0], fpregs[9], 8);
|
||||
hexvalue (ctx->fpstate->_st[1].exponent, fpregs[10], 8);
|
||||
hexvalue (ctx->fpstate->_st[1].significand[3] << 16
|
||||
| ctx->fpstate->_st[1].significand[2], fpregs[11], 8);
|
||||
hexvalue (ctx->fpstate->_st[1].significand[1] << 16
|
||||
| ctx->fpstate->_st[1].significand[0], fpregs[12], 8);
|
||||
hexvalue (ctx->fpstate->_st[2].exponent, fpregs[13], 8);
|
||||
hexvalue (ctx->fpstate->_st[2].significand[3] << 16
|
||||
| ctx->fpstate->_st[2].significand[2], fpregs[14], 8);
|
||||
hexvalue (ctx->fpstate->_st[2].significand[1] << 16
|
||||
| ctx->fpstate->_st[2].significand[0], fpregs[15], 8);
|
||||
hexvalue (ctx->fpstate->_st[3].exponent, fpregs[16], 8);
|
||||
hexvalue (ctx->fpstate->_st[3].significand[3] << 16
|
||||
| ctx->fpstate->_st[3].significand[2], fpregs[17], 8);
|
||||
hexvalue (ctx->fpstate->_st[3].significand[1] << 16
|
||||
| ctx->fpstate->_st[3].significand[0], fpregs[18], 8);
|
||||
hexvalue (ctx->fpstate->_st[4].exponent, fpregs[19], 8);
|
||||
hexvalue (ctx->fpstate->_st[4].significand[3] << 16
|
||||
| ctx->fpstate->_st[4].significand[2], fpregs[20], 8);
|
||||
hexvalue (ctx->fpstate->_st[4].significand[1] << 16
|
||||
| ctx->fpstate->_st[4].significand[0], fpregs[21], 8);
|
||||
hexvalue (ctx->fpstate->_st[5].exponent, fpregs[22], 8);
|
||||
hexvalue (ctx->fpstate->_st[5].significand[3] << 16
|
||||
| ctx->fpstate->_st[5].significand[2], fpregs[23], 8);
|
||||
hexvalue (ctx->fpstate->_st[5].significand[1] << 16
|
||||
| ctx->fpstate->_st[5].significand[0], fpregs[24], 8);
|
||||
hexvalue (ctx->fpstate->_st[6].exponent, fpregs[25], 8);
|
||||
hexvalue (ctx->fpstate->_st[6].significand[3] << 16
|
||||
| ctx->fpstate->_st[6].significand[2], fpregs[26], 8);
|
||||
hexvalue (ctx->fpstate->_st[6].significand[1] << 16
|
||||
| ctx->fpstate->_st[6].significand[0], fpregs[27], 8);
|
||||
hexvalue (ctx->fpstate->_st[7].exponent, fpregs[28], 8);
|
||||
hexvalue (ctx->fpstate->_st[7].significand[3] << 16
|
||||
| ctx->fpstate->_st[7].significand[2], fpregs[29], 8);
|
||||
hexvalue (ctx->fpstate->_st[7].significand[1] << 16
|
||||
| ctx->fpstate->_st[7].significand[0], fpregs[30], 8);
|
||||
|
||||
hexvalue (ctx->fpstate->mxcsr, fpregs[31], 4);
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
hexvalue (ctx->fpstate->_xmm[i].element[3] << 24
|
||||
| ctx->fpstate->_xmm[i].element[2] << 16
|
||||
| ctx->fpstate->_xmm[i].element[1] << 8
|
||||
| ctx->fpstate->_xmm[i].element[0], xmmregs[i], 32);
|
||||
|
||||
|
||||
ADD_STRING ("\n\n ST(0) ");
|
||||
ADD_MEM (fpregs[7], 4);
|
||||
ADD_STRING (" ");
|
||||
ADD_MEM (fpregs[8], 8);
|
||||
ADD_MEM (fpregs[9], 8);
|
||||
ADD_STRING (" ST(1) ");
|
||||
ADD_MEM (fpregs[10], 4);
|
||||
ADD_STRING (" ");
|
||||
ADD_MEM (fpregs[11], 8);
|
||||
ADD_MEM (fpregs[12], 8);
|
||||
ADD_STRING ("\n ST(2) ");
|
||||
ADD_MEM (fpregs[13], 4);
|
||||
ADD_STRING (" ");
|
||||
ADD_MEM (fpregs[14], 8);
|
||||
ADD_MEM (fpregs[15], 8);
|
||||
ADD_STRING (" ST(3) ");
|
||||
ADD_MEM (fpregs[16], 4);
|
||||
ADD_STRING (" ");
|
||||
ADD_MEM (fpregs[17], 8);
|
||||
ADD_MEM (fpregs[18], 8);
|
||||
ADD_STRING ("\n ST(4) ");
|
||||
ADD_MEM (fpregs[19], 4);
|
||||
ADD_STRING (" ");
|
||||
ADD_MEM (fpregs[20], 8);
|
||||
ADD_MEM (fpregs[21], 8);
|
||||
ADD_STRING (" ST(5) ");
|
||||
ADD_MEM (fpregs[22], 4);
|
||||
ADD_STRING (" ");
|
||||
ADD_MEM (fpregs[23], 8);
|
||||
ADD_MEM (fpregs[24], 8);
|
||||
ADD_STRING ("\n ST(6) ");
|
||||
ADD_MEM (fpregs[25], 4);
|
||||
ADD_STRING (" ");
|
||||
ADD_MEM (fpregs[26], 8);
|
||||
ADD_MEM (fpregs[27], 8);
|
||||
ADD_STRING (" ST(7) ");
|
||||
ADD_MEM (fpregs[28], 4);
|
||||
ADD_STRING (" ");
|
||||
ADD_MEM (fpregs[29], 8);
|
||||
ADD_MEM (fpregs[30], 8);
|
||||
|
||||
ADD_STRING ("\n mxcsr: ");
|
||||
ADD_MEM (fpregs[31], 4);
|
||||
|
||||
ADD_STRING ("\n XMM0: ");
|
||||
ADD_MEM (xmmregs[0], 32);
|
||||
ADD_STRING (" XMM1: ");
|
||||
ADD_MEM (xmmregs[0], 32);
|
||||
ADD_STRING ("\n XMM2: ");
|
||||
ADD_MEM (xmmregs[0], 32);
|
||||
ADD_STRING (" XMM3: ");
|
||||
ADD_MEM (xmmregs[0], 32);
|
||||
ADD_STRING ("\n XMM4: ");
|
||||
ADD_MEM (xmmregs[0], 32);
|
||||
ADD_STRING (" XMM5: ");
|
||||
ADD_MEM (xmmregs[0], 32);
|
||||
ADD_STRING ("\n XMM6: ");
|
||||
ADD_MEM (xmmregs[0], 32);
|
||||
ADD_STRING (" XMM7: ");
|
||||
ADD_MEM (xmmregs[0], 32);
|
||||
ADD_STRING ("\n XMM8: ");
|
||||
ADD_MEM (xmmregs[0], 32);
|
||||
ADD_STRING (" XMM9: ");
|
||||
ADD_MEM (xmmregs[0], 32);
|
||||
ADD_STRING ("\n XMM10: ");
|
||||
ADD_MEM (xmmregs[0], 32);
|
||||
ADD_STRING (" XMM11: ");
|
||||
ADD_MEM (xmmregs[0], 32);
|
||||
ADD_STRING ("\n XMM12: ");
|
||||
ADD_MEM (xmmregs[0], 32);
|
||||
ADD_STRING (" XMM13: ");
|
||||
ADD_MEM (xmmregs[0], 32);
|
||||
ADD_STRING ("\n XMM14: ");
|
||||
ADD_MEM (xmmregs[0], 32);
|
||||
ADD_STRING (" XMM15: ");
|
||||
ADD_MEM (xmmregs[0], 32);
|
||||
|
||||
}
|
||||
|
||||
ADD_STRING ("\n");
|
||||
|
||||
/* Write the stuff out. */
|
||||
writev (fd, iov, nr);
|
||||
}
|
||||
|
||||
|
||||
#define REGISTER_DUMP register_dump (fd, &ctx)
|
31
sysdeps/unix/sysv/linux/x86_64/send.c
Normal file
31
sysdeps/unix/sysv/linux/x86_64/send.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* 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. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
/* Send N bytes of BUF to socket FD. Returns the number sent or -1. */
|
||||
ssize_t
|
||||
__libc_send (int fd, const void *buf, size_t n, int flags)
|
||||
{
|
||||
return INLINE_SYSCALL (sendto, 6, fd, buf, n, flags, NULL, NULL);
|
||||
}
|
||||
|
||||
weak_alias (__libc_send, __send)
|
||||
weak_alias (__send, send)
|
1
sysdeps/unix/sysv/linux/x86_64/setrlimit64.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/setrlimit64.c
Normal file
@ -0,0 +1 @@
|
||||
/* setrlimit64 is the same as setrlimit. */
|
99
sysdeps/unix/sysv/linux/x86_64/sigaction.c
Normal file
99
sysdeps/unix/sysv/linux/x86_64/sigaction.c
Normal file
@ -0,0 +1,99 @@
|
||||
/* POSIX.1 `sigaction' call for Linux/x86-64.
|
||||
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. */
|
||||
|
||||
#include <sysdep.h>
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sysdep.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#include <kernel-features.h>
|
||||
|
||||
/* The difference here is that the sigaction structure used in the
|
||||
kernel is not the same as we use in the libc. Therefore we must
|
||||
translate it here. */
|
||||
#include <kernel_sigaction.h>
|
||||
|
||||
/* We do not globally define the SA_RESTORER flag so do it here. */
|
||||
#define SA_RESTORER 0x04000000
|
||||
|
||||
extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *__unbounded,
|
||||
struct kernel_sigaction *__unbounded, size_t);
|
||||
|
||||
static void restore_rt (void) asm ("__restore_rt");
|
||||
|
||||
|
||||
/* If ACT is not NULL, change the action for SIG to *ACT.
|
||||
If OACT is not NULL, put the old action for SIG in *OACT. */
|
||||
int
|
||||
__libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
|
||||
{
|
||||
int result;
|
||||
struct kernel_sigaction kact, koact;
|
||||
|
||||
if (act)
|
||||
{
|
||||
kact.k_sa_handler = act->sa_handler;
|
||||
memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
|
||||
kact.sa_flags = act->sa_flags | SA_RESTORER;
|
||||
|
||||
kact.sa_restorer = &restore_rt;
|
||||
}
|
||||
|
||||
/* XXX The size argument hopefully will have to be changed to the
|
||||
real size of the user-level sigset_t. */
|
||||
result = INLINE_SYSCALL (rt_sigaction, 4,
|
||||
sig, act ? __ptrvalue (&kact) : NULL,
|
||||
oact ? __ptrvalue (&koact) : NULL, _NSIG / 8);
|
||||
if (oact && result >= 0)
|
||||
{
|
||||
oact->sa_handler = koact.k_sa_handler;
|
||||
memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
|
||||
oact->sa_flags = koact.sa_flags;
|
||||
oact->sa_restorer = koact.sa_restorer;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
weak_alias (__libc_sigaction, __sigaction)
|
||||
weak_alias (__libc_sigaction, sigaction)
|
||||
|
||||
/* NOTE: Please think twice before making any changes to the bits of
|
||||
code below. GDB needs some intimate knowledge about it to
|
||||
recognize them as signal trampolines, and make backtraces through
|
||||
signal handlers work right. Important are both the names
|
||||
(__restore_rt) and the exact instruction sequence.
|
||||
If you ever feel the need to make any changes, please notify the
|
||||
appropriate GDB maintainer. */
|
||||
|
||||
#define RESTORE(name, syscall) RESTORE2 (name, syscall)
|
||||
#define RESTORE2(name, syscall) \
|
||||
asm \
|
||||
( \
|
||||
".align 16\n" \
|
||||
"__" #name ":\n" \
|
||||
" movq $" #syscall ", %rax\n" \
|
||||
" syscall\n" \
|
||||
);
|
||||
|
||||
/* The return code for realtime-signals. */
|
||||
RESTORE (restore_rt, __NR_rt_sigreturn)
|
26
sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h
Normal file
26
sysdeps/unix/sysv/linux/x86_64/sigcontextinfo.h
Normal file
@ -0,0 +1,26 @@
|
||||
/* 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 SIGCONTEXT struct sigcontext
|
||||
#define SIGCONTEXT_EXTRA_ARGS
|
||||
#define GET_PC(ctx) ((void *) ctx.rip)
|
||||
#define GET_FRAME(ctx) ((void *) ctx.rbp)
|
||||
#define GET_STACK(ctx) ((void *) ctx.rsp_at_signal)
|
||||
|
||||
#define CALL_SIGHANDLER(handler, signo, ctx) \
|
||||
(handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
|
1
sysdeps/unix/sysv/linux/x86_64/sigpending.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/sigpending.c
Normal file
@ -0,0 +1 @@
|
||||
#include <sysdeps/unix/sysv/linux/ia64/sigpending.c>
|
1
sysdeps/unix/sysv/linux/x86_64/sigprocmask.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/sigprocmask.c
Normal file
@ -0,0 +1 @@
|
||||
#include <sysdeps/unix/sysv/linux/ia64/sigprocmask.c>
|
1
sysdeps/unix/sysv/linux/x86_64/sigsuspend.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/sigsuspend.c
Normal file
@ -0,0 +1 @@
|
||||
#include <sysdeps/unix/sysv/linux/ia64/sigsuspend.c>
|
1
sysdeps/unix/sysv/linux/x86_64/statfs64.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/statfs64.c
Normal file
@ -0,0 +1 @@
|
||||
/* statfs64 is the same as statfs. */
|
36
sysdeps/unix/sysv/linux/x86_64/sys/perm.h
Normal file
36
sysdeps/unix/sysv/linux/x86_64/sys/perm.h
Normal file
@ -0,0 +1,36 @@
|
||||
/* Copyright (C) 1996, 1999, 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. */
|
||||
|
||||
#ifndef _SYS_PERM_H
|
||||
|
||||
#define _SYS_PERM_H 1
|
||||
#include <features.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Set port input/output permissions. */
|
||||
extern int ioperm (unsigned long int __from, unsigned long int __num,
|
||||
int __turn_on) __THROW;
|
||||
|
||||
|
||||
/* Change I/O privilege level. */
|
||||
extern int iopl (int __level) __THROW;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _SYS_PERM_H */
|
127
sysdeps/unix/sysv/linux/x86_64/sys/procfs.h
Normal file
127
sysdeps/unix/sysv/linux/x86_64/sys/procfs.h
Normal file
@ -0,0 +1,127 @@
|
||||
/* 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. */
|
||||
|
||||
#ifndef _SYS_PROCFS_H
|
||||
#define _SYS_PROCFS_H 1
|
||||
|
||||
/* This is somewhat modelled after the file of the same name on SVR4
|
||||
systems. It provides a definition of the core file format for ELF
|
||||
used on Linux. It doesn't have anything to do with the /proc file
|
||||
system, even though Linux has one.
|
||||
|
||||
Anyway, the whole purpose of this file is for GDB and GDB only.
|
||||
Don't read too much into it. Don't use it for anything other than
|
||||
GDB unless you know what you are doing. */
|
||||
|
||||
#include <features.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
/* Type for a general-purpose register. */
|
||||
typedef unsigned long elf_greg_t;
|
||||
|
||||
/* And the whole bunch of them. We could have used `struct
|
||||
user_regs_struct' directly in the typedef, but tradition says that
|
||||
the register set is an array, which does have some peculiar
|
||||
semantics, so leave it that way. */
|
||||
#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
|
||||
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
|
||||
|
||||
/* Register set for the extended floating-point registers. Includes
|
||||
the Pentium III SSE registers in addition to the classic
|
||||
floating-point stuff. */
|
||||
typedef struct user_fpregs_struct elf_fpregset_t;
|
||||
|
||||
/* Signal info. */
|
||||
struct elf_siginfo
|
||||
{
|
||||
int si_signo; /* Signal number. */
|
||||
int si_code; /* Extra code. */
|
||||
int si_errno; /* Errno. */
|
||||
};
|
||||
|
||||
|
||||
/* Definitions to generate Intel SVR4-like core files. These mostly
|
||||
have the same names as the SVR4 types with "elf_" tacked on the
|
||||
front to prevent clashes with Linux definitions, and the typedef
|
||||
forms have been avoided. This is mostly like the SVR4 structure,
|
||||
but more Linuxy, with things that Linux does not support and which
|
||||
GDB doesn't really use excluded. */
|
||||
|
||||
struct elf_prstatus
|
||||
{
|
||||
struct elf_siginfo pr_info; /* Info associated with signal. */
|
||||
short int pr_cursig; /* Current signal. */
|
||||
unsigned long int pr_sigpend; /* Set of pending signals. */
|
||||
unsigned long int pr_sighold; /* Set of held signals. */
|
||||
__pid_t pr_pid;
|
||||
__pid_t pr_ppid;
|
||||
__pid_t pr_pgrp;
|
||||
__pid_t pr_sid;
|
||||
struct timeval pr_utime; /* User time. */
|
||||
struct timeval pr_stime; /* System time. */
|
||||
struct timeval pr_cutime; /* Cumulative user time. */
|
||||
struct timeval pr_cstime; /* Cumulative system time. */
|
||||
elf_gregset_t pr_reg; /* GP registers. */
|
||||
int pr_fpvalid; /* True if math copro being used. */
|
||||
};
|
||||
|
||||
|
||||
#define ELF_PRARGSZ (80) /* Number of chars for args. */
|
||||
|
||||
struct elf_prpsinfo
|
||||
{
|
||||
char pr_state; /* Numeric process state. */
|
||||
char pr_sname; /* Char for pr_state. */
|
||||
char pr_zomb; /* Zombie. */
|
||||
char pr_nice; /* Nice val. */
|
||||
unsigned long int pr_flag; /* Flags. */
|
||||
unsigned int pr_uid;
|
||||
unsigned int pr_gid;
|
||||
int pr_pid, pr_ppid, pr_pgrp, pr_sid;
|
||||
/* Lots missing */
|
||||
char pr_fname[16]; /* Filename of executable. */
|
||||
char pr_psargs[ELF_PRARGSZ]; /* Initial part of arg list. */
|
||||
};
|
||||
|
||||
|
||||
/* The rest of this file provides the types for emulation of the
|
||||
Solaris <proc_service.h> interfaces that should be implemented by
|
||||
users of libthread_db. */
|
||||
|
||||
/* Addresses. */
|
||||
typedef void *psaddr_t;
|
||||
|
||||
/* Register sets. Linux has different names. */
|
||||
typedef elf_gregset_t prgregset_t;
|
||||
typedef elf_fpregset_t prfpregset_t;
|
||||
|
||||
/* We don't have any differences between processes and threads,
|
||||
therefore have only one PID type. */
|
||||
typedef __pid_t lwpid_t;
|
||||
|
||||
/* Process status and info. In the end we do provide typedefs for them. */
|
||||
typedef struct elf_prstatus prstatus_t;
|
||||
typedef struct elf_prpsinfo prpsinfo_t;
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* sys/procfs.h */
|
47
sysdeps/unix/sysv/linux/x86_64/sys/reg.h
Normal file
47
sysdeps/unix/sysv/linux/x86_64/sys/reg.h
Normal file
@ -0,0 +1,47 @@
|
||||
/* 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. */
|
||||
|
||||
#ifndef _SYS_REG_H
|
||||
#define _SYS_REG_H 1
|
||||
|
||||
/* Index into an array of 8 byte longs returned from ptrace for
|
||||
location of the users' stored general purpose registers. */
|
||||
|
||||
#define R15 0
|
||||
#define R14 1
|
||||
#define R13 2
|
||||
#define R12 3
|
||||
#define RBP 4
|
||||
#define RBX 5
|
||||
#define R11 6
|
||||
#define R10 7
|
||||
#define R9 8
|
||||
#define R8 9
|
||||
#define RAX 10
|
||||
#define RCX 11
|
||||
#define RDX 12
|
||||
#define RSI 13
|
||||
#define RDI 14
|
||||
#define ORIG_RAX 15
|
||||
#define RIP 16
|
||||
#define CS 17
|
||||
#define EFLAGS 18
|
||||
#define RSP 19
|
||||
#define SS 20
|
||||
|
||||
#endif
|
160
sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h
Normal file
160
sysdeps/unix/sysv/linux/x86_64/sys/ucontext.h
Normal file
@ -0,0 +1,160 @@
|
||||
/* 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. */
|
||||
|
||||
#ifndef _SYS_UCONTEXT_H
|
||||
#define _SYS_UCONTEXT_H 1
|
||||
|
||||
#include <features.h>
|
||||
#include <signal.h>
|
||||
|
||||
/* We need the signal context definitions even if they are not used
|
||||
included in <signal.h>. */
|
||||
#include <bits/sigcontext.h>
|
||||
|
||||
/* Type for general register. */
|
||||
typedef long int greg_t;
|
||||
|
||||
/* Number of general registers. */
|
||||
#define NGREG 27
|
||||
|
||||
/* Container for all general registers. */
|
||||
typedef greg_t gregset_t[NGREG];
|
||||
|
||||
#ifdef __USE_GNU
|
||||
/* Number of each register in the `gregset_t' array. */
|
||||
enum
|
||||
{
|
||||
REG_GSFS = 0,
|
||||
# define REG_GSFS REG_GSFS
|
||||
REG_ESDS,
|
||||
# define REG_ESDS REG_ESDS
|
||||
REG_R8,
|
||||
# define REG_R8 REG_R8
|
||||
REG_R9,
|
||||
# define REG_R9 REG_R9
|
||||
REG_R10,
|
||||
# define REG_R10 REG_R10
|
||||
REG_R11,
|
||||
# define REG_R11 REG_R11
|
||||
REG_R12,
|
||||
# define REG_R12 REG_R12
|
||||
REG_R13,
|
||||
# define REG_R13 REG_R13
|
||||
REG_R14,
|
||||
# define REG_R14 REG_R14
|
||||
REG_R15,
|
||||
# define REG_R15 REG_R15
|
||||
REG_RDI,
|
||||
# define REG_RDI REG_RDI
|
||||
REG_RSI,
|
||||
# define REG_RSI REG_RSI
|
||||
REG_RBP,
|
||||
# define REG_RBP REG_RBP
|
||||
REG_RSP,
|
||||
# define REG_RSP REG_RSP
|
||||
REG_RBX,
|
||||
# define REG_RBX REG_RBX
|
||||
REG_RDX,
|
||||
# define REG_RDX REG_RDX
|
||||
REG_RCX,
|
||||
# define REG_RCX REG_RCX
|
||||
REG_RAX,
|
||||
# define REG_RAX REG_RAX
|
||||
REG_TRAPNO,
|
||||
# define REG_TRAPNO REG_TRAPNO
|
||||
REG_ERR,
|
||||
# define REG_ERR REG_ERR
|
||||
REG_RIP,
|
||||
# define REG_RIP REG_RIP
|
||||
REG_CS,
|
||||
# define REG_CS REG_CS
|
||||
REG_EFL,
|
||||
# define REG_EFL REG_EFL
|
||||
REG_URSP,
|
||||
# define REG_URSP REG_URSP
|
||||
REG_SS
|
||||
# define REG_SS REG_SS
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Definitions taken from the kernel headers. */
|
||||
struct _libc_fpreg
|
||||
{
|
||||
unsigned short int significand[4];
|
||||
unsigned short int exponent;
|
||||
};
|
||||
|
||||
struct _libc_fpxreg
|
||||
{
|
||||
unsigned short int significand[4];
|
||||
unsigned short int exponent;
|
||||
unsigned short int padding[3];
|
||||
};
|
||||
|
||||
struct _libc_xmmreg
|
||||
{
|
||||
unsigned long int element[4];
|
||||
};
|
||||
|
||||
struct _libc_fpstate
|
||||
{
|
||||
/* Regular FPU environment. */
|
||||
unsigned long int cw;
|
||||
unsigned long int sw;
|
||||
unsigned long int tag;
|
||||
unsigned long int ipoff;
|
||||
unsigned long int cssel;
|
||||
unsigned long int dataoff;
|
||||
unsigned long int datasel;
|
||||
struct _libc_fpreg _st[16];
|
||||
unsigned short int status;
|
||||
unsigned short int magic;
|
||||
/* FXSR FPU environment. */
|
||||
|
||||
unsigned long int _fxsr_env[6];
|
||||
unsigned long int mxcsr;
|
||||
unsigned long int reserved;
|
||||
struct _libc_fpxreg _fxsr_st[8];
|
||||
struct _libc_xmmreg _xmm[16];
|
||||
unsigned long int padding[32];
|
||||
};
|
||||
|
||||
/* Structure to describe FPU registers. */
|
||||
typedef struct _libc_fpstate fpregset_t;
|
||||
|
||||
/* Context to describe whole processor state. */
|
||||
typedef struct
|
||||
{
|
||||
gregset_t gregs;
|
||||
fpregset_t fpregs;
|
||||
unsigned long int oldmask;
|
||||
unsigned long int cr2;
|
||||
} mcontext_t;
|
||||
|
||||
/* Userlevel context. */
|
||||
typedef struct ucontext
|
||||
{
|
||||
unsigned long int uc_flags;
|
||||
struct ucontext *uc_link;
|
||||
stack_t uc_stack;
|
||||
mcontext_t uc_mcontext;
|
||||
__sigset_t uc_sigmask;
|
||||
struct _libc_fpstate __fpregs_mem;
|
||||
} ucontext_t;
|
||||
|
||||
#endif /* sys/ucontext.h */
|
97
sysdeps/unix/sysv/linux/x86_64/sys/user.h
Normal file
97
sysdeps/unix/sysv/linux/x86_64/sys/user.h
Normal file
@ -0,0 +1,97 @@
|
||||
/* 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. */
|
||||
|
||||
#ifndef _SYS_USER_H
|
||||
#define _SYS_USER_H 1
|
||||
|
||||
/* The whole purpose of this file is for GDB and GDB only. Don't read
|
||||
too much into it. Don't use it for anything other than GDB unless
|
||||
you know what you are doing. */
|
||||
|
||||
struct user_fpregs_struct
|
||||
{
|
||||
unsigned short int cwd;
|
||||
unsigned short int swd;
|
||||
unsigned short int twd;
|
||||
unsigned short int fop;
|
||||
unsigned int fip;
|
||||
unsigned int fcs;
|
||||
unsigned int foo;
|
||||
unsigned int fos;
|
||||
unsigned int mxcsr;
|
||||
unsigned int reserved;
|
||||
unsigned int st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
|
||||
unsigned int xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */
|
||||
unsigned int padding[56];
|
||||
};
|
||||
|
||||
struct user_regs_struct
|
||||
{
|
||||
unsigned long r15;
|
||||
unsigned long r14;
|
||||
unsigned long r13;
|
||||
unsigned long r12;
|
||||
unsigned long rbp;
|
||||
unsigned long rbx;
|
||||
unsigned long r11;
|
||||
unsigned long r10;
|
||||
unsigned long r9;
|
||||
unsigned long r8;
|
||||
unsigned long rax;
|
||||
unsigned long rcx;
|
||||
unsigned long rdx;
|
||||
unsigned long rsi;
|
||||
unsigned long rdi;
|
||||
unsigned long orig_rax;
|
||||
unsigned long rip;
|
||||
unsigned long cs;
|
||||
unsigned long eflags;
|
||||
unsigned long rsp;
|
||||
unsigned long ss;
|
||||
unsigned long fs_base;
|
||||
unsigned long kernel_gs_base;
|
||||
};
|
||||
|
||||
struct user
|
||||
{
|
||||
struct user_regs_struct regs;
|
||||
int u_fpvalid;
|
||||
struct user_fpregs_struct i387;
|
||||
unsigned long int u_tsize;
|
||||
unsigned long int u_dsize;
|
||||
unsigned long int u_ssize;
|
||||
unsigned long start_code;
|
||||
unsigned long start_stack;
|
||||
long int signal;
|
||||
int reserved;
|
||||
struct user_regs_struct* u_ar0;
|
||||
struct user_fpregs_struct* u_fpstate;
|
||||
unsigned long int magic;
|
||||
char u_comm [32];
|
||||
int u_debugreg [8];
|
||||
};
|
||||
|
||||
#define PAGE_SHIFT 12
|
||||
#define PAGE_SIZE (1UL << PAGE_SHIFT)
|
||||
#define PAGE_MASK (~(PAGE_SIZE-1))
|
||||
#define NBPG PAGE_SIZE
|
||||
#define UPAGES 1
|
||||
#define HOST_TEXT_START_ADDR (u.start_code)
|
||||
#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
|
||||
|
||||
#endif /* _SYS_USER_H */
|
44
sysdeps/unix/sysv/linux/x86_64/syscall.S
Normal file
44
sysdeps/unix/sysv/linux/x86_64/syscall.S
Normal file
@ -0,0 +1,44 @@
|
||||
/* 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. */
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
/* Please consult the file sysdeps/unix/sysv/linux/x86-64/sysdep.h for
|
||||
more information about the value -4095 used below. */
|
||||
|
||||
/* Usage: long syscall (syscall_number, arg1, arg2, arg3, arg4, arg5)
|
||||
We need to do some arg shifting, the syscall_number will be in
|
||||
rax. */
|
||||
|
||||
|
||||
.text
|
||||
ENTRY (syscall)
|
||||
|
||||
movq %rdi, %rax /* Syscall number -> rax. */
|
||||
movq %rsi, %rdi /* shift arg1 - arg5. */
|
||||
movq %rdx, %rsi
|
||||
movq %rcx, %rdx
|
||||
movq %r8, %r10
|
||||
movq %r9, %r8
|
||||
syscall /* Do the system call. */
|
||||
cmpq $-4095, %rax /* Check %rax for error. */
|
||||
jae SYSCALL_ERROR_LABEL /* Jump to error handler if error. */
|
||||
L(pseudo_end):
|
||||
ret /* Return to caller. */
|
||||
|
||||
PSEUDO_END (syscall)
|
44
sysdeps/unix/sysv/linux/x86_64/syscalls.list
Normal file
44
sysdeps/unix/sysv/linux/x86_64/syscalls.list
Normal file
@ -0,0 +1,44 @@
|
||||
# File name Caller Syscall name # args Strong name Weak names
|
||||
|
||||
mmap - mmap b:aniiii __mmap mmap __mmap64 mmap64
|
||||
llseek EXTRA lseek i:iii __libc_lseek64 __llseek llseek __lseek64 lseek64
|
||||
pread - pread i:ibni __libc_pread __libc_pread64 __pread pread __pread64 pread64
|
||||
pwrite - pwrite i:ibni __libc_pwrite __libc_pwrite64 __pwrite pwrite __pwrite64 pwrite64
|
||||
fstatfs - fstatfs i:ip __fstatfs fstatfs __fstatfs64 fstatfs64
|
||||
statfs - statfs i:sp __statfs statfs statfs64
|
||||
getrlimit - getrlimit i:ip __getrlimit getrlimit getrlimit64
|
||||
setrlimit - setrlimit i:ip __setrlimit setrlimit64 setrlimit
|
||||
ftruncate - ftruncate i:ii __ftruncate ftruncate ftruncate64 __ftruncate64
|
||||
truncate - truncate i:si truncate truncate64
|
||||
ptrace - ptrace i:iipp __ptrace ptrace
|
||||
|
||||
# semaphore and shm system calls
|
||||
msgctl - msgctl i:iip __msgctl msgctl
|
||||
msgget - msgget i:ii __msgget msgget
|
||||
msgrcv - msgrcv i:ibnii __msgrcv msgrcv
|
||||
msgsnd - msgsnd i:ibni __msgsnd msgsnd
|
||||
shmat - shmat i:ipi __shmat shmat
|
||||
shmctl - shmctl i:iip __shmctl shmctl
|
||||
shmdt - shmdt i:s __shmdt shmdt
|
||||
shmget - shmget i:iii __shmget shmget
|
||||
semop - semop i:ipi __semop semop
|
||||
semget - semget i:iii __semget semget
|
||||
semctl - semctl i:iiii __semctl semctl
|
||||
|
||||
|
||||
# proper socket implementations:
|
||||
accept - accept i:iBN __libc_accept __accept accept
|
||||
bind - bind i:ipi __bind bind
|
||||
connect - connect i:ipi __libc_connect __connect connect
|
||||
getpeername - getpeername i:ipp __getpeername getpeername
|
||||
getsockname - getsockname i:ipp __getsockname getsockname
|
||||
getsockopt - getsockopt i:iiiBN __getsockopt getsockopt
|
||||
listen - listen i:ii __listen listen
|
||||
recvfrom - recvfrom i:ibniBN __libc_recvfrom __recvfrom recvfrom
|
||||
recvmsg - recvmsg i:ipi __libc_recvmsg recvmsg
|
||||
sendmsg - sendmsg i:ipi __libc_sendmsg sendmsg
|
||||
sendto - sendto i:ibnibn __libc_sendto __sendto sendto
|
||||
setsockopt - setsockopt i:iiibn __setsockopt setsockopt
|
||||
shutdown - shutdown i:ii __shutdown shutdown
|
||||
socket - socket i:iii __socket socket
|
||||
socketpair - socketpair i:iiif __socketpair socketpair
|
56
sysdeps/unix/sysv/linux/x86_64/sysdep.S
Normal file
56
sysdeps/unix/sysv/linux/x86_64/sysdep.S
Normal file
@ -0,0 +1,56 @@
|
||||
/* 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. */
|
||||
|
||||
#include <sysdep.h>
|
||||
|
||||
/* Because the Linux version is in fact x86-64/ELF and the start.? file
|
||||
for this system (sysdeps/x86_64/elf/start.S) is also used by The Hurd
|
||||
and therefore this files must not contain the definition of the
|
||||
`errno' variable (I don't know why, ask Roland), we have to define
|
||||
it somewhere else.
|
||||
|
||||
...and this place is here. */
|
||||
.bss
|
||||
.globl errno
|
||||
.type errno,@object
|
||||
.size errno,4
|
||||
errno:
|
||||
.space 4
|
||||
weak_alias (errno, _errno)
|
||||
|
||||
/* The following code is only used in the shared library when we
|
||||
compile the reentrant version. Otherwise each system call defines
|
||||
each own version. */
|
||||
|
||||
#ifndef PIC
|
||||
|
||||
/* The syscall stubs jump here when they detect an error.
|
||||
The code for Linux is almost identical to the canonical Unix
|
||||
code, except that the error number in %rax is negated. */
|
||||
|
||||
#undef CALL_MCOUNT
|
||||
#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers %rax. */
|
||||
|
||||
.text
|
||||
ENTRY (__syscall_error)
|
||||
negq %rax
|
||||
|
||||
#define __syscall_error __syscall_error_1
|
||||
#include <sysdeps/unix/x86_64/sysdep.S>
|
||||
|
||||
#endif /* !PIC */
|
205
sysdeps/unix/sysv/linux/x86_64/sysdep.h
Normal file
205
sysdeps/unix/sysv/linux/x86_64/sysdep.h
Normal file
@ -0,0 +1,205 @@
|
||||
/* 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. */
|
||||
|
||||
#ifndef _LINUX_X86_64_SYSDEP_H
|
||||
#define _LINUX_X86_64_SYSDEP_H 1
|
||||
|
||||
/* There is some commonality. */
|
||||
#include <sysdeps/unix/x86_64/sysdep.h>
|
||||
#include <bp-sym.h>
|
||||
#include <bp-asm.h>
|
||||
|
||||
/* For Linux we can use the system call table in the header file
|
||||
/usr/include/asm/unistd.h
|
||||
of the kernel. But these symbols do not follow the SYS_* syntax
|
||||
so we have to redefine the `SYS_ify' macro here. */
|
||||
#undef SYS_ify
|
||||
#define SYS_ify(syscall_name) __NR_##syscall_name
|
||||
|
||||
/* ELF-like local names start with `.L'. */
|
||||
#undef L
|
||||
#define L(name) .L##name
|
||||
|
||||
#ifdef __ASSEMBLER__
|
||||
|
||||
/* Linux uses a negative return value to indicate syscall errors,
|
||||
unlike most Unices, which use the condition codes' carry flag.
|
||||
|
||||
Since version 2.1 the return value of a system call might be
|
||||
negative even if the call succeeded. E.g., the `lseek' system call
|
||||
might return a large offset. Therefore we must not anymore test
|
||||
for < 0, but test for a real error by making sure the value in %eax
|
||||
is a real error number. Linus said he will make sure the no syscall
|
||||
returns a value in -1 .. -4095 as a valid result so we can savely
|
||||
test with -4095. */
|
||||
|
||||
/* We don't want the label for the error handle to be global when we define
|
||||
it here. */
|
||||
#ifdef PIC
|
||||
# define SYSCALL_ERROR_LABEL 0f
|
||||
#else
|
||||
# define SYSCALL_ERROR_LABEL syscall_error
|
||||
#endif
|
||||
|
||||
#undef PSEUDO
|
||||
#define PSEUDO(name, syscall_name, args) \
|
||||
.text; \
|
||||
ENTRY (name) \
|
||||
DO_CALL (args, syscall_name); \
|
||||
cmpq $-4095, %rax; \
|
||||
jae SYSCALL_ERROR_LABEL; \
|
||||
L(pseudo_end):
|
||||
|
||||
#undef PSEUDO_END
|
||||
#define PSEUDO_END(name) \
|
||||
SYSCALL_ERROR_HANDLER \
|
||||
END (name)
|
||||
|
||||
#ifndef PIC
|
||||
#define SYSCALL_ERROR_HANDLER /* Nothing here; code in sysdep.S is used. */
|
||||
#else
|
||||
/* Store (- %rax) into errno through the GOT. */
|
||||
#ifdef _LIBC_REENTRANT
|
||||
#define SYSCALL_ERROR_HANDLER \
|
||||
0: \
|
||||
xorq %rdx, %rdx; \
|
||||
subq %rax, %rdx; \
|
||||
pushq %rdx \
|
||||
PUSH_ERRNO_LOCATION_RETURN; \
|
||||
call BP_SYM (__errno_location)@PLT; \
|
||||
POP_ERRNO_LOCATION_RETURN; \
|
||||
popq %rdx; \
|
||||
movq %rdx, (%rax); \
|
||||
orq $-1, %rax; \
|
||||
jmp L(pseudo_end);
|
||||
|
||||
/* A quick note: it is assumed that the call to `__errno_location' does
|
||||
not modify the stack! */
|
||||
#else
|
||||
#define SYSCALL_ERROR_HANDLER \
|
||||
0:movq errno@GOTPCREL(%RIP), %rcx; \
|
||||
xorq %rdx, %rdx; \
|
||||
subq %rax, %rdx; \
|
||||
movq %rdx, (%rcx); \
|
||||
orq $-1, %rax; \
|
||||
jmp L(pseudo_end);
|
||||
#endif /* _LIBC_REENTRANT */
|
||||
#endif /* PIC */
|
||||
|
||||
/* Linux/x86-64 takes system call arguments in registers:
|
||||
|
||||
Register setup:
|
||||
system call number rax
|
||||
arg 1 rdi
|
||||
arg 2 rsi
|
||||
arg 3 rdx
|
||||
arg 4 rcx
|
||||
arg 5 r8
|
||||
arg 6 r9
|
||||
|
||||
return address from
|
||||
syscall rcx
|
||||
additionally clobered: r12-r15,rbx,rbp
|
||||
eflags from syscall r11
|
||||
|
||||
The compiler is going to form a call by coming here, through PSEUDO, with arguments:
|
||||
|
||||
syscall number in the DO_CALL macro
|
||||
arg 1 rdi
|
||||
arg 2 rsi
|
||||
arg 3 rdx
|
||||
arg 4 r10
|
||||
arg 5 r8
|
||||
arg 6 r9
|
||||
|
||||
We have to take care that the stack is alignedto 16 bytes. When
|
||||
called the stack is not aligned since the return address has just
|
||||
been pushed.
|
||||
|
||||
Syscalls of more than 6 arguments are not supported. */
|
||||
|
||||
#undef DO_CALL
|
||||
#define DO_CALL(args, syscall_name) \
|
||||
DOARGS_##args \
|
||||
movq $SYS_ify (syscall_name), %rax; \
|
||||
syscall;
|
||||
|
||||
#define DOARGS_0 /* nothing */
|
||||
#define DOARGS_1 /* nothing */
|
||||
#define DOARGS_2 /* nothing */
|
||||
#define DOARGS_3 /* nothing */
|
||||
#define DOARGS_4 movq %rcx, %r10;
|
||||
#define DOARGS_5 DOARGS_4
|
||||
#define DOARGS_6 DOARGS_5
|
||||
|
||||
#else /* !__ASSEMBLER__ */
|
||||
/* Define a macro which expands inline into the wrapper code for a system
|
||||
call. */
|
||||
#undef INLINE_SYSCALL
|
||||
#define INLINE_SYSCALL(name, nr, args...) \
|
||||
({ \
|
||||
unsigned long resultvar; \
|
||||
LOAD_ARGS_##nr (args) \
|
||||
asm volatile ( \
|
||||
"movq %1, %%rax\n\t" \
|
||||
"syscall\n\t" \
|
||||
: "=a" (resultvar) \
|
||||
: "i" (__NR_##name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx"); \
|
||||
if (resultvar >= (unsigned long) -4095) \
|
||||
{ \
|
||||
__set_errno (-resultvar); \
|
||||
resultvar = (unsigned long) -1; \
|
||||
} \
|
||||
(long) resultvar; })
|
||||
|
||||
#define LOAD_ARGS_0()
|
||||
#define ASM_ARGS_0
|
||||
|
||||
#define LOAD_ARGS_1(a1) \
|
||||
register long int _a1 asm ("rdi") = (long) (a1); \
|
||||
LOAD_ARGS_0 ()
|
||||
#define ASM_ARGS_1 ASM_ARGS_0, "r" (_a1)
|
||||
|
||||
#define LOAD_ARGS_2(a1, a2) \
|
||||
register long int _a2 asm ("rsi") = (long) (a2); \
|
||||
LOAD_ARGS_1 (a1)
|
||||
#define ASM_ARGS_2 ASM_ARGS_1, "r" (_a2)
|
||||
|
||||
#define LOAD_ARGS_3(a1, a2, a3) \
|
||||
register long int _a3 asm ("rdx") = (long) (a3); \
|
||||
LOAD_ARGS_2 (a1, a2)
|
||||
#define ASM_ARGS_3 ASM_ARGS_2, "r" (_a3)
|
||||
|
||||
#define LOAD_ARGS_4(a1, a2, a3, a4) \
|
||||
register long int _a4 asm ("r10") = (long) (a4); \
|
||||
LOAD_ARGS_3 (a1, a2, a3)
|
||||
#define ASM_ARGS_4 ASM_ARGS_3, "r" (_a4)
|
||||
|
||||
#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \
|
||||
register long int _a5 asm ("r8") = (long) (a5); \
|
||||
LOAD_ARGS_4 (a1, a2, a3, a4)
|
||||
#define ASM_ARGS_5 ASM_ARGS_4, "r" (_a5)
|
||||
|
||||
#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \
|
||||
register long int _a6 asm ("r9") = (long) (a6); \
|
||||
LOAD_ARGS_5 (a1, a2, a3, a4, a5)
|
||||
#define ASM_ARGS_6 ASM_ARGS_5, "r" (_a6)
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
||||
|
||||
#endif /* linux/x86_64/sysdep.h */
|
33
sysdeps/unix/sysv/linux/x86_64/time.c
Normal file
33
sysdeps/unix/sysv/linux/x86_64/time.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* 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. */
|
||||
|
||||
#include <asm/vsyscall.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
/* Return the current time as a `time_t' and also put it in *T if T is
|
||||
not NULL. Time is represented as seconds from Jan 1 00:00:00 1970. */
|
||||
time_t
|
||||
time (time_t *t)
|
||||
{
|
||||
/* We're using a virtual syscall here. */
|
||||
time_t (*__vtime)(time_t * time)
|
||||
= (time_t (*)(time_t *)) VSYSCALL_ADDR (__NR_vtime);
|
||||
|
||||
return __vtime (t);
|
||||
}
|
1
sysdeps/unix/sysv/linux/x86_64/truncate64.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/truncate64.c
Normal file
@ -0,0 +1 @@
|
||||
/* truncate64 is the same as truncate. */
|
1
sysdeps/unix/sysv/linux/x86_64/umount.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/umount.c
Normal file
@ -0,0 +1 @@
|
||||
#include <sysdeps/unix/sysv/linux/hppa/umount.c>
|
52
sysdeps/unix/sysv/linux/x86_64/vfork.S
Normal file
52
sysdeps/unix/sysv/linux/x86_64/vfork.S
Normal file
@ -0,0 +1,52 @@
|
||||
/* 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. */
|
||||
|
||||
#include <sysdep.h>
|
||||
#define _ERRNO_H 1
|
||||
#include <bits/errno.h>
|
||||
|
||||
/* Clone the calling process, but without copying the whole address space.
|
||||
The calling process is suspended until the new process exits or is
|
||||
replaced by a call to `execve'. Return -1 for errors, 0 to the new process,
|
||||
and the process ID of the new process to the old process. */
|
||||
|
||||
ENTRY (__vfork)
|
||||
|
||||
/* Pop the return PC value into RBX. */
|
||||
popq %rbx
|
||||
|
||||
/* Stuff the syscall number in RAX and enter into the kernel. */
|
||||
movl $SYS_ify (vfork), %eax
|
||||
syscall
|
||||
cmpl $-4095, %eax
|
||||
jae .Lerror /* Branch forward if it failed. */
|
||||
|
||||
/* Jump to the return PC. */
|
||||
jmp *%rbx
|
||||
|
||||
.Lerror:
|
||||
/* Push back the return PC. */
|
||||
pushq %rbx
|
||||
jmp SYSCALL_ERROR_LABEL
|
||||
|
||||
.Lpseudo_end:
|
||||
ret
|
||||
|
||||
PSEUDO_END (__vfork)
|
||||
|
||||
weak_alias (__vfork, vfork)
|
1
sysdeps/unix/sysv/linux/x86_64/xstat.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/xstat.c
Normal file
@ -0,0 +1 @@
|
||||
#include <sysdeps/unix/sysv/linux/ia64/xstat.c>
|
1
sysdeps/unix/sysv/linux/x86_64/xstat64.c
Normal file
1
sysdeps/unix/sysv/linux/x86_64/xstat64.c
Normal file
@ -0,0 +1 @@
|
||||
/* xstat64 is in xstat.c */
|
71
sysdeps/unix/x86_64/sysdep.S
Normal file
71
sysdeps/unix/x86_64/sysdep.S
Normal file
@ -0,0 +1,71 @@
|
||||
/* 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. */
|
||||
|
||||
#include <sysdep.h>
|
||||
#define _ERRNO_H
|
||||
#include <bits/errno.h>
|
||||
#include <bp-asm.h>
|
||||
#include <bp-sym.h>
|
||||
|
||||
.globl C_SYMBOL_NAME(errno)
|
||||
.globl syscall_error
|
||||
|
||||
#undef syscall_error
|
||||
#ifdef NO_UNDERSCORES
|
||||
__syscall_error:
|
||||
#else
|
||||
syscall_error:
|
||||
#endif
|
||||
#if defined (EWOULDBLOCK_sys) && EWOULDBLOCK_sys != EAGAIN
|
||||
/* We translate the system's EWOULDBLOCK error into EAGAIN.
|
||||
The GNU C library always defines EWOULDBLOCK==EAGAIN.
|
||||
EWOULDBLOCK_sys is the original number. */
|
||||
cmpq $EWOULDBLOCK_sys, %rax /* Is it the old EWOULDBLOCK? */
|
||||
jne notb /* Branch if not. */
|
||||
movq $EAGAIN, %rax /* Yes; translate it to EAGAIN. */
|
||||
notb:
|
||||
#endif
|
||||
#ifndef PIC
|
||||
# ifndef _LIBC_REENTRANT
|
||||
movq %rax, C_SYMBOL_NAME(errno)
|
||||
# else
|
||||
pushq %rax
|
||||
PUSH_ERRNO_LOCATION_RETURN
|
||||
call BP_SYM (__errno_location)
|
||||
POP_ERRNO_LOCATION_RETURN
|
||||
popq %rcx
|
||||
movq %rcx, (%rax)
|
||||
# endif
|
||||
#else
|
||||
# ifndef _LIBC_REENTRANT
|
||||
movq C_SYMBOL_NAME(errno)@GOTPCREL(%rip), %rcx
|
||||
movq %rax, (%rcx)
|
||||
# else
|
||||
pushq %rax
|
||||
PUSH_ERRNO_LOCATION_RETURN
|
||||
call C_SYMBOL_NAME (BP_SYM (__errno_location)@PLT)
|
||||
POP_ERRNO_LOCATION_RETURN
|
||||
popq %rcx
|
||||
movq %rcx, (%rax)
|
||||
# endif
|
||||
#endif
|
||||
movq $-1, %rax
|
||||
ret
|
||||
|
||||
#undef __syscall_error
|
||||
END (__syscall_error)
|
35
sysdeps/unix/x86_64/sysdep.h
Normal file
35
sysdeps/unix/x86_64/sysdep.h
Normal file
@ -0,0 +1,35 @@
|
||||
/* Copyright (C) 1991, 92, 93, 95, 96, 97, 2000, 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. */
|
||||
|
||||
#include <sysdeps/unix/sysdep.h>
|
||||
#include <sysdeps/x86_64/sysdep.h>
|
||||
|
||||
#ifdef __ASSEMBLER__
|
||||
|
||||
/* This is defined as a separate macro so that other sysdep.h files
|
||||
can include this one and then redefine DO_CALL. */
|
||||
|
||||
#define DO_CALL(syscall_name, args) \
|
||||
lea SYS_ify (syscall_name), %rax; \
|
||||
syscall
|
||||
|
||||
#define r0 %rax /* Normal return-value register. */
|
||||
#define r1 %rbx /* Secondary return-value register. */
|
||||
#define MOVE(x,y) movq x, y
|
||||
|
||||
#endif /* __ASSEMBLER__ */
|
4
sysdeps/x86_64/Implies
Normal file
4
sysdeps/x86_64/Implies
Normal file
@ -0,0 +1,4 @@
|
||||
wordsize-64
|
||||
ieee754/ldbl-96
|
||||
ieee754/dbl-64
|
||||
ieee754/flt-32
|
6
sysdeps/x86_64/Makefile
Normal file
6
sysdeps/x86_64/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
# The i387 `long double' is a distinct type we support.
|
||||
long-double-fcts = yes
|
||||
|
||||
ifeq ($(subdir),csu)
|
||||
sysdep_routines += hp-timing
|
||||
endif
|
5
sysdeps/x86_64/Versions
Normal file
5
sysdeps/x86_64/Versions
Normal file
@ -0,0 +1,5 @@
|
||||
ld {
|
||||
GLIBC_2.2.5 {
|
||||
_dl_cpuclock_offset;
|
||||
}
|
||||
}
|
44
sysdeps/x86_64/__longjmp.S
Normal file
44
sysdeps/x86_64/__longjmp.S
Normal file
@ -0,0 +1,44 @@
|
||||
/* 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. */
|
||||
|
||||
#include <sysdep.h>
|
||||
#define _ASM
|
||||
#define _SETJMP_H
|
||||
#include <bits/setjmp.h>
|
||||
#include <asm-syntax.h>
|
||||
|
||||
/* Jump to the position specified by ENV, causing the
|
||||
setjmp call there to return VAL, or 1 if VAL is 0.
|
||||
void __longjmp (__jmp_buf env, int val). */
|
||||
ENTRY(__longjmp)
|
||||
/* Restore registers. */
|
||||
movq (JB_RBX*8)(%rdi),%rbx
|
||||
movq (JB_RBP*8)(%rdi),%rbp
|
||||
movq (JB_R12*8)(%rdi),%r12
|
||||
movq (JB_R13*8)(%rdi),%r13
|
||||
movq (JB_R14*8)(%rdi),%r14
|
||||
movq (JB_R15*8)(%rdi),%r15
|
||||
/* Set return value for setjmp. */
|
||||
test %esi,%esi
|
||||
mov $01,%eax
|
||||
cmove %eax,%esi
|
||||
mov %esi, %eax
|
||||
movq (JB_PC*8)(%rdi),%rdx
|
||||
movq (JB_RSP*8)(%rdi),%rsp
|
||||
jmpq *%rdx
|
||||
END (BP_SYM (__longjmp))
|
2
sysdeps/x86_64/abort-instr.h
Normal file
2
sysdeps/x86_64/abort-instr.h
Normal file
@ -0,0 +1,2 @@
|
||||
/* An instruction which should crash any program is `hlt'. */
|
||||
#define ABORT_INSTRUCTION asm ("hlt")
|
57
sysdeps/x86_64/atomicity.h
Normal file
57
sysdeps/x86_64/atomicity.h
Normal file
@ -0,0 +1,57 @@
|
||||
/* Low-level functions for atomic operations. x86-64 version.
|
||||
Copyright (C) 1997, 2000, 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. */
|
||||
|
||||
#ifndef _ATOMICITY_H
|
||||
#define _ATOMICITY_H 1
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
|
||||
static inline uint32_t
|
||||
__attribute__ ((unused))
|
||||
exchange_and_add (volatile uint32_t *mem, uint32_t val)
|
||||
{
|
||||
register uint32_t result;
|
||||
__asm__ __volatile__ ("lock; xaddl %0,%1"
|
||||
: "=r" (result), "=m" (*mem) : "0" (val), "1" (*mem));
|
||||
return result;
|
||||
}
|
||||
|
||||
static inline void
|
||||
__attribute__ ((unused))
|
||||
atomic_add (volatile uint32_t *mem, int val)
|
||||
{
|
||||
__asm__ __volatile__ ("lock; addl %1,%0"
|
||||
: "=m" (*mem) : "er" (val), "0" (*mem));
|
||||
}
|
||||
|
||||
static inline char
|
||||
__attribute__ ((unused))
|
||||
compare_and_swap (volatile long int *p, long int oldval, long int newval)
|
||||
{
|
||||
char ret;
|
||||
long int readval;
|
||||
|
||||
__asm__ __volatile__ ("lock; cmpxchgq %3, %1; sete %0"
|
||||
: "=q" (ret), "=m" (*p), "=a" (readval)
|
||||
: "r" (newval), "1" (*p), "a" (oldval));
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* atomicity.h */
|
7
sysdeps/x86_64/bits/endian.h
Normal file
7
sysdeps/x86_64/bits/endian.h
Normal file
@ -0,0 +1,7 @@
|
||||
/* x86_64 is little-endian. */
|
||||
|
||||
#ifndef _ENDIAN_H
|
||||
# error "Never use <bits/endian.h> directly; include <endian.h> instead."
|
||||
#endif
|
||||
|
||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
47
sysdeps/x86_64/bits/setjmp.h
Normal file
47
sysdeps/x86_64/bits/setjmp.h
Normal file
@ -0,0 +1,47 @@
|
||||
/* 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 the machine-dependent type `jmp_buf'. x86-64 version. */
|
||||
|
||||
#ifndef _SETJMP_H
|
||||
# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
|
||||
#endif
|
||||
|
||||
/* We only need to save callee-saved registers plus stackpointer and
|
||||
program counter. */
|
||||
#if defined __USE_MISC || defined _ASM
|
||||
# define JB_RBX 0
|
||||
# define JB_RBP 1
|
||||
# define JB_R12 2
|
||||
# define JB_R13 3
|
||||
# define JB_R14 4
|
||||
# define JB_R15 5
|
||||
# define JB_RSP 6
|
||||
# define JB_PC 7
|
||||
# define JB_SIZE (8*8)
|
||||
#endif
|
||||
|
||||
#ifndef _ASM
|
||||
|
||||
typedef long int __jmp_buf[8];
|
||||
|
||||
/* Test if longjmp to JMPBUF would unwind the frame
|
||||
containing a local variable at ADDRESS. */
|
||||
#define _JMPBUF_UNWINDS(jmpbuf, address) \
|
||||
((void *) (address) < (void *) (jmpbuf)[JB_RSP])
|
||||
#endif
|
26
sysdeps/x86_64/bits/string.h
Normal file
26
sysdeps/x86_64/bits/string.h
Normal file
@ -0,0 +1,26 @@
|
||||
/* Optimized, inlined string functions. AMD x86-64 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. */
|
||||
|
||||
#ifndef _STRING_H
|
||||
# error "Never use <bits/string.h> directly; include <string.h> instead."
|
||||
#endif
|
||||
|
||||
/* Currently the only purpose of this file is to tell the generic inline
|
||||
macros that unaligned memory access is possible for x86-64. */
|
||||
#define _STRING_ARCH_unaligned 1
|
141
sysdeps/x86_64/bp-asm.h
Normal file
141
sysdeps/x86_64/bp-asm.h
Normal file
@ -0,0 +1,141 @@
|
||||
/* Bounded-pointer definitions for x86-64 assembler.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
|
||||
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 _bp_asm_h_
|
||||
# define _bp_asm_h_ 1
|
||||
|
||||
# if __ASSEMBLER__
|
||||
|
||||
# if __BOUNDED_POINTERS__
|
||||
|
||||
/* Bounded pointers occupy three words. */
|
||||
# define PTR_SIZE 24
|
||||
/* Bounded pointer return values are passed back through a hidden
|
||||
argument that points to caller-allocate space. The hidden arg
|
||||
occupies one word on the stack. */
|
||||
# define RTN_SIZE 6
|
||||
/* Although the caller pushes the hidden arg, the callee is
|
||||
responsible for popping it. */
|
||||
# define RET_PTR ret $RTN_SIZE
|
||||
/* Maintain frame pointer chain in leaf assembler functions for the benefit
|
||||
of debugging stack traces when bounds violations occur. */
|
||||
# define ENTER pushq %rbp; movq %rsp, %rbp
|
||||
# define LEAVE movq %rbp, %rsp; popq %rbp
|
||||
/* Stack space overhead of procedure-call linkage: return address and
|
||||
frame pointer. */
|
||||
# define LINKAGE 16
|
||||
/* Stack offset of return address after calling ENTER. */
|
||||
# define PCOFF 8
|
||||
|
||||
/* Int 5 is the "bound range" exception also raised by the "bound"
|
||||
instruction. */
|
||||
# define BOUNDS_VIOLATED int $5
|
||||
|
||||
# define CHECK_BOUNDS_LOW(VAL_REG, BP_MEM) \
|
||||
cmpq 8+BP_MEM, VAL_REG; \
|
||||
jae 0f; /* continue if value >= low */ \
|
||||
BOUNDS_VIOLATED; \
|
||||
0:
|
||||
|
||||
# define CHECK_BOUNDS_HIGH(VAL_REG, BP_MEM, Jcc) \
|
||||
cmpq 16+BP_MEM, VAL_REG; \
|
||||
Jcc 0f; /* continue if value < high */ \
|
||||
BOUNDS_VIOLATED; \
|
||||
0:
|
||||
|
||||
# define CHECK_BOUNDS_BOTH(VAL_REG, BP_MEM) \
|
||||
cmpq 8+BP_MEM, VAL_REG; \
|
||||
jb 1f; /* die if value < low */ \
|
||||
cmpq 16+BP_MEM, VAL_REG; \
|
||||
jb 0f; /* continue if value < high */ \
|
||||
1: BOUNDS_VIOLATED; \
|
||||
0:
|
||||
|
||||
# define CHECK_BOUNDS_BOTH_WIDE(VAL_REG, BP_MEM, LENGTH) \
|
||||
CHECK_BOUNDS_LOW(VAL_REG, BP_MEM); \
|
||||
addl LENGTH, VAL_REG; \
|
||||
cmpq 16+BP_MEM, VAL_REG; \
|
||||
jbe 0f; /* continue if value <= high */ \
|
||||
BOUNDS_VIOLATED; \
|
||||
0: subq LENGTH, VAL_REG /* restore value */
|
||||
|
||||
/* Take bounds from BP_MEM and affix them to the pointer
|
||||
value in %rax, stuffing all into memory at RTN(%esp).
|
||||
Use %rdx as a scratch register. */
|
||||
|
||||
# define RETURN_BOUNDED_POINTER(BP_MEM) \
|
||||
movq RTN(%rsp), %rdx; \
|
||||
movq %rax, 0(%rdx); \
|
||||
movq 8+BP_MEM, %rax; \
|
||||
movq %rax, 4(%rdx); \
|
||||
movq 16+BP_MEM, %rax; \
|
||||
movq %rax, 8(%rdx)
|
||||
|
||||
# define RETURN_NULL_BOUNDED_POINTER \
|
||||
movl RTN(%rsp), %rdx; \
|
||||
movl %rax, 0(%rdx); \
|
||||
movl %rax, 4(%rdx); \
|
||||
movl %rax, 8(%rdx)
|
||||
|
||||
/* The caller of __errno_location is responsible for allocating space
|
||||
for the three-word BP return-value and passing pushing its address
|
||||
as an implicit first argument. */
|
||||
# define PUSH_ERRNO_LOCATION_RETURN \
|
||||
subl $16, %esp; \
|
||||
subl $8, %esp; \
|
||||
pushq %rsp
|
||||
|
||||
/* __errno_location is responsible for popping the implicit first
|
||||
argument, but we must pop the space for the BP itself. We also
|
||||
dereference the return value in order to dig out the pointer value. */
|
||||
# define POP_ERRNO_LOCATION_RETURN \
|
||||
popq %rax; \
|
||||
addq $16, %rsp
|
||||
|
||||
# else /* !__BOUNDED_POINTERS__ */
|
||||
|
||||
/* Unbounded pointers occupy one word. */
|
||||
# define PTR_SIZE 8
|
||||
/* Unbounded pointer return values are passed back in the register %rax. */
|
||||
# define RTN_SIZE 0
|
||||
/* Use simple return instruction for unbounded pointer values. */
|
||||
# define RET_PTR ret
|
||||
/* Don't maintain frame pointer chain for leaf assembler functions. */
|
||||
# define ENTER
|
||||
# define LEAVE
|
||||
/* Stack space overhead of procedure-call linkage: return address only. */
|
||||
# define LINKAGE 8
|
||||
/* Stack offset of return address after calling ENTER. */
|
||||
# define PCOFF 0
|
||||
|
||||
# define CHECK_BOUNDS_LOW(VAL_REG, BP_MEM)
|
||||
# define CHECK_BOUNDS_HIGH(VAL_REG, BP_MEM, Jcc)
|
||||
# define CHECK_BOUNDS_BOTH(VAL_REG, BP_MEM)
|
||||
# define CHECK_BOUNDS_BOTH_WIDE(VAL_REG, BP_MEM, LENGTH)
|
||||
# define RETURN_BOUNDED_POINTER(BP_MEM)
|
||||
|
||||
# define RETURN_NULL_BOUNDED_POINTER
|
||||
|
||||
# define PUSH_ERRNO_LOCATION_RETURN
|
||||
# define POP_ERRNO_LOCATION_RETURN
|
||||
|
||||
# endif /* !__BOUNDED_POINTERS__ */
|
||||
|
||||
# endif /* __ASSEMBLER__ */
|
||||
|
||||
#endif /* _bp_asm_h_ */
|
39
sysdeps/x86_64/bsd-_setjmp.S
Normal file
39
sysdeps/x86_64/bsd-_setjmp.S
Normal file
@ -0,0 +1,39 @@
|
||||
/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'. x86-64 version.
|
||||
Copyright (C) 1994,1995,1996,1997,2000,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. */
|
||||
|
||||
/* 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>
|
||||
#define _ASM
|
||||
#define _SETJMP_H
|
||||
#include <bits/setjmp.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
|
||||
ENTRY (BP_SYM (_setjmp))
|
||||
/* Set up arguments, we only need to set the second arg. */
|
||||
xorq %rsi, %rsi
|
||||
#ifdef PIC
|
||||
jmp C_SYMBOL_NAME (BP_SYM (__sigsetjmp))@PLT
|
||||
#else
|
||||
jmp BP_SYM (__sigsetjmp)
|
||||
#endif
|
||||
END (BP_SYM (_setjmp))
|
38
sysdeps/x86_64/bsd-setjmp.S
Normal file
38
sysdeps/x86_64/bsd-setjmp.S
Normal file
@ -0,0 +1,38 @@
|
||||
/* BSD `setjmp' entry point to `sigsetjmp (..., 1)'. x86-64 version.
|
||||
Copyright (C) 1994,1995,1996,1997,2000,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. */
|
||||
|
||||
/* 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>
|
||||
#define _ASM
|
||||
#define _SETJMP_H
|
||||
#include <bits/setjmp.h>
|
||||
#include "bp-sym.h"
|
||||
#include "bp-asm.h"
|
||||
|
||||
ENTRY (BP_SYM (setjmp))
|
||||
/* Set up arguments, we only need to set the 2nd arg. */
|
||||
movq $1, %rsi
|
||||
#ifdef PIC
|
||||
#else
|
||||
jmp BP_SYM (__sigsetjmp)
|
||||
#endif
|
||||
END (BP_SYM (setjmp))
|
417
sysdeps/x86_64/dl-machine.h
Normal file
417
sysdeps/x86_64/dl-machine.h
Normal file
@ -0,0 +1,417 @@
|
||||
/* Machine-dependent ELF dynamic relocation inline functions. x86-64 version.
|
||||
Copyright (C) 2001 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 dl_machine_h
|
||||
#define dl_machine_h
|
||||
|
||||
#define ELF_MACHINE_NAME "x86_64"
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
/* Return nonzero iff ELF header is compatible with the running host. */
|
||||
static inline int __attribute__ ((unused))
|
||||
elf_machine_matches_host (const Elf64_Ehdr *ehdr)
|
||||
{
|
||||
return ehdr->e_machine == EM_X86_64;
|
||||
}
|
||||
|
||||
|
||||
/* 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. */
|
||||
static inline Elf64_Addr __attribute__ ((unused))
|
||||
elf_machine_dynamic (void)
|
||||
{
|
||||
register Elf64_Addr addr;
|
||||
|
||||
asm ("leaq _DYNAMIC, %0\n" : "=r" (addr));
|
||||
return addr;
|
||||
}
|
||||
|
||||
|
||||
/* Return the run-time load address of the shared object. */
|
||||
static inline Elf64_Addr __attribute__ ((unused))
|
||||
elf_machine_load_address (void)
|
||||
{
|
||||
register Elf64_Addr addr, tmp;
|
||||
|
||||
asm ("leaq _dl_start, %0\n"
|
||||
"leaq _dl_start(%%rip), %1\n"
|
||||
"subq %0, %1\n"
|
||||
: "=r" (tmp), "=r" (addr) : : "cc");
|
||||
return addr;
|
||||
}
|
||||
|
||||
/* Set up the loaded object described by L so its unrelocated PLT
|
||||
entries will jump to the on-demand fixup code in dl-runtime.c. */
|
||||
|
||||
static inline int __attribute__ ((unused))
|
||||
elf_machine_runtime_setup (struct link_map *l, int lazy, int profile)
|
||||
{
|
||||
Elf64_Addr *got;
|
||||
extern void _dl_runtime_resolve (Elf64_Word);
|
||||
extern void _dl_runtime_profile (Elf64_Word);
|
||||
|
||||
if (l->l_info[DT_JMPREL] && lazy)
|
||||
{
|
||||
/* The GOT entries for functions in the PLT have not yet been filled
|
||||
in. Their initial contents will arrange when called to push an
|
||||
offset into the .rel.plt section, push _GLOBAL_OFFSET_TABLE_[1],
|
||||
and then jump to _GLOBAL_OFFSET_TABLE[2]. */
|
||||
got = (Elf64_Addr *) D_PTR (l, l_info[DT_PLTGOT]);
|
||||
got[1] = (Elf64_Addr) l; /* Identify this shared object. */
|
||||
|
||||
/* The got[2] entry contains the address of a function which gets
|
||||
called to get the address of a so far unresolved function and
|
||||
jump to it. The profiling extension of the dynamic linker allows
|
||||
to intercept the calls to collect information. In this case we
|
||||
don't store the address in the GOT so that all future calls also
|
||||
end in this function. */
|
||||
if (__builtin_expect (profile, 0))
|
||||
{
|
||||
got[2] = (Elf64_Addr) &_dl_runtime_profile;
|
||||
|
||||
if (_dl_name_match_p (_dl_profile, l))
|
||||
/* This is the object we are looking for. Say that we really
|
||||
want profiling and the timers are started. */
|
||||
_dl_profile_map = l;
|
||||
}
|
||||
else
|
||||
/* This function will get called to fix up the GOT entry indicated by
|
||||
the offset on the stack, and then jump to the resolved address. */
|
||||
got[2] = (Elf64_Addr) &_dl_runtime_resolve;
|
||||
}
|
||||
|
||||
return lazy;
|
||||
}
|
||||
|
||||
/* This code is used in dl-runtime.c to call the `fixup' function
|
||||
and then redirect to the address it returns. */
|
||||
#ifndef PROF
|
||||
# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\
|
||||
.text\n\
|
||||
.globl _dl_runtime_resolve\n\
|
||||
.type _dl_runtime_resolve, @function\n\
|
||||
.align 16\n\
|
||||
_dl_runtime_resolve:\n\
|
||||
pushq %rax # Preserve registers otherwise clobbered.\n\
|
||||
pushq %rcx\n\
|
||||
pushq %rdx\n\
|
||||
pushq %rsi\n\
|
||||
pushq %rdi\n\
|
||||
pushq %r8\n\
|
||||
pushq %r9\n\
|
||||
movq 64(%rsp), %rsi # Copy args pushed by PLT in register.\n\
|
||||
movq %rsi,%r11 # Multiply by 24\n\
|
||||
addq %r11,%rsi\n\
|
||||
addq %r11,%rsi\n\
|
||||
shlq $3, %rsi\n\
|
||||
movq 56(%rsp), %rdi # %rdi: link_map, %rsi: reloc_offset\n\
|
||||
call fixup # Call resolver.\n\
|
||||
movq %rax, %r11 # Save return value\n\
|
||||
popq %r9 # Get register content back.\n\
|
||||
popq %r8\n\
|
||||
popq %rdi\n\
|
||||
popq %rsi\n\
|
||||
popq %rdx\n\
|
||||
popq %rcx\n\
|
||||
popq %rax\n\
|
||||
addq $16,%rsp # Adjust stack\n\
|
||||
jmp *%r11 # Jump to function address.\n\
|
||||
.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
|
||||
\n\
|
||||
.globl _dl_runtime_profile\n\
|
||||
.type _dl_runtime_profile, @function\n\
|
||||
.align 16\n\
|
||||
_dl_runtime_profile:\n\
|
||||
pushq %rax # Preserve registers otherwise clobbered.\n\
|
||||
pushq %rcx\n\
|
||||
pushq %rdx\n\
|
||||
pushq %rsi\n\
|
||||
pushq %rdi\n\
|
||||
pushq %r8\n\
|
||||
pushq %r9\n\
|
||||
movq 72(%rsp), %rdx # Load return address if needed\n\
|
||||
movq 64(%rsp), %rsi # Copy args pushed by PLT in register.\n\
|
||||
movq %rsi,%r11 # Multiply by 24\n\
|
||||
addq %r11,%rsi\n\
|
||||
addq %r11,%rsi\n\
|
||||
shlq $3, %rsi\n\
|
||||
movq 56(%rsp), %rdi # %rdi: link_map, %rsi: reloc_offset\n\
|
||||
call profile_fixup # Call resolver.\n\
|
||||
movq %rax, %r11 # Save return value\n\
|
||||
popq %r9 # Get register content back.\n\
|
||||
popq %r8\n\
|
||||
popq %rdi\n\
|
||||
popq %rsi\n\
|
||||
popq %rdx\n\
|
||||
popq %rcx\n\
|
||||
popq %rax\n\
|
||||
addq $16,%rsp # Adjust stack\n\
|
||||
jmp *%r11 # Jump to function address.\n\
|
||||
.size _dl_runtime_profile, .-_dl_runtime_profile\n\
|
||||
.previous\n\
|
||||
");
|
||||
#else
|
||||
# define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\
|
||||
.text\n\
|
||||
.globl _dl_runtime_resolve\n\
|
||||
.globl _dl_runtime_profile\n\
|
||||
.type _dl_runtime_resolve, @function\n\
|
||||
.type _dl_runtime_profile, @function\n\
|
||||
.align 16\n\
|
||||
_dl_runtime_resolve:\n\
|
||||
_dl_runtime_profile:\n\
|
||||
pushq %rax # Preserve registers otherwise clobbered.\n\
|
||||
pushq %rcx\n\
|
||||
pushq %rdx\n\
|
||||
pushq %rsi\n\
|
||||
pushq %rdi\n\
|
||||
pushq %r8\n\
|
||||
pushq %r9\n\
|
||||
movq 64(%rsp), %rsi # Copy args pushed by PLT in register.\n\
|
||||
movq %rsi,%r11 # Multiply by 24\n\
|
||||
addq %r11,%rsi\n\
|
||||
addq %r11,%rsi\n\
|
||||
shlq $3, %rsi\n\
|
||||
movq 56(%rsp), %rdi # %rdi: link_map, %rsi: reloc_offset\n\
|
||||
call fixup # Call resolver.\n\
|
||||
movq %rax, %r11 # Save return value\n\
|
||||
popq %r9 # Get register content back.\n\
|
||||
popq %r8\n\
|
||||
popq %rdi\n\
|
||||
popq %rsi\n\
|
||||
popq %rdx\n\
|
||||
popq %rcx\n\
|
||||
popq %rax\n\
|
||||
addq $16,%rsp # Adjust stack\n\
|
||||
jmp *%r11 # Jump to function address.\n\
|
||||
.size _dl_runtime_resolve, .-_dl_runtime_resolve\n\
|
||||
.size _dl_runtime_profile, .-_dl_runtime_profile\n\
|
||||
.previous\n\
|
||||
");
|
||||
#endif
|
||||
|
||||
/* 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. */
|
||||
#define RTLD_START asm ("\n\
|
||||
.text\n\
|
||||
.align 16\n\
|
||||
.globl _start\n\
|
||||
.globl _dl_start_user\n\
|
||||
_start:\n\
|
||||
movq %rsp, %rdi\n\
|
||||
call _dl_start\n\
|
||||
_dl_start_user:\n\
|
||||
# Save the user entry point address in %r12.\n\
|
||||
movq %rax, %r12\n\
|
||||
# Store the highest stack address\n\
|
||||
movq __libc_stack_end@GOTPCREL(%rip), %rax\n\
|
||||
movq %rsp, (%rax)\n\
|
||||
# See if we were run as a command with the executable file\n\
|
||||
# name as an extra leading argument.\n\
|
||||
movq _dl_skip_args@GOTPCREL(%rip), %rax\n\
|
||||
movl (%rax), %eax\n\
|
||||
# Pop the original argument count.\n\
|
||||
popq %rdx\n\
|
||||
# Adjust the stack pointer to skip _dl_skip_args words.\n\
|
||||
leaq (%rsp,%rax,8), %rsp\n\
|
||||
# Subtract _dl_skip_args from argc.\n\
|
||||
subl %eax, %edx\n\
|
||||
# Push argc back on the stack.\n\
|
||||
pushq %rdx\n\
|
||||
# Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\
|
||||
# argc -> rsi\n\
|
||||
movq %rdx, %rsi\n\
|
||||
# _dl_loaded -> rdi\n\
|
||||
movq _dl_loaded@GOTPCREL(%rip), %rdi\n\
|
||||
movq (%rdi), %rdi\n\
|
||||
# env -> rcx\n\
|
||||
leaq 16(%rsp,%rdx,8), %rcx\n\
|
||||
# argv -> rdx\n\
|
||||
leaq 8(%rsp), %rdx\n\
|
||||
# Call the function to run the initializers.\n\
|
||||
call _dl_init@PLT\n\
|
||||
# Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\
|
||||
movq _dl_fini@GOTPCREL(%rip), %rdx\n\
|
||||
# Jump to the user's entry point.\n\
|
||||
jmp *%r12\n\
|
||||
.previous\n\
|
||||
");
|
||||
|
||||
/* ELF_RTYPE_CLASS_PLT iff TYPE describes relocation of a PLT entry, so
|
||||
PLT entries should not be allowed to define the value.
|
||||
ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
|
||||
of the main executable's symbols, as for a COPY reloc. */
|
||||
#define elf_machine_type_class(type) \
|
||||
((((type) == R_X86_64_JUMP_SLOT) * ELF_RTYPE_CLASS_PLT) \
|
||||
| (((type) == R_X86_64_COPY) * ELF_RTYPE_CLASS_COPY))
|
||||
|
||||
/* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */
|
||||
#define ELF_MACHINE_JMP_SLOT R_X86_64_JUMP_SLOT
|
||||
|
||||
/* The x86-64 never uses Elf64_Rel relocations. */
|
||||
#define ELF_MACHINE_NO_REL 1
|
||||
|
||||
/* We define an initialization functions. This is called very early in
|
||||
_dl_sysdep_start. */
|
||||
#define DL_PLATFORM_INIT dl_platform_init ()
|
||||
|
||||
extern const char *_dl_platform;
|
||||
|
||||
static inline void __attribute__ ((unused))
|
||||
dl_platform_init (void)
|
||||
{
|
||||
if (_dl_platform != NULL && *_dl_platform == '\0')
|
||||
/* Avoid an empty string which would disturb us. */
|
||||
_dl_platform = NULL;
|
||||
}
|
||||
|
||||
static inline Elf64_Addr
|
||||
elf_machine_fixup_plt (struct link_map *map, lookup_t t,
|
||||
const Elf64_Rela *reloc,
|
||||
Elf64_Addr *reloc_addr, Elf64_Addr value)
|
||||
{
|
||||
return *reloc_addr = value;
|
||||
}
|
||||
|
||||
/* Return the final value of a plt relocation. On x86-64 the
|
||||
JUMP_SLOT relocation ignores the addend. */
|
||||
static inline Elf64_Addr
|
||||
elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc,
|
||||
Elf64_Addr value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
#endif /* !dl_machine_h */
|
||||
|
||||
#ifdef RESOLVE
|
||||
|
||||
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
|
||||
MAP is the object containing the reloc. */
|
||||
|
||||
static inline void
|
||||
elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc,
|
||||
const Elf64_Sym *sym, const struct r_found_version *version,
|
||||
Elf64_Addr *const reloc_addr)
|
||||
{
|
||||
const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info);
|
||||
|
||||
#if !defined RTLD_BOOTSTRAP || !defined HAVE_Z_COMBRELOC
|
||||
if (__builtin_expect (r_type == R_X86_64_RELATIVE, 0))
|
||||
{
|
||||
# if !defined RTLD_BOOTSTRAP && !defined HAVE_Z_COMBRELOC
|
||||
/* 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 (_dl_rtld_map);
|
||||
if (map != &_dl_rtld_map) /* Already done in rtld itself. */
|
||||
# endif
|
||||
*reloc_addr = map->l_addr + reloc->r_addend;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (__builtin_expect (r_type == R_X86_64_NONE, 0))
|
||||
return;
|
||||
else
|
||||
{
|
||||
#ifndef RTLD_BOOTSTRAP
|
||||
const Elf64_Sym *const refsym = sym;
|
||||
#endif
|
||||
Elf64_Addr value = RESOLVE (&sym, version, r_type);
|
||||
if (sym)
|
||||
value += sym->st_value;
|
||||
|
||||
#ifdef RTLD_BOOTSTRAP
|
||||
assert (r_type == R_X86_64_GLOB_DAT || r_type == R_X86_64_JUMP_SLOT);
|
||||
*reloc_addr = value + reloc->r_addend;
|
||||
#else
|
||||
switch (r_type)
|
||||
{
|
||||
case R_X86_64_GLOB_DAT:
|
||||
case R_X86_64_JUMP_SLOT:
|
||||
*reloc_addr = value + reloc->r_addend;
|
||||
break;
|
||||
case R_X86_64_64:
|
||||
*reloc_addr = value + reloc->r_addend;
|
||||
break;
|
||||
case R_X86_64_32:
|
||||
*(unsigned int *) reloc_addr = value + reloc->r_addend;
|
||||
break;
|
||||
case R_X86_64_PC32:
|
||||
*(unsigned int *) reloc_addr = value + reloc->r_addend
|
||||
- (Elf64_Addr) reloc_addr;
|
||||
break;
|
||||
case R_X86_64_COPY:
|
||||
if (sym == NULL)
|
||||
/* This can happen in trace mode if an object could not be
|
||||
found. */
|
||||
break;
|
||||
if (__builtin_expect (sym->st_size > refsym->st_size, 0)
|
||||
|| (__builtin_expect (sym->st_size < refsym->st_size, 0)
|
||||
&& _dl_verbose))
|
||||
{
|
||||
const char *strtab;
|
||||
|
||||
strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
|
||||
_dl_error_printf ("\
|
||||
%s: Symbol `%s' has different size in shared object, consider re-linking\n",
|
||||
_dl_argv[0] ?: "<program name unknown>",
|
||||
strtab + refsym->st_name);
|
||||
}
|
||||
memcpy (reloc_addr, (void *) value, MIN (sym->st_size,
|
||||
refsym->st_size));
|
||||
break;
|
||||
default:
|
||||
_dl_reloc_bad_type (map, r_type, 0);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc,
|
||||
Elf64_Addr *const reloc_addr)
|
||||
{
|
||||
assert (ELF64_R_TYPE (reloc->r_info) == R_X86_64_RELATIVE);
|
||||
*reloc_addr = l_addr + reloc->r_addend;
|
||||
}
|
||||
|
||||
static inline void
|
||||
elf_machine_lazy_rel (struct link_map *map,
|
||||
Elf64_Addr l_addr, const Elf64_Rela *reloc)
|
||||
{
|
||||
Elf64_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
|
||||
const unsigned long int r_type = ELF64_R_TYPE (reloc->r_info);
|
||||
|
||||
/* Check for unexpected PLT reloc type. */
|
||||
if (__builtin_expect (r_type == R_X86_64_JUMP_SLOT, 1))
|
||||
*reloc_addr += l_addr;
|
||||
else
|
||||
_dl_reloc_bad_type (map, r_type, 1);
|
||||
}
|
||||
|
||||
#endif /* RESOLVE */
|
100
sysdeps/x86_64/elf/initfini.c
Normal file
100
sysdeps/x86_64/elf/initfini.c
Normal file
@ -0,0 +1,100 @@
|
||||
/* Special .init and .fini section support for x86-64.
|
||||
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.
|
||||
|
||||
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.)
|
||||
|
||||
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 file is compiled into assembly code which is then munged by a sed
|
||||
script into two files: crti.s and crtn.s.
|
||||
|
||||
* crti.s puts a function prologue at the beginning of the
|
||||
.init and .fini sections and defines global symbols for
|
||||
those addresses, so they can be called as functions.
|
||||
|
||||
* crtn.s puts the corresponding function epilogues
|
||||
in the .init and .fini sections. */
|
||||
|
||||
__asm__ ("\n\
|
||||
#include \"defs.h\"\n\
|
||||
\n\
|
||||
/*@HEADER_ENDS*/\n\
|
||||
\n\
|
||||
/*@_init_PROLOG_BEGINS*/\n\
|
||||
.align 4\n\
|
||||
.type call_gmon_start,@function\n\
|
||||
call_gmon_start:\n\
|
||||
subq $8, %rsp\n\
|
||||
movq __gmon_start__@GOTPCREL(%rip), %rax\n\
|
||||
testq %rax, %rax\n\
|
||||
je .L22\n\
|
||||
call *%rax\n\
|
||||
.L22:\n\
|
||||
addq $8, %rsp\n\
|
||||
ret\n\
|
||||
\n\
|
||||
.section .init\n\
|
||||
.align 4\n\
|
||||
.globl _init\n\
|
||||
.type _init,@function\n\
|
||||
_init:\n\
|
||||
subq $8, %rsp\n\
|
||||
/* call call_gmon_start */\n\
|
||||
ALIGN\n\
|
||||
END_INIT\n\
|
||||
\n\
|
||||
/*@_init_PROLOG_ENDS*/\n\
|
||||
\n\
|
||||
/*@_init_EPILOG_BEGINS*/\n\
|
||||
.section .init\n\
|
||||
addq $8, %rsp\n\
|
||||
ret\n\
|
||||
END_INIT\n\
|
||||
\n\
|
||||
/*@_init_EPILOG_ENDS*/\n\
|
||||
\n\
|
||||
/*@_fini_PROLOG_BEGINS*/\n\
|
||||
.section .fini\n\
|
||||
.align 4\n\
|
||||
.globl _fini\n\
|
||||
.type _fini,@function\n\
|
||||
_fini:\n\
|
||||
subq $8, %rsp\n\
|
||||
ALIGN\n\
|
||||
END_FINI\n\
|
||||
\n\
|
||||
/*@_fini_PROLOG_ENDS*/\n\
|
||||
call i_am_not_a_leaf@PLT\n\
|
||||
\n\
|
||||
/*@_fini_EPILOG_BEGINS*/\n\
|
||||
.section .fini\n\
|
||||
addq $8, %rsp\n\
|
||||
ret\n\
|
||||
END_FINI\n\
|
||||
\n\
|
||||
/*@_fini_EPILOG_ENDS*/\n\
|
||||
\n\
|
||||
/*@TRAILER_BEGINS*/\n\
|
||||
.weak __gmon_start__\n\
|
||||
");
|
95
sysdeps/x86_64/elf/start.S
Normal file
95
sysdeps/x86_64/elf/start.S
Normal file
@ -0,0 +1,95 @@
|
||||
/* Startup code compliant to the ELF x86-64 ABI.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Andreas Jaeger <aj@suse.de>, 2001.
|
||||
|
||||
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 is the canonical entry point, usually the first thing in the text
|
||||
segment. The SVR4/i386 ABI (pages 3-31, 3-32) says that when the entry
|
||||
point runs, most registers' values are unspecified, except for:
|
||||
|
||||
%rdx 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.
|
||||
|
||||
%rsp The stack contains the arguments and environment:
|
||||
0(%rsp) argc
|
||||
8(%rsp) argv[0]
|
||||
...
|
||||
(8*argc)(%rsp) NULL
|
||||
(8*(argc+1))(%rsp) envp[0]
|
||||
...
|
||||
NULL
|
||||
*/
|
||||
|
||||
#include "bp-sym.h"
|
||||
|
||||
.text
|
||||
.globl _start
|
||||
.type _start,@function
|
||||
_start:
|
||||
/* Clear the frame pointer. The ABI suggests this be done, to mark
|
||||
the outermost frame obviously. */
|
||||
xorq %rbp, %rbp
|
||||
|
||||
/* Extract the arguments as encoded on the stack and set up
|
||||
the arguments for __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).
|
||||
The arguments are passed via registers and on the stack:
|
||||
main: %rdi
|
||||
argc: %rsi
|
||||
argv: %rdx
|
||||
init: %rcx
|
||||
fini: %r8
|
||||
rtld_fini: %r9
|
||||
stack_end: stack. */
|
||||
|
||||
movq %rdx, %r9 /* Address of the shared library termination
|
||||
function. */
|
||||
popq %rsi /* Pop the argument count. */
|
||||
movq %rsp, %rdx /* argv starts just at the current stack top. */
|
||||
/* Align the stack to a 16 byte boundary to follow the ABI. */
|
||||
andq $~15, %rsp
|
||||
|
||||
pushq %rax /* Push garbage because we push 8 more bytes. */
|
||||
|
||||
/* Provide the highest stack address to the user code (for stacks
|
||||
which grow downwards). */
|
||||
pushq %rsp
|
||||
|
||||
/* Pass address of our own entry points to .fini and .init. */
|
||||
movq $_fini, %r8
|
||||
movq $_init, %rcx
|
||||
|
||||
movq $BP_SYM (main), %rdi
|
||||
|
||||
/* Call the user's main function, and exit with its value.
|
||||
But let the libc call main. */
|
||||
call BP_SYM (__libc_start_main)
|
||||
|
||||
hlt /* Crash if somehow `exit' 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
|
38
sysdeps/x86_64/ffs.c
Normal file
38
sysdeps/x86_64/ffs.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* ffs -- find first set bit in a word, counted from least significant end.
|
||||
For AMD x86-64.
|
||||
This file is part of the GNU C Library.
|
||||
Copyright (C) 1991,92,93,94,97,98,2001 Free Software Foundation, Inc.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>.
|
||||
|
||||
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 <string.h>
|
||||
|
||||
#undef ffs
|
||||
|
||||
int
|
||||
__ffs (int x)
|
||||
{
|
||||
int cnt;
|
||||
int tmp;
|
||||
|
||||
asm ("bsfl %2,%0\n" /* Count low bits in X and store in %1. */
|
||||
"cmovel %1,%0\n" /* If number was zero, use -1 as result. */
|
||||
: "=&r" (cnt), "=r" (tmp) : "rm" (x), "1" (-1));
|
||||
|
||||
return cnt + 1;
|
||||
}
|
||||
weak_alias (__ffs, ffs)
|
41
sysdeps/x86_64/ffsll.c
Normal file
41
sysdeps/x86_64/ffsll.c
Normal file
@ -0,0 +1,41 @@
|
||||
/* ffsll -- find first set bit in a word, counted from least significant end.
|
||||
For AMD x86-64.
|
||||
This file is part of the GNU C Library.
|
||||
Copyright (C) 1991,92,93,94,97,98,2001 Free Software Foundation, Inc.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>.
|
||||
|
||||
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 ffsl __something_else
|
||||
#include <string.h>
|
||||
|
||||
#undef ffsll
|
||||
|
||||
int
|
||||
ffsll (long long int x)
|
||||
{
|
||||
long long int cnt;
|
||||
long long int tmp;
|
||||
|
||||
asm ("bsfq %2,%0\n" /* Count low bits in X and store in %1. */
|
||||
"cmoveq %1,%0\n" /* If number was zero, use -1 as result. */
|
||||
: "=&r" (cnt), "=r" (tmp) : "rm" (x), "1" (-1));
|
||||
|
||||
return cnt + 1;
|
||||
}
|
||||
|
||||
#undef ffsl
|
||||
weak_alias (ffsll, ffsl)
|
93
sysdeps/x86_64/fpu/bits/fenv.h
Normal file
93
sysdeps/x86_64/fpu/bits/fenv.h
Normal file
@ -0,0 +1,93 @@
|
||||
/* Copyright (C) 1997,1998,1999,2000,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. */
|
||||
|
||||
#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_INVALID = 0x01,
|
||||
#define FE_INVALID FE_INVALID
|
||||
__FE_DENORM = 0x02,
|
||||
FE_DIVBYZERO = 0x04,
|
||||
#define FE_DIVBYZERO FE_DIVBYZERO
|
||||
FE_OVERFLOW = 0x08,
|
||||
#define FE_OVERFLOW FE_OVERFLOW
|
||||
FE_UNDERFLOW = 0x10,
|
||||
#define FE_UNDERFLOW FE_UNDERFLOW
|
||||
FE_INEXACT = 0x20
|
||||
#define FE_INEXACT FE_INEXACT
|
||||
};
|
||||
|
||||
#define FE_ALL_EXCEPT \
|
||||
(FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
|
||||
|
||||
/* The ix87 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 = 0,
|
||||
#define FE_TONEAREST FE_TONEAREST
|
||||
FE_DOWNWARD = 0x400,
|
||||
#define FE_DOWNWARD FE_DOWNWARD
|
||||
FE_UPWARD = 0x800,
|
||||
#define FE_UPWARD FE_UPWARD
|
||||
FE_TOWARDZERO = 0xc00
|
||||
#define FE_TOWARDZERO FE_TOWARDZERO
|
||||
};
|
||||
|
||||
|
||||
/* Type representing exception flags. */
|
||||
typedef unsigned short int fexcept_t;
|
||||
|
||||
|
||||
/* Type representing floating-point environment. This structure
|
||||
corresponds to the layout of the block written by the `fstenv'
|
||||
instruction and has additional fields for the contents of the MXCSR
|
||||
register as written by the `stmxcsr' instruction. */
|
||||
typedef struct
|
||||
{
|
||||
unsigned short int __control_word;
|
||||
unsigned short int __unused1;
|
||||
unsigned short int __status_word;
|
||||
unsigned short int __unused2;
|
||||
unsigned short int __tags;
|
||||
unsigned short int __unused3;
|
||||
unsigned int __eip;
|
||||
unsigned short int __cs_selector;
|
||||
unsigned int __opcode:11;
|
||||
unsigned int __unused4:5;
|
||||
unsigned int __data_offset;
|
||||
unsigned short int __data_selector;
|
||||
unsigned short int __unused5;
|
||||
unsigned int __mxcsr;
|
||||
}
|
||||
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
|
39
sysdeps/x86_64/fpu/bits/mathdef.h
Normal file
39
sysdeps/x86_64/fpu/bits/mathdef.h
Normal file
@ -0,0 +1,39 @@
|
||||
/* 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. */
|
||||
|
||||
#if !defined _MATH_H && !defined _COMPLEX_H
|
||||
# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
|
||||
#endif
|
||||
|
||||
#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
|
||||
# define _MATH_H_MATHDEF 1
|
||||
|
||||
/* The x86-64 architecture computes values with the precission of the
|
||||
used type. */
|
||||
typedef float float_t; /* `float' expressions are evaluated as `float'. */
|
||||
typedef double double_t; /* `double' expressions are evaluated
|
||||
as `double'. */
|
||||
|
||||
/* Define `INFINITY' as value of type `float'. */
|
||||
# define INFINITY HUGE_VALF
|
||||
|
||||
/* The values returned by `ilogb' for 0 and NaN respectively. */
|
||||
# define FP_ILOGB0 (-2147483647 - 1)
|
||||
# define FP_ILOGBNAN (-2147483647 - 1)
|
||||
|
||||
#endif /* ISO C99 */
|
1
sysdeps/x86_64/fpu/e_acosl.c
Normal file
1
sysdeps/x86_64/fpu/e_acosl.c
Normal file
@ -0,0 +1 @@
|
||||
#include "sysdeps/i386/fpu/e_acosl.c"
|
2
sysdeps/x86_64/fpu/e_atan2l.c
Normal file
2
sysdeps/x86_64/fpu/e_atan2l.c
Normal file
@ -0,0 +1,2 @@
|
||||
#include "sysdeps/i386/fpu/e_atan2l.c"
|
||||
|
38
sysdeps/x86_64/fpu/e_exp2l.S
Normal file
38
sysdeps/x86_64/fpu/e_exp2l.S
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Adapted for exp2 by Ulrich Drepper <drepper@cygnus.com>.
|
||||
* Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(__ieee754_exp2l)
|
||||
fldt 8(%rsp)
|
||||
/* I added the following ugly construct because exp(+-Inf) resulted
|
||||
in NaN. The ugliness results from the bright minds at Intel.
|
||||
For the i686 the code can be written better.
|
||||
-- drepper@cygnus.com. */
|
||||
fxam /* Is NaN or +-Inf? */
|
||||
fstsw %ax
|
||||
movb $0x45, %dh
|
||||
andb %ah, %dh
|
||||
cmpb $0x05, %dh
|
||||
je 1f /* Is +-Inf, jump. */
|
||||
fld %st
|
||||
frndint /* int(x) */
|
||||
fsubr %st,%st(1) /* fract(x) */
|
||||
fxch
|
||||
f2xm1 /* 2^(fract(x)) - 1 */
|
||||
fld1
|
||||
faddp /* 2^(fract(x)) */
|
||||
fscale /* e^x */
|
||||
fstp %st(1)
|
||||
ret
|
||||
|
||||
1: testl $0x200, %eax /* Test sign. */
|
||||
jz 2f /* If positive, jump. */
|
||||
fstp %st
|
||||
fldz /* Set result to 0. */
|
||||
2: ret
|
||||
END (__ieee754_exp2l)
|
1
sysdeps/x86_64/fpu/e_expl.c
Normal file
1
sysdeps/x86_64/fpu/e_expl.c
Normal file
@ -0,0 +1 @@
|
||||
#include "sysdeps/i386/fpu/e_expl.c"
|
22
sysdeps/x86_64/fpu/e_fmodl.S
Normal file
22
sysdeps/x86_64/fpu/e_fmodl.S
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*
|
||||
* Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
|
||||
* Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: $")
|
||||
|
||||
ENTRY(__ieee754_fmodl)
|
||||
fldt 24(%rsp)
|
||||
fldt 8(%rsp)
|
||||
1: fprem
|
||||
fstsw %ax
|
||||
and $04,%ah
|
||||
jnz 1b
|
||||
fstp %st(1)
|
||||
ret
|
||||
END (__ieee754_fmodl)
|
66
sysdeps/x86_64/fpu/e_log10l.S
Normal file
66
sysdeps/x86_64/fpu/e_log10l.S
Normal file
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*
|
||||
* Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
|
||||
*
|
||||
* Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
|
||||
* Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: $")
|
||||
|
||||
#ifdef __ELF__
|
||||
.section .rodata
|
||||
#else
|
||||
.text
|
||||
#endif
|
||||
.align ALIGNARG(4)
|
||||
ASM_TYPE_DIRECTIVE(one,@object)
|
||||
one: .double 1.0
|
||||
ASM_SIZE_DIRECTIVE(one)
|
||||
/* It is not important that this constant is precise. It is only
|
||||
a value which is known to be on the safe side for using the
|
||||
fyl2xp1 instruction. */
|
||||
ASM_TYPE_DIRECTIVE(limit,@object)
|
||||
limit: .double 0.29
|
||||
ASM_SIZE_DIRECTIVE(limit)
|
||||
|
||||
|
||||
#ifdef PIC
|
||||
#define MO(op) op##(%rip)
|
||||
#else
|
||||
#define MO(op) op
|
||||
#endif
|
||||
|
||||
.text
|
||||
ENTRY(__ieee754_log10l)
|
||||
fldlg2 // log10(2)
|
||||
fldt 8(%rsp) // x : log10(2)
|
||||
fxam
|
||||
fnstsw
|
||||
fld %st // x : x : log10(2)
|
||||
andb $1,%ah
|
||||
jnz 3f // in case x is NaN or ±Inf
|
||||
4: fsubl MO(one) // x-1 : x : log10(2)
|
||||
fld %st // x-1 : x-1 : x : log10(2)
|
||||
fabs // |x-1| : x-1 : x : log10(2)
|
||||
fcompl MO(limit) // x-1 : x : log10(2)
|
||||
fnstsw // x-1 : x : log10(2)
|
||||
andb $0x45, %ah
|
||||
jz 2f
|
||||
fstp %st(1) // x-1 : log10(2)
|
||||
fyl2xp1 // log10(x)
|
||||
ret
|
||||
|
||||
2: fstp %st(0) // x : log10(2)
|
||||
fyl2x // log10(x)
|
||||
ret
|
||||
|
||||
3: jp 4b // in case x is ±Inf
|
||||
fstp %st(1)
|
||||
fstp %st(1)
|
||||
ret
|
||||
END(__ieee754_log10l)
|
63
sysdeps/x86_64/fpu/e_log2l.S
Normal file
63
sysdeps/x86_64/fpu/e_log2l.S
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Adapted for use as log2 by Ulrich Drepper <drepper@cygnus.com>.
|
||||
* Public domain.
|
||||
*
|
||||
* Changed to use fyl2xp1 for values near 1, <drepper@cygnus.com>.
|
||||
* Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
#ifdef __ELF__
|
||||
.section .rodata
|
||||
#else
|
||||
.text
|
||||
#endif
|
||||
.align ALIGNARG(4)
|
||||
ASM_TYPE_DIRECTIVE(one,@object)
|
||||
one: .double 1.0
|
||||
ASM_SIZE_DIRECTIVE(one)
|
||||
/* It is not important that this constant is precise. It is only
|
||||
a value which is known to be on the safe side for using the
|
||||
fyl2xp1 instruction. */
|
||||
ASM_TYPE_DIRECTIVE(limit,@object)
|
||||
limit: .double 0.29
|
||||
ASM_SIZE_DIRECTIVE(limit)
|
||||
|
||||
|
||||
#ifdef PIC
|
||||
#define MO(op) op##(%rip)
|
||||
#else
|
||||
#define MO(op) op
|
||||
#endif
|
||||
|
||||
.text
|
||||
ENTRY(__ieee754_log2l)
|
||||
fldl MO(one)
|
||||
fldt 8(%rsp) // x : 1
|
||||
fxam
|
||||
fnstsw
|
||||
fld %st // x : x : 1
|
||||
andb $1,%ah
|
||||
jnz 3f // in case x is NaN or ±Inf
|
||||
4: fsub %st(2), %st // x-1 : x : 1
|
||||
fld %st // x-1 : x-1 : x : 1
|
||||
fabs // |x-1| : x-1 : x : 1
|
||||
fcompl MO(limit) // x-1 : x : 1
|
||||
fnstsw // x-1 : x : 1
|
||||
andb $0x45, %ah
|
||||
jz 2f
|
||||
fstp %st(1) // x-1 : 1
|
||||
fyl2xp1 // log(x)
|
||||
ret
|
||||
|
||||
2: fstp %st(0) // x : 1
|
||||
fyl2x // log(x)
|
||||
ret
|
||||
|
||||
3: jp 4b // in case x is ±Inf
|
||||
fstp %st(1)
|
||||
fstp %st(1)
|
||||
ret
|
||||
END (__ieee754_log2l)
|
56
sysdeps/x86_64/fpu/e_logl.S
Normal file
56
sysdeps/x86_64/fpu/e_logl.S
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*
|
||||
* Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
|
||||
* Adapted for x86-64 by Andreas Jaeger <aj@suse.de>.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: $")
|
||||
|
||||
|
||||
#ifdef __ELF__
|
||||
.section .rodata
|
||||
#else
|
||||
.text
|
||||
#endif
|
||||
.align ALIGNARG(4)
|
||||
ASM_TYPE_DIRECTIVE(one,@object)
|
||||
one: .double 1.0
|
||||
ASM_SIZE_DIRECTIVE(one)
|
||||
/* It is not important that this constant is precise. It is only
|
||||
a value which is known to be on the safe side for using the
|
||||
fyl2xp1 instruction. */
|
||||
ASM_TYPE_DIRECTIVE(limit,@object)
|
||||
limit: .double 0.29
|
||||
ASM_SIZE_DIRECTIVE(limit)
|
||||
|
||||
|
||||
#ifdef PIC
|
||||
#define MO(op) op##(%rip)
|
||||
#else
|
||||
#define MO(op) op
|
||||
#endif
|
||||
|
||||
.text
|
||||
ENTRY(__ieee754_logl)
|
||||
fldln2 // log(2)
|
||||
fldt 8(%rsp) // x : log(2)
|
||||
fld %st // x : x : log(2)
|
||||
fsubl MO(one) // x-1 : x : log(2)
|
||||
fld %st // x-1 : x-1 : x : log(2)
|
||||
fabs // |x-1| : x-1 : x : log(2)
|
||||
fcompl MO(limit) // x-1 : x : log(2)
|
||||
fnstsw // x-1 : x : log(2)
|
||||
andb $0x45, %ah
|
||||
jz 2f
|
||||
fstp %st(1) // x-1 : log(2)
|
||||
fyl2xp1 // log(x)
|
||||
ret
|
||||
|
||||
2: fstp %st(0) // x : log(2)
|
||||
fyl2x // log(x)
|
||||
ret
|
||||
END (__ieee754_logl)
|
316
sysdeps/x86_64/fpu/e_powl.S
Normal file
316
sysdeps/x86_64/fpu/e_powl.S
Normal file
@ -0,0 +1,316 @@
|
||||
/* ix87 specific implementation of pow function.
|
||||
Copyright (C) 1996, 1997, 1998, 1999, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
||||
|
||||
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 <machine/asm.h>
|
||||
|
||||
#ifdef __ELF__
|
||||
.section .rodata
|
||||
#else
|
||||
.text
|
||||
#endif
|
||||
|
||||
.align ALIGNARG(4)
|
||||
ASM_TYPE_DIRECTIVE(infinity,@object)
|
||||
inf_zero:
|
||||
infinity:
|
||||
.byte 0, 0, 0, 0, 0, 0, 0xf0, 0x7f
|
||||
ASM_SIZE_DIRECTIVE(infinity)
|
||||
ASM_TYPE_DIRECTIVE(zero,@object)
|
||||
zero: .double 0.0
|
||||
ASM_SIZE_DIRECTIVE(zero)
|
||||
ASM_TYPE_DIRECTIVE(minf_mzero,@object)
|
||||
minf_mzero:
|
||||
minfinity:
|
||||
.byte 0, 0, 0, 0, 0, 0, 0xf0, 0xff
|
||||
mzero:
|
||||
.byte 0, 0, 0, 0, 0, 0, 0, 0x80
|
||||
ASM_SIZE_DIRECTIVE(minf_mzero)
|
||||
ASM_TYPE_DIRECTIVE(one,@object)
|
||||
one: .double 1.0
|
||||
ASM_SIZE_DIRECTIVE(one)
|
||||
ASM_TYPE_DIRECTIVE(limit,@object)
|
||||
limit: .double 0.29
|
||||
ASM_SIZE_DIRECTIVE(limit)
|
||||
|
||||
#ifdef PIC
|
||||
#define MO(op) op##(%rip)
|
||||
#else
|
||||
#define MO(op) op
|
||||
#endif
|
||||
|
||||
.text
|
||||
ENTRY(__ieee754_powl)
|
||||
fldt 24(%rsp) // y
|
||||
fxam
|
||||
|
||||
|
||||
fnstsw
|
||||
movb %ah, %dl
|
||||
andb $0x45, %ah
|
||||
cmpb $0x40, %ah // is y == 0 ?
|
||||
je 11f
|
||||
|
||||
cmpb $0x05, %ah // is y == ±inf ?
|
||||
je 12f
|
||||
|
||||
cmpb $0x01, %ah // is y == NaN ?
|
||||
je 30f
|
||||
|
||||
fldt 8(%rsp) // x : y
|
||||
|
||||
fxam
|
||||
fnstsw
|
||||
movb %ah, %dh
|
||||
andb $0x45, %ah
|
||||
cmpb $0x40, %ah
|
||||
je 20f // x is ±0
|
||||
|
||||
cmpb $0x05, %ah
|
||||
je 15f // x is ±inf
|
||||
|
||||
fxch // y : x
|
||||
|
||||
/* First see whether `y' is a natural number. In this case we
|
||||
can use a more precise algorithm. */
|
||||
fld %st // y : y : x
|
||||
fistpll -8(%rsp) // y : x
|
||||
fildll -8(%rsp) // int(y) : y : x
|
||||
fucomip %st(1),%st // y : x
|
||||
jne 2f
|
||||
|
||||
/* OK, we have an integer value for y. */
|
||||
mov -8(%rsp),%eax
|
||||
mov -4(%rsp),%edx
|
||||
orl $0, %edx
|
||||
fstp %st(0) // x
|
||||
jns 4f // y >= 0, jump
|
||||
fdivrl MO(one) // 1/x (now referred to as x)
|
||||
negl %eax
|
||||
adcl $0, %edx
|
||||
negl %edx
|
||||
4: fldl MO(one) // 1 : x
|
||||
fxch
|
||||
|
||||
6: shrdl $1, %edx, %eax
|
||||
jnc 5f
|
||||
fxch
|
||||
fmul %st(1) // x : ST*x
|
||||
fxch
|
||||
5: fmul %st(0), %st // x*x : ST*x
|
||||
shrl $1, %edx
|
||||
movl %eax, %ecx
|
||||
orl %edx, %ecx
|
||||
jnz 6b
|
||||
fstp %st(0) // ST*x
|
||||
ret
|
||||
|
||||
/* y is ±NAN */
|
||||
30: fldt 8(%rsp) // x : y
|
||||
fldl MO(one) // 1.0 : x : y
|
||||
fucomip %st(1),%st // x : y
|
||||
je 31f
|
||||
fxch // y : x
|
||||
31: fstp %st(1)
|
||||
ret
|
||||
|
||||
.align ALIGNARG(4)
|
||||
2: /* y is a real number. */
|
||||
fxch // x : y
|
||||
fldl MO(one) // 1.0 : x : y
|
||||
fld %st(1) // x : 1.0 : x : y
|
||||
fsub %st(1) // x-1 : 1.0 : x : y
|
||||
fabs // |x-1| : 1.0 : x : y
|
||||
fcompl MO(limit) // 1.0 : x : y
|
||||
fnstsw
|
||||
fxch // x : 1.0 : y
|
||||
test $4500,%eax
|
||||
jz 7f
|
||||
fsub %st(1) // x-1 : 1.0 : y
|
||||
fyl2xp1 // log2(x) : y
|
||||
jmp 8f
|
||||
|
||||
7: fyl2x // log2(x) : y
|
||||
8: fmul %st(1) // y*log2(x) : y
|
||||
fst %st(1) // y*log2(x) : y*log2(x)
|
||||
frndint // int(y*log2(x)) : y*log2(x)
|
||||
fsubr %st, %st(1) // int(y*log2(x)) : fract(y*log2(x))
|
||||
fxch // fract(y*log2(x)) : int(y*log2(x))
|
||||
f2xm1 // 2^fract(y*log2(x))-1 : int(y*log2(x))
|
||||
faddl MO(one) // 2^fract(y*log2(x)) : int(y*log2(x))
|
||||
fscale // 2^fract(y*log2(x))*2^int(y*log2(x)) : int(y*log2(x))
|
||||
fstp %st(1) // 2^fract(y*log2(x))*2^int(y*log2(x))
|
||||
ret
|
||||
|
||||
|
||||
// pow(x,±0) = 1
|
||||
.align ALIGNARG(4)
|
||||
11: fstp %st(0) // pop y
|
||||
fldl MO(one)
|
||||
ret
|
||||
|
||||
// y == ±inf
|
||||
.align ALIGNARG(4)
|
||||
12: fstp %st(0) // pop y
|
||||
fldt 8(%rsp) // x
|
||||
fabs
|
||||
fcompl MO(one) // < 1, == 1, or > 1
|
||||
fnstsw
|
||||
andb $0x45, %ah
|
||||
cmpb $0x45, %ah
|
||||
je 13f // jump if x is NaN
|
||||
|
||||
cmpb $0x40, %ah
|
||||
je 14f // jump if |x| == 1
|
||||
|
||||
shlb $1, %ah
|
||||
xorb %ah, %dl
|
||||
andl $2, %edx
|
||||
#ifdef PIC
|
||||
lea inf_zero(%rip),%rcx
|
||||
fldl (%rcx, %rdx, 4)
|
||||
#else
|
||||
fldl inf_zero(,%rdx, 4)
|
||||
#endif
|
||||
ret
|
||||
|
||||
.align ALIGNARG(4)
|
||||
14: fldl MO(one)
|
||||
ret
|
||||
|
||||
.align ALIGNARG(4)
|
||||
13: fldt 8(%rsp) // load x == NaN
|
||||
ret
|
||||
|
||||
.align ALIGNARG(4)
|
||||
// x is ±inf
|
||||
15: fstp %st(0) // y
|
||||
testb $2, %dh
|
||||
jz 16f // jump if x == +inf
|
||||
|
||||
// We must find out whether y is an odd integer.
|
||||
fld %st // y : y
|
||||
fistpll -8(%rsp) // y
|
||||
fildll -8(%rsp) // int(y) : y
|
||||
fucomip %st(1),%st
|
||||
ffreep %st // <empty>
|
||||
jne 17f
|
||||
|
||||
// OK, the value is an integer, but is it odd?
|
||||
mov -8(%rsp), %eax
|
||||
mov -4(%rsp), %edx
|
||||
andb $1, %al
|
||||
jz 18f // jump if not odd
|
||||
// It's an odd integer.
|
||||
shrl $31, %edx
|
||||
#ifdef PIC
|
||||
lea minf_mzero(%rip),%rcx
|
||||
fldl (%rcx, %rdx, 8)
|
||||
#else
|
||||
fldl minf_mzero(,%rdx, 8)
|
||||
#endif
|
||||
ret
|
||||
|
||||
.align ALIGNARG(4)
|
||||
16: fcompl MO(zero)
|
||||
fnstsw
|
||||
shrl $5, %eax
|
||||
andl $8, %eax
|
||||
#ifdef PIC
|
||||
lea inf_zero(%rip),%rcx
|
||||
fldl (%rcx, %rax, 1)
|
||||
#else
|
||||
fldl inf_zero(,%rax, 1)
|
||||
#endif
|
||||
ret
|
||||
|
||||
.align ALIGNARG(4)
|
||||
17: shll $30, %edx // sign bit for y in right position
|
||||
18: shrl $31, %edx
|
||||
#ifdef PIC
|
||||
lea inf_zero(%rip),%rcx
|
||||
fldl (%rcx, %rdx, 8)
|
||||
#else
|
||||
fldl inf_zero(,%rdx, 8)
|
||||
#endif
|
||||
ret
|
||||
|
||||
.align ALIGNARG(4)
|
||||
// x is ±0
|
||||
20: fstp %st(0) // y
|
||||
testb $2, %dl
|
||||
jz 21f // y > 0
|
||||
|
||||
// x is ±0 and y is < 0. We must find out whether y is an odd integer.
|
||||
testb $2, %dh
|
||||
jz 25f
|
||||
|
||||
fld %st // y : y
|
||||
fistpll -8(%rsp) // y
|
||||
fildll -8(%rsp) // int(y) : y
|
||||
fucomip %st(1),%st
|
||||
ffreep %st // <empty>
|
||||
jne 26f
|
||||
|
||||
// OK, the value is an integer, but is it odd?
|
||||
mov -8(%rsp),%eax
|
||||
mov -4(%rsp),%edx
|
||||
andb $1, %al
|
||||
jz 27f // jump if not odd
|
||||
// It's an odd integer.
|
||||
// Raise divide-by-zero exception and get minus infinity value.
|
||||
fldl MO(one)
|
||||
fdivl MO(zero)
|
||||
fchs
|
||||
ret
|
||||
|
||||
25: fstp %st(0)
|
||||
26:
|
||||
27: // Raise divide-by-zero exception and get infinity value.
|
||||
fldl MO(one)
|
||||
fdivl MO(zero)
|
||||
ret
|
||||
|
||||
.align ALIGNARG(4)
|
||||
// x is ±0 and y is > 0. We must find out whether y is an odd integer.
|
||||
21: testb $2, %dh
|
||||
jz 22f
|
||||
|
||||
fld %st // y : y
|
||||
fistpll -8(%rsp) // y
|
||||
fildll -8(%rsp) // int(y) : y
|
||||
fucomip %st(1),%st
|
||||
ffreep %st // <empty>
|
||||
jne 23f
|
||||
|
||||
// OK, the value is an integer, but is it odd?
|
||||
mov -8(%rsp),%eax
|
||||
mov -4(%rsp),%edx
|
||||
andb $1, %al
|
||||
jz 24f // jump if not odd
|
||||
// It's an odd integer.
|
||||
fldl MO(mzero)
|
||||
ret
|
||||
|
||||
22: fstp %st(0)
|
||||
23:
|
||||
24: fldl MO(zero)
|
||||
ret
|
||||
|
||||
END(__ieee754_powl)
|
3
sysdeps/x86_64/fpu/e_rem_pio2l.c
Normal file
3
sysdeps/x86_64/fpu/e_rem_pio2l.c
Normal file
@ -0,0 +1,3 @@
|
||||
/* Empty. This file is only meant to avoid compiling the file with the
|
||||
same name in the libm-ieee754 directory. The code is not used since
|
||||
there is an assembler version for all users of this file. */
|
100
sysdeps/x86_64/fpu/e_scalbl.S
Normal file
100
sysdeps/x86_64/fpu/e_scalbl.S
Normal file
@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*
|
||||
* Adapted for `long double' by Ulrich Drepper <drepper@cygnus.com>.
|
||||
* Adapted for x86-64 by Andreas Jaeger <aj@suse.de>
|
||||
*
|
||||
* Correct handling of y==-inf <drepper@gnu>
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: $")
|
||||
|
||||
#ifdef __ELF__
|
||||
.section .rodata
|
||||
#else
|
||||
.text
|
||||
#endif
|
||||
|
||||
.align ALIGNARG(4)
|
||||
ASM_TYPE_DIRECTIVE(zero_nan,@object)
|
||||
zero_nan:
|
||||
.double 0.0
|
||||
nan: .byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
|
||||
minus_zero:
|
||||
.byte 0, 0, 0, 0, 0, 0, 0, 0x80
|
||||
.byte 0, 0, 0, 0, 0, 0, 0xff, 0x7f
|
||||
ASM_SIZE_DIRECTIVE(zero_nan)
|
||||
|
||||
|
||||
#ifdef PIC
|
||||
#define MO(op) op##(%rip)
|
||||
#else
|
||||
#define MO(op) op
|
||||
#endif
|
||||
|
||||
.text
|
||||
ENTRY(__ieee754_scalbl)
|
||||
fldt 24(%rsp)
|
||||
fxam
|
||||
fnstsw
|
||||
fldt 8(%rsp)
|
||||
andl $0x4700, %eax
|
||||
cmpl $0x0700, %eax
|
||||
je 1f
|
||||
andl $0x4500, %eax
|
||||
cmpl $0x0100, %eax
|
||||
je 2f
|
||||
fxam
|
||||
fnstsw
|
||||
andl $0x4500, %eax
|
||||
cmpl $0x0100, %eax
|
||||
je 3f
|
||||
fld %st(1)
|
||||
frndint
|
||||
fcomip %st(2), %st
|
||||
jne 4f
|
||||
fscale
|
||||
fstp %st(1)
|
||||
ret
|
||||
|
||||
/* y is -inf */
|
||||
1: fxam
|
||||
fnstsw
|
||||
movl 16(%rsp), %edx
|
||||
shrl $5, %eax
|
||||
fstp %st
|
||||
fstp %st
|
||||
andl $0x8000, %edx
|
||||
andl $8, %eax
|
||||
jnz 4f
|
||||
shrl $11, %edx
|
||||
addl %edx, %eax
|
||||
#ifdef PIC
|
||||
lea zero_nan(%rip),%rdx
|
||||
fldl (%rdx,%rax,1)
|
||||
#else
|
||||
fldl zero_nan(%rax, 1)
|
||||
#endif
|
||||
ret
|
||||
|
||||
/* The result is NaN, but we must not raise an exception.
|
||||
So use a variable. */
|
||||
2: fstp %st
|
||||
fstp %st
|
||||
fldl MO(nan)
|
||||
ret
|
||||
|
||||
/* The first parameter is a NaN. Return it. */
|
||||
3: fstp %st(1)
|
||||
ret
|
||||
|
||||
/* Return NaN and raise the invalid exception. */
|
||||
4: fstp %st
|
||||
fstp %st
|
||||
fldz
|
||||
fdiv %st
|
||||
ret
|
||||
END(__ieee754_scalbl)
|
1
sysdeps/x86_64/fpu/e_sqrtl.c
Normal file
1
sysdeps/x86_64/fpu/e_sqrtl.c
Normal file
@ -0,0 +1 @@
|
||||
#include "sysdeps/i386/fpu/e_sqrtl.c"
|
52
sysdeps/x86_64/fpu/fclrexcpt.c
Normal file
52
sysdeps/x86_64/fpu/fclrexcpt.c
Normal file
@ -0,0 +1,52 @@
|
||||
/* Clear given exceptions in current floating-point environment.
|
||||
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. */
|
||||
|
||||
#include <fenv.h>
|
||||
|
||||
int
|
||||
feclearexcept (int excepts)
|
||||
{
|
||||
fenv_t temp;
|
||||
unsigned int mxcsr;
|
||||
|
||||
/* Mask out unsupported bits/exceptions. */
|
||||
excepts &= FE_ALL_EXCEPT;
|
||||
|
||||
/* Bah, we have to clear selected exceptions. Since there is no
|
||||
`fldsw' instruction we have to do it the hard way. */
|
||||
__asm__ ("fnstenv %0" : "=m" (*&temp));
|
||||
|
||||
/* Clear the relevant bits. */
|
||||
temp.__status_word &= excepts ^ FE_ALL_EXCEPT;
|
||||
|
||||
/* Put the new data in effect. */
|
||||
__asm__ ("fldenv %0" : : "m" (*&temp));
|
||||
|
||||
/* And the same procedure for SSE. */
|
||||
__asm__ ("stmxcsr %0" : "=m" (*&mxcsr));
|
||||
|
||||
/* Clear the relevant bits. */
|
||||
mxcsr &= ~excepts;
|
||||
|
||||
/* And put them into effect. */
|
||||
__asm__ ("ldmxcsr %0" : : "m" (*&mxcsr));
|
||||
|
||||
/* Success. */
|
||||
return 0;
|
||||
}
|
49
sysdeps/x86_64/fpu/fedisblxcpt.c
Normal file
49
sysdeps/x86_64/fpu/fedisblxcpt.c
Normal file
@ -0,0 +1,49 @@
|
||||
/* Disable floating-point exceptions.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Andreas Jaeger <aj@suse.de>, 2001.
|
||||
|
||||
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>
|
||||
|
||||
int
|
||||
fedisableexcept (int excepts)
|
||||
{
|
||||
unsigned short int new_exc, old_exc;
|
||||
unsigned int new, old;
|
||||
|
||||
excepts &= FE_ALL_EXCEPT;
|
||||
|
||||
/* Get the current control word of the x87 FPU. */
|
||||
__asm__ ("fstcw %0" : "=m" (*&new_exc));
|
||||
|
||||
old_exc = (~new_exc) & FE_ALL_EXCEPT;
|
||||
|
||||
new_exc |= excepts;
|
||||
__asm__ ("fldcw %0" : : "m" (*&new_exc));
|
||||
|
||||
/* And now the same for the SSE MXCSR register. */
|
||||
__asm__ ("stmxcsr %0" : "=m" (*&new));
|
||||
|
||||
/* The SSE exception masks are shifted by 7 bits. */
|
||||
old = (~new) & (FE_ALL_EXCEPT << 7);
|
||||
|
||||
new |= excepts << 7;
|
||||
__asm__ ("ldmxcsr %0" : : "m" (*&new));
|
||||
|
||||
return old_exc;
|
||||
}
|
49
sysdeps/x86_64/fpu/feenablxcpt.c
Normal file
49
sysdeps/x86_64/fpu/feenablxcpt.c
Normal file
@ -0,0 +1,49 @@
|
||||
/* Enable floating-point exceptions.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Andreas Jaeger <aj@suse.de>, 2001.
|
||||
|
||||
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>
|
||||
|
||||
int
|
||||
feenableexcept (int excepts)
|
||||
{
|
||||
unsigned short int new_exc, old_exc;
|
||||
unsigned int new, old;
|
||||
|
||||
excepts &= FE_ALL_EXCEPT;
|
||||
|
||||
/* Get the current control word of the x87 FPU. */
|
||||
__asm__ ("fstcw %0" : "=m" (*&new_exc));
|
||||
|
||||
old_exc = (~new_exc) & FE_ALL_EXCEPT;
|
||||
|
||||
new_exc &= ~excepts;
|
||||
__asm__ ("fldcw %0" : : "m" (*&new_exc));
|
||||
|
||||
/* And now the same for the SSE MXCSR register. */
|
||||
__asm__ ("stmxcsr %0" : "=m" (*&new));
|
||||
|
||||
/* The SSE exception masks are shifted by 7 bits. */
|
||||
old = (~new) & (FE_ALL_EXCEPT << 7);
|
||||
|
||||
new &= ~(excepts << 7);
|
||||
__asm__ ("ldmxcsr %0" : : "m" (*&new));
|
||||
|
||||
return old_exc;
|
||||
}
|
30
sysdeps/x86_64/fpu/fegetenv.c
Normal file
30
sysdeps/x86_64/fpu/fegetenv.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* Store current floating-point environment.
|
||||
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. */
|
||||
|
||||
#include <fenv.h>
|
||||
|
||||
int
|
||||
fegetenv (fenv_t *envp)
|
||||
{
|
||||
__asm__ ("fnstenv %0\n"
|
||||
"stmxcsr %1" : "=m" (*envp), "=m" (envp->__mxcsr));
|
||||
|
||||
/* Success. */
|
||||
return 0;
|
||||
}
|
32
sysdeps/x86_64/fpu/fegetexcept.c
Normal file
32
sysdeps/x86_64/fpu/fegetexcept.c
Normal file
@ -0,0 +1,32 @@
|
||||
/* Get enabled floating-point exceptions.
|
||||
Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Andreas Jaeger <aj@suse.de>, 2001.
|
||||
|
||||
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>
|
||||
|
||||
int
|
||||
fegetexcept (void)
|
||||
{
|
||||
unsigned short int exc;
|
||||
|
||||
/* Get the current control word. */
|
||||
__asm__ ("fstcw %0" : "=m" (*&exc));
|
||||
|
||||
return (~exc) & FE_ALL_EXCEPT;
|
||||
}
|
33
sysdeps/x86_64/fpu/fegetround.c
Normal file
33
sysdeps/x86_64/fpu/fegetround.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* Return current rounding direction.
|
||||
Copyright (C) 1997, 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
|
||||
|
||||
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>
|
||||
|
||||
int
|
||||
fegetround (void)
|
||||
{
|
||||
int cw;
|
||||
/* We only check the x87 FPU unit. The SSE unit should be the same
|
||||
- and if it's not the same there's no way to signal it. */
|
||||
|
||||
__asm__ ("fnstcw %0" : "=m" (*&cw));
|
||||
|
||||
return cw & 0xc00;
|
||||
}
|
41
sysdeps/x86_64/fpu/feholdexcpt.c
Normal file
41
sysdeps/x86_64/fpu/feholdexcpt.c
Normal file
@ -0,0 +1,41 @@
|
||||
/* Store current floating-point environment and clear exceptions.
|
||||
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. */
|
||||
|
||||
#include <fenv.h>
|
||||
|
||||
int
|
||||
feholdexcept (fenv_t *envp)
|
||||
{
|
||||
unsigned short int work;
|
||||
unsigned int mxcsr;
|
||||
|
||||
/* Store the environment. */
|
||||
__asm__ ("fnstenv %0\n"
|
||||
"stmxcsr %1" : "=m" (*envp), "=m" (envp->__mxcsr));
|
||||
|
||||
/* Now set all exceptions to non-stop, first the x87 FPU. */
|
||||
work = envp->__control_word | 0x3f;
|
||||
__asm__ ("fldcw %0" : : "m" (*&work));
|
||||
|
||||
/* Set the SSE MXCSR register. */
|
||||
mxcsr = envp->__mxcsr | 0x1f80;
|
||||
__asm__ ("ldmxcsr %0" : : "m" (*&mxcsr));
|
||||
|
||||
return 0;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user