From 041cdc2769407c4d3869b218ad7ee7638e1c306e Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 24 May 2017 20:49:02 +0200 Subject: sparc64: add basic support No NPTL, no LDSO support. Bootup with Busybox Ash in Qemu working. Testuite shows only two failures, but mksh continue/break support doesn't work. --- libc/sysdeps/linux/common/bits/kernel_sigaction.h | 8 + libc/sysdeps/linux/common/mmap.c | 2 +- libc/sysdeps/linux/sparc64/Makefile | 13 + libc/sysdeps/linux/sparc64/Makefile.arch | 18 + libc/sysdeps/linux/sparc64/__longjmp.S | 40 + libc/sysdeps/linux/sparc64/__start_context.S | 35 + libc/sysdeps/linux/sparc64/__syscall_error.c | 18 + libc/sysdeps/linux/sparc64/bits/endian.h | 12 + libc/sysdeps/linux/sparc64/bits/epoll.h | 28 + libc/sysdeps/linux/sparc64/bits/eventfd.h | 30 + libc/sysdeps/linux/sparc64/bits/fcntl.h | 247 +++ libc/sysdeps/linux/sparc64/bits/inotify.h | 28 + libc/sysdeps/linux/sparc64/bits/ioctls.h | 35 + libc/sysdeps/linux/sparc64/bits/ipc.h | 53 + libc/sysdeps/linux/sparc64/bits/kernel_stat.h | 46 + libc/sysdeps/linux/sparc64/bits/kernel_types.h | 43 + libc/sysdeps/linux/sparc64/bits/mathdef.h | 40 + libc/sysdeps/linux/sparc64/bits/mathinline.h | 197 ++ libc/sysdeps/linux/sparc64/bits/mman.h | 106 + libc/sysdeps/linux/sparc64/bits/msq.h | 72 + libc/sysdeps/linux/sparc64/bits/poll.h | 48 + libc/sysdeps/linux/sparc64/bits/resource.h | 239 +++ libc/sysdeps/linux/sparc64/bits/sem.h | 83 + libc/sysdeps/linux/sparc64/bits/setjmp.h | 54 + libc/sysdeps/linux/sparc64/bits/shm.h | 99 + libc/sysdeps/linux/sparc64/bits/sigaction.h | 77 + libc/sysdeps/linux/sparc64/bits/sigcontextinfo.h | 30 + libc/sysdeps/linux/sparc64/bits/siginfo.h | 321 +++ libc/sysdeps/linux/sparc64/bits/signalfd.h | 28 + libc/sysdeps/linux/sparc64/bits/signum.h | 62 + libc/sysdeps/linux/sparc64/bits/sigstack.h | 55 + libc/sysdeps/linux/sparc64/bits/socket_type.h | 53 + libc/sysdeps/linux/sparc64/bits/stackinfo.h | 26 + libc/sysdeps/linux/sparc64/bits/stat.h | 167 ++ libc/sysdeps/linux/sparc64/bits/syscalls.h | 116 ++ libc/sysdeps/linux/sparc64/bits/termios.h | 231 +++ libc/sysdeps/linux/sparc64/bits/timerfd.h | 28 + libc/sysdeps/linux/sparc64/bits/typesizes.h | 64 + .../linux/sparc64/bits/uClibc_arch_features.h | 41 + libc/sysdeps/linux/sparc64/bits/uClibc_page.h | 17 + libc/sysdeps/linux/sparc64/bits/wordsize.h | 4 + libc/sysdeps/linux/sparc64/brk.S | 101 + libc/sysdeps/linux/sparc64/bsd-_setjmp.S | 1 + libc/sysdeps/linux/sparc64/bsd-setjmp.S | 1 + libc/sysdeps/linux/sparc64/clone.S | 85 + libc/sysdeps/linux/sparc64/crt1.S | 116 ++ libc/sysdeps/linux/sparc64/crti.S | 23 + libc/sysdeps/linux/sparc64/crtn.S | 17 + libc/sysdeps/linux/sparc64/fork.S | 32 + libc/sysdeps/linux/sparc64/fpu_control.h | 72 + libc/sysdeps/linux/sparc64/getcontext.S | 63 + libc/sysdeps/linux/sparc64/jmpbuf-offsets.h | 20 + libc/sysdeps/linux/sparc64/jmpbuf-unwind.h | 28 + libc/sysdeps/linux/sparc64/makecontext.c | 56 + libc/sysdeps/linux/sparc64/pipe.S | 38 + libc/sysdeps/linux/sparc64/setcontext.S | 37 + libc/sysdeps/linux/sparc64/setjmp.S | 63 + libc/sysdeps/linux/sparc64/sigaction.c | 77 + libc/sysdeps/linux/sparc64/soft-fp/Makefile | 33 + libc/sysdeps/linux/sparc64/soft-fp/Versions | 8 + libc/sysdeps/linux/sparc64/soft-fp/double.h | 323 +++ libc/sysdeps/linux/sparc64/soft-fp/e_ilogbl.c | 79 + libc/sysdeps/linux/sparc64/soft-fp/longlong.h | 1773 ++++++++++++++++ libc/sysdeps/linux/sparc64/soft-fp/op-1.h | 369 ++++ libc/sysdeps/linux/sparc64/soft-fp/op-2.h | 705 +++++++ libc/sysdeps/linux/sparc64/soft-fp/op-4.h | 875 ++++++++ libc/sysdeps/linux/sparc64/soft-fp/op-8.h | 150 ++ libc/sysdeps/linux/sparc64/soft-fp/op-common.h | 2134 ++++++++++++++++++++ libc/sysdeps/linux/sparc64/soft-fp/qp_add.c | 44 + libc/sysdeps/linux/sparc64/soft-fp/qp_cmp.c | 48 + libc/sysdeps/linux/sparc64/soft-fp/qp_cmpe.c | 49 + libc/sysdeps/linux/sparc64/soft-fp/qp_div.c | 44 + libc/sysdeps/linux/sparc64/soft-fp/qp_dtoq.c | 45 + libc/sysdeps/linux/sparc64/soft-fp/qp_feq.c | 48 + libc/sysdeps/linux/sparc64/soft-fp/qp_fge.c | 48 + libc/sysdeps/linux/sparc64/soft-fp/qp_fgt.c | 48 + libc/sysdeps/linux/sparc64/soft-fp/qp_fle.c | 48 + libc/sysdeps/linux/sparc64/soft-fp/qp_flt.c | 48 + libc/sysdeps/linux/sparc64/soft-fp/qp_fne.c | 49 + libc/sysdeps/linux/sparc64/soft-fp/qp_itoq.c | 34 + libc/sysdeps/linux/sparc64/soft-fp/qp_mul.c | 49 + libc/sysdeps/linux/sparc64/soft-fp/qp_neg.S | 30 + libc/sysdeps/linux/sparc64/soft-fp/qp_qtod.c | 48 + libc/sysdeps/linux/sparc64/soft-fp/qp_qtoi.c | 46 + libc/sysdeps/linux/sparc64/soft-fp/qp_qtos.c | 49 + libc/sysdeps/linux/sparc64/soft-fp/qp_qtoui.c | 46 + libc/sysdeps/linux/sparc64/soft-fp/qp_qtoux.c | 46 + libc/sysdeps/linux/sparc64/soft-fp/qp_qtox.c | 46 + libc/sysdeps/linux/sparc64/soft-fp/qp_sqrt.c | 41 + libc/sysdeps/linux/sparc64/soft-fp/qp_stoq.c | 45 + libc/sysdeps/linux/sparc64/soft-fp/qp_sub.c | 44 + libc/sysdeps/linux/sparc64/soft-fp/qp_uitoq.c | 34 + libc/sysdeps/linux/sparc64/soft-fp/qp_util.c | 60 + libc/sysdeps/linux/sparc64/soft-fp/qp_uxtoq.c | 34 + libc/sysdeps/linux/sparc64/soft-fp/qp_xtoq.c | 34 + libc/sysdeps/linux/sparc64/soft-fp/quad.h | 330 +++ libc/sysdeps/linux/sparc64/soft-fp/s_frexpl.c | 51 + libc/sysdeps/linux/sparc64/soft-fp/s_scalblnl.c | 52 + libc/sysdeps/linux/sparc64/soft-fp/s_scalbnl.c | 52 + libc/sysdeps/linux/sparc64/soft-fp/sfp-machine.h | 147 ++ libc/sysdeps/linux/sparc64/soft-fp/single.h | 199 ++ libc/sysdeps/linux/sparc64/soft-fp/soft-fp.h | 342 ++++ libc/sysdeps/linux/sparc64/swapcontext.c | 46 + libc/sysdeps/linux/sparc64/sys/procfs.h | 121 ++ libc/sysdeps/linux/sparc64/sys/ptrace.h | 235 +++ libc/sysdeps/linux/sparc64/sys/ucontext.h | 198 ++ libc/sysdeps/linux/sparc64/sys/user.h | 83 + libc/sysdeps/linux/sparc64/syscall.S | 38 + libc/sysdeps/linux/sparc64/sysdep.h | 139 ++ libc/sysdeps/linux/sparc64/ucontext_i.sym | 6 + libc/sysdeps/linux/sparc64/vfork.S | 36 + 111 files changed, 13472 insertions(+), 1 deletion(-) create mode 100644 libc/sysdeps/linux/sparc64/Makefile create mode 100644 libc/sysdeps/linux/sparc64/Makefile.arch create mode 100644 libc/sysdeps/linux/sparc64/__longjmp.S create mode 100644 libc/sysdeps/linux/sparc64/__start_context.S create mode 100644 libc/sysdeps/linux/sparc64/__syscall_error.c create mode 100644 libc/sysdeps/linux/sparc64/bits/endian.h create mode 100644 libc/sysdeps/linux/sparc64/bits/epoll.h create mode 100644 libc/sysdeps/linux/sparc64/bits/eventfd.h create mode 100644 libc/sysdeps/linux/sparc64/bits/fcntl.h create mode 100644 libc/sysdeps/linux/sparc64/bits/inotify.h create mode 100644 libc/sysdeps/linux/sparc64/bits/ioctls.h create mode 100644 libc/sysdeps/linux/sparc64/bits/ipc.h create mode 100644 libc/sysdeps/linux/sparc64/bits/kernel_stat.h create mode 100644 libc/sysdeps/linux/sparc64/bits/kernel_types.h create mode 100644 libc/sysdeps/linux/sparc64/bits/mathdef.h create mode 100644 libc/sysdeps/linux/sparc64/bits/mathinline.h create mode 100644 libc/sysdeps/linux/sparc64/bits/mman.h create mode 100644 libc/sysdeps/linux/sparc64/bits/msq.h create mode 100644 libc/sysdeps/linux/sparc64/bits/poll.h create mode 100644 libc/sysdeps/linux/sparc64/bits/resource.h create mode 100644 libc/sysdeps/linux/sparc64/bits/sem.h create mode 100644 libc/sysdeps/linux/sparc64/bits/setjmp.h create mode 100644 libc/sysdeps/linux/sparc64/bits/shm.h create mode 100644 libc/sysdeps/linux/sparc64/bits/sigaction.h create mode 100644 libc/sysdeps/linux/sparc64/bits/sigcontextinfo.h create mode 100644 libc/sysdeps/linux/sparc64/bits/siginfo.h create mode 100644 libc/sysdeps/linux/sparc64/bits/signalfd.h create mode 100644 libc/sysdeps/linux/sparc64/bits/signum.h create mode 100644 libc/sysdeps/linux/sparc64/bits/sigstack.h create mode 100644 libc/sysdeps/linux/sparc64/bits/socket_type.h create mode 100644 libc/sysdeps/linux/sparc64/bits/stackinfo.h create mode 100644 libc/sysdeps/linux/sparc64/bits/stat.h create mode 100644 libc/sysdeps/linux/sparc64/bits/syscalls.h create mode 100644 libc/sysdeps/linux/sparc64/bits/termios.h create mode 100644 libc/sysdeps/linux/sparc64/bits/timerfd.h create mode 100644 libc/sysdeps/linux/sparc64/bits/typesizes.h create mode 100644 libc/sysdeps/linux/sparc64/bits/uClibc_arch_features.h create mode 100644 libc/sysdeps/linux/sparc64/bits/uClibc_page.h create mode 100644 libc/sysdeps/linux/sparc64/bits/wordsize.h create mode 100644 libc/sysdeps/linux/sparc64/brk.S create mode 100644 libc/sysdeps/linux/sparc64/bsd-_setjmp.S create mode 100644 libc/sysdeps/linux/sparc64/bsd-setjmp.S create mode 100644 libc/sysdeps/linux/sparc64/clone.S create mode 100644 libc/sysdeps/linux/sparc64/crt1.S create mode 100644 libc/sysdeps/linux/sparc64/crti.S create mode 100644 libc/sysdeps/linux/sparc64/crtn.S create mode 100644 libc/sysdeps/linux/sparc64/fork.S create mode 100644 libc/sysdeps/linux/sparc64/fpu_control.h create mode 100644 libc/sysdeps/linux/sparc64/getcontext.S create mode 100644 libc/sysdeps/linux/sparc64/jmpbuf-offsets.h create mode 100644 libc/sysdeps/linux/sparc64/jmpbuf-unwind.h create mode 100644 libc/sysdeps/linux/sparc64/makecontext.c create mode 100644 libc/sysdeps/linux/sparc64/pipe.S create mode 100644 libc/sysdeps/linux/sparc64/setcontext.S create mode 100644 libc/sysdeps/linux/sparc64/setjmp.S create mode 100644 libc/sysdeps/linux/sparc64/sigaction.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/Makefile create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/Versions create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/double.h create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/e_ilogbl.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/longlong.h create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/op-1.h create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/op-2.h create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/op-4.h create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/op-8.h create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/op-common.h create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_add.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_cmp.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_cmpe.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_div.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_dtoq.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_feq.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_fge.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_fgt.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_fle.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_flt.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_fne.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_itoq.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_mul.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_neg.S create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_qtod.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_qtoi.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_qtos.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_qtoui.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_qtoux.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_qtox.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_sqrt.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_stoq.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_sub.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_uitoq.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_util.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_uxtoq.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/qp_xtoq.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/quad.h create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/s_frexpl.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/s_scalblnl.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/s_scalbnl.c create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/sfp-machine.h create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/single.h create mode 100644 libc/sysdeps/linux/sparc64/soft-fp/soft-fp.h create mode 100644 libc/sysdeps/linux/sparc64/swapcontext.c create mode 100644 libc/sysdeps/linux/sparc64/sys/procfs.h create mode 100644 libc/sysdeps/linux/sparc64/sys/ptrace.h create mode 100644 libc/sysdeps/linux/sparc64/sys/ucontext.h create mode 100644 libc/sysdeps/linux/sparc64/sys/user.h create mode 100644 libc/sysdeps/linux/sparc64/syscall.S create mode 100644 libc/sysdeps/linux/sparc64/sysdep.h create mode 100644 libc/sysdeps/linux/sparc64/ucontext_i.sym create mode 100644 libc/sysdeps/linux/sparc64/vfork.S (limited to 'libc') diff --git a/libc/sysdeps/linux/common/bits/kernel_sigaction.h b/libc/sysdeps/linux/common/bits/kernel_sigaction.h index 5c8726058..21e4c9296 100644 --- a/libc/sysdeps/linux/common/bits/kernel_sigaction.h +++ b/libc/sysdeps/linux/common/bits/kernel_sigaction.h @@ -19,6 +19,14 @@ struct old_kernel_sigaction { unsigned long sa_flags; void (*sa_restorer)(void); }; + +/* This is the sigaction structure from the Linux 2.1.68 kernel. */ +struct kernel_sigaction { + __sighandler_t k_sa_handler; + unsigned long sa_flags; + void (*sa_restorer) (void); + sigset_t sa_mask; +}; #endif #endif /* _BITS_SIGACTION_STRUCT_H */ diff --git a/libc/sysdeps/linux/common/mmap.c b/libc/sysdeps/linux/common/mmap.c index cafe756bf..b74fc19ef 100644 --- a/libc/sysdeps/linux/common/mmap.c +++ b/libc/sysdeps/linux/common/mmap.c @@ -21,6 +21,7 @@ static _syscall6(void *, _mmap, void *, addr, size_t, len, #elif defined __NR_mmap2 && defined _syscall6 + # include # include # ifndef MMAP2_PAGE_SHIFT @@ -51,7 +52,6 @@ static void *_mmap(void *addr, size_t len, int prot, int flags, } #elif defined __NR_mmap - # define __NR___syscall_mmap __NR_mmap static __inline__ _syscall1(void *, __syscall_mmap, unsigned long *, buffer) diff --git a/libc/sysdeps/linux/sparc64/Makefile b/libc/sysdeps/linux/sparc64/Makefile new file mode 100644 index 000000000..633c91f3e --- /dev/null +++ b/libc/sysdeps/linux/sparc64/Makefile @@ -0,0 +1,13 @@ +# Makefile for uClibc +# +# Copyright (C) 2000-2005 Erik Andersen +# +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. +# + +top_srcdir=../../../../ +top_builddir=../../../../ +all: objs +include $(top_builddir)Rules.mak +include Makefile.arch +include $(top_srcdir)Makerules diff --git a/libc/sysdeps/linux/sparc64/Makefile.arch b/libc/sysdeps/linux/sparc64/Makefile.arch new file mode 100644 index 000000000..37b539b3b --- /dev/null +++ b/libc/sysdeps/linux/sparc64/Makefile.arch @@ -0,0 +1,18 @@ +# Makefile for uClibc-ng +# +# Copyright (C) 2017 Waldemar Brodkorb +# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + +CSRC-y := __syscall_error.c sigaction.c +SSRC-y := __longjmp.S setjmp.S bsd-setjmp.S bsd-_setjmp.S brk.S fork.S \ + syscall.S pipe.S vfork.S clone.S + +CSRC-y += $(addprefix soft-fp/, \ + qp_add.c qp_cmp.c qp_cmpe.c qp_div.c qp_dtoq.c qp_feq.c qp_fge.c \ + qp_fgt.c qp_fle.c qp_flt.c qp_fne.c qp_itoq.c qp_mul.c qp_neg.c \ + qp_qtod.c qp_qtoi.c qp_qtos.c qp_qtoui.c qp_qtoux.c qp_qtox.c \ + qp_sqrt.c qp_stoq.c qp_sub.c qp_uitoq.c qp_uxtoq.c qp_xtoq.c qp_util.c) + +CSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += makecontext.c +SSRC-$(UCLIBC_HAS_CONTEXT_FUNCS) += getcontext.S setcontext.S swapcontext.S \ + __start_context.S diff --git a/libc/sysdeps/linux/sparc64/__longjmp.S b/libc/sysdeps/linux/sparc64/__longjmp.S new file mode 100644 index 000000000..79cefcc9d --- /dev/null +++ b/libc/sysdeps/linux/sparc64/__longjmp.S @@ -0,0 +1,40 @@ +/* Copyright (C) 1997-2017 Free Software Foundation, Inc. + Contributed by Richard Henderson (rth@tamu.edu). + + 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, see + . */ + +#include + +/* Offsets into the jmp_buf structure. */ + +#define O_mask_was_saved 512 +#define O_gregs 32 +#define O_g1 (O_gregs + 4*8) + +ENTRY(__longjmp) + + /* Modify the context with the value we want to return. */ + movre %o1, 1, %o1 + stx %o1, [%o0 + O_g1] + + /* Let setcontext know if we want to modify the current sigmask. */ + ld [%o0 + O_mask_was_saved], %o1 + + /* And bamf back to where we belong! */ + ta 0x6f + +END(__longjmp) + +libc_hidden_def (__longjmp) diff --git a/libc/sysdeps/linux/sparc64/__start_context.S b/libc/sysdeps/linux/sparc64/__start_context.S new file mode 100644 index 000000000..7054845da --- /dev/null +++ b/libc/sysdeps/linux/sparc64/__start_context.S @@ -0,0 +1,35 @@ +/* Copyright (C) 2012-2017 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, see + . */ + +#include + + .text + +/* This is the helper code which gets called if a function which is + registered with 'makecontext' returns. In this case we have to + install the context listed in the uc_link element of the context + 'makecontext' manipulated at the time of the 'makecontext' call. + If the pointer is NULL the process must terminate. */ + +ENTRY(__start_context) + brz,pn %i0, 1f + mov 1, %o1 + call __setcontext + mov %i0, %o0 +1: call HIDDEN_JUMPTARGET(exit) + mov 0, %o0 + unimp 0 +END(__start_context) diff --git a/libc/sysdeps/linux/sparc64/__syscall_error.c b/libc/sysdeps/linux/sparc64/__syscall_error.c new file mode 100644 index 000000000..5e109a83b --- /dev/null +++ b/libc/sysdeps/linux/sparc64/__syscall_error.c @@ -0,0 +1,18 @@ +/* Wrapper for setting errno. + * + * Copyright (C) 2000-2006 Erik Andersen + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ + +#include +#include + +/* This routine is jumped to by all the syscall handlers, to stash + * an error number into errno. */ +int __syscall_error(int err_no) attribute_hidden; +int __syscall_error(int err_no) +{ + __set_errno(err_no); + return -1; +} diff --git a/libc/sysdeps/linux/sparc64/bits/endian.h b/libc/sysdeps/linux/sparc64/bits/endian.h new file mode 100644 index 000000000..8acfdf5df --- /dev/null +++ b/libc/sysdeps/linux/sparc64/bits/endian.h @@ -0,0 +1,12 @@ +/* Sparc is big-endian, but v9 supports endian conversion on loads/stores + and GCC supports such a mode. Be prepared. */ + +#ifndef _ENDIAN_H +# error "Never use directly; include instead." +#endif + +#ifdef __LITTLE_ENDIAN__ +# define __BYTE_ORDER __LITTLE_ENDIAN +#else +# define __BYTE_ORDER __BIG_ENDIAN +#endif diff --git a/libc/sysdeps/linux/sparc64/bits/epoll.h b/libc/sysdeps/linux/sparc64/bits/epoll.h new file mode 100644 index 000000000..3939f1936 --- /dev/null +++ b/libc/sysdeps/linux/sparc64/bits/epoll.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2002-2012 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, see + . */ + +#ifndef _SYS_EPOLL_H +# error "Never use directly; include instead." +#endif + +/* Flags to be passed to epoll_create1. */ +enum + { + EPOLL_CLOEXEC = 0x400000, +#define EPOLL_CLOEXEC EPOLL_CLOEXEC + EPOLL_NONBLOCK = 0x004000 +#define EPOLL_NONBLOCK EPOLL_NONBLOCK + }; diff --git a/libc/sysdeps/linux/sparc64/bits/eventfd.h b/libc/sysdeps/linux/sparc64/bits/eventfd.h new file mode 100644 index 000000000..e2eb4d27d --- /dev/null +++ b/libc/sysdeps/linux/sparc64/bits/eventfd.h @@ -0,0 +1,30 @@ +/* Copyright (C) 2007-2013 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, see + . */ + +#ifndef _SYS_EVENTFD_H +# error "Never use directly; include instead." +#endif + +/* Flags for eventfd. */ +enum + { + EFD_SEMAPHORE = 0x000001, +#define EFD_SEMAPHORE EFD_SEMAPHORE + EFD_CLOEXEC = 0x400000, +#define EFD_CLOEXEC EFD_CLOEXEC + EFD_NONBLOCK = 0x004000 +#define EFD_NONBLOCK EFD_NONBLOCK + }; diff --git a/libc/sysdeps/linux/sparc64/bits/fcntl.h b/libc/sysdeps/linux/sparc64/bits/fcntl.h new file mode 100644 index 000000000..dad3470b8 --- /dev/null +++ b/libc/sysdeps/linux/sparc64/bits/fcntl.h @@ -0,0 +1,247 @@ +/* O_*, F_*, FD_* bit values for Linux/SPARC64. + Copyright (C) 1995-2017 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, see + . */ + +#ifndef _FCNTL_H +# error "Never use directly; include instead." +#endif + +#include +#ifdef __USE_GNU +# include +#endif + +/* open/fcntl - O_SYNC is only implemented on blocks devices and on files + located on an ext2 file system */ +#define O_RDONLY 0x0000 +#define O_WRONLY 0x0001 +#define O_RDWR 0x0002 +#define O_ACCMODE 0x0003 +#define O_APPEND 0x0008 +#define O_ASYNC 0x0040 +#define O_CREAT 0x0200 /* not fcntl */ +#define O_TRUNC 0x0400 /* not fcntl */ +#define O_EXCL 0x0800 /* not fcntl */ +#define O_SYNC 0x2000 +#define O_NONBLOCK 0x4000 +#define O_NDELAY (0x0004 | O_NONBLOCK) +#define O_NOCTTY 0x8000 /* not fcntl */ + +#ifdef __USE_GNU +# define O_DIRECTORY 0x10000 /* must be a directory */ +# define O_NOFOLLOW 0x20000 /* don't follow links */ +# define O_DIRECT 0x100000 /* direct disk access hint */ +# define O_NOATIME 0x200000 /* Do not set atime. */ +# define O_CLOEXEC 0x400000 /* Set close_on_exit. */ +# define O_PATH 0x1000000 /* Resolve pathname but do not open file. */ +#endif + +#ifdef __USE_LARGEFILE64 +# define O_LARGEFILE 0 +#endif + +/* For now Linux has no 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 + +/* 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 + +/* 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. */ +#if defined __USE_BSD || defined __USE_UNIX98 +# define F_GETOWN 5 /* Get owner of socket (receiver of SIGIO). */ +# define F_SETOWN 6 /* Set owner of socket (receiver of SIGIO). */ +#endif +#ifndef __USE_FILE_OFFSET64 +# define F_GETLK 7 /* Get record locking info. */ +# define F_SETLK 8 /* Set record locking info (non-blocking). */ +# define F_SETLKW 9 /* Set record locking info (blocking). */ +#else +# define F_GETLK F_GETLK64 /* Get record locking info. */ +# define F_SETLK F_SETLK64 /* Set record locking info (non-blocking).*/ +# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */ +#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. */ +# define F_DUPFD_CLOEXEC 1030 /* Duplicate file descriptor with + close-on-exit set on new fd. */ +# define F_SETPIPE_SZ 1031 /* Set pipe page size array. */ +# define F_GETPIPE_SZ 1032 /* Get pipe page size array. */ +#endif + +#define F_GETLK64 7 /* Get record locking info. */ +#define F_SETLK64 8 /* Set record locking info (non-blocking). */ +#define F_SETLKW64 9 /* Set record locking info (blocking). */ + +/* for F_[GET|SET]FD */ +#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 1 /* Read lock. */ +#define F_WRLCK 2 /* Write lock. */ +#define F_UNLCK 3 /* 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 + +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'). */ +#ifndef __USE_FILE_OFFSET64 + __off_t l_start; /* Offset where the lock begins. */ + __off_t l_len; /* Size of the locked area; zero means until EOF. */ +#else + __off64_t l_start; /* Offset where the lock begins. */ + __off64_t l_len; /* Size of the locked area; zero means until EOF. */ +#endif + __pid_t l_pid; /* Process holding the lock. */ + short int __unused; + }; + +#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. */ + short int __unused; + }; +#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 + + +#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__ +/* Flags for SYNC_FILE_RANGE. */ +# define SYNC_FILE_RANGE_WAIT_BEFORE 1 /* Wait upon writeout of all pages + in the range before performing the + write. */ +# define SYNC_FILE_RANGE_WRITE 2 /* Initiate writeout of all those + dirty pages in the range which are + not presently under writeback. */ +# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in + the range after performing the + write. */ + +/* Flags for SPLICE and VMSPLICE. */ +# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */ +# define SPLICE_F_NONBLOCK 2 /* Don't block on the pipe splicing + (but we may still block on the fd + we splice from/to). */ +# define SPLICE_F_MORE 4 /* Expect more data. */ +# define SPLICE_F_GIFT 8 /* Pages passed in are a gift. */ +#endif + +__BEGIN_DECLS + +#if defined __USE_GNU && defined __UCLIBC_LINUX_SPECIFIC__ + +/* Provide kernel hint to read ahead. */ +extern ssize_t readahead (int __fd, __off64_t __offset, size_t __count) + __THROW; + + +/* Selective file content synch'ing. */ +extern int sync_file_range (int __fd, __off64_t __from, __off64_t __to, + unsigned int __flags); + +/* Splice address range into a pipe. */ +extern ssize_t vmsplice (int __fdout, const struct iovec *__iov, + size_t __count, unsigned int __flags); + +/* Splice two files together. */ +extern ssize_t splice (int __fdin, __off64_t *__offin, int __fdout, + __off64_t *__offout, size_t __len, + unsigned int __flags); + +/* In-kernel implementation of tee for pipe buffers. */ +extern ssize_t tee (int __fdin, int __fdout, size_t __len, + unsigned int __flags); + +#endif +__END_DECLS + diff --git a/libc/sysdeps/linux/sparc64/bits/inotify.h b/libc/sysdeps/linux/sparc64/bits/inotify.h new file mode 100644 index 000000000..41ca6278a --- /dev/null +++ b/libc/sysdeps/linux/sparc64/bits/inotify.h @@ -0,0 +1,28 @@ +/* Copyright (C) 2005-2012 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, see + . */ + +#ifndef _SYS_INOTIFY_H +# error "Never use directly; include instead." +#endif + +/* Flags for the parameter of inotify_init1. */ +enum + { + IN_CLOEXEC = 0x400000, +#define IN_CLOEXEC IN_CLOEXEC + IN_NONBLOCK = 0x004000 +#define IN_NONBLOCK IN_NONBLOCK + }; diff --git a/libc/sysdeps/linux/sparc64/bits/ioctls.h b/libc/sysdeps/linux/sparc64/bits/ioctls.h new file mode 100644 index 000000000..49573ed4f --- /dev/null +++ b/libc/sysdeps/linux/sparc64/bits/ioctls.h @@ -0,0 +1,35 @@ +/* Copyright (C) 1996, 1997 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, see + . */ + +#ifndef _SYS_IOCTL_H +# error "Never use directly; include instead." +#endif + +/* Use the definitions from the kernel header files. */ +#include + +/* Oh well, this is necessary since the kernel data structure is + different from the user-level version. */ +#undef TCGETS +#undef TCSETS +#undef TCSETSW +#undef TCSETSF +#define TCGETS _IOR ('T', 8, char[36]) +#define TCSETS _IOW ('T', 9, char[36]) +#define TCSETSW _IOW ('T', 10, char[36]) +#define TCSETSF _IOW ('T', 11, char[36]) + +#include diff --git a/libc/sysdeps/linux/sparc64/bits/ipc.h b/libc/sysdeps/linux/sparc64/bits/ipc.h new file mode 100644 index 000000000..7fedafa61 --- /dev/null +++ b/libc/sysdeps/linux/sparc64/bits/ipc.h @@ -0,0 +1,53 @@ +/* Copyright (C) 1995-1999, 2000 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, see + . */ + +#ifndef _SYS_IPC_H +# error "Never use directly; include instead." +#endif + +#include + +/* Mode bits for `msgget', `semget', and `shmget'. */ +#define IPC_CREAT 01000 /* Create key if key does not exist. */ +#define IPC_EXCL 02000 /* Fail if key exists. */ +#define IPC_NOWAIT 04000 /* Return error on wait. */ + +/* Control commands for `msgctl', `semctl', and `shmctl'. */ +#define IPC_RMID 0 /* Remove identifier. */ +#define IPC_SET 1 /* Set `ipc_perm' options. */ +#define IPC_STAT 2 /* Get `ipc_perm' options. */ +#ifdef __USE_GNU +# define IPC_INFO 3 /* See ipcs. */ +#endif + +/* Special key values. */ +#define IPC_PRIVATE ((__key_t) 0) /* Private key. */ + + +/* Data structure used to pass permission information to IPC operations. */ +struct ipc_perm + { + __key_t __key; /* Key. */ + __uid_t uid; /* Owner's user ID. */ + __gid_t gid; /* Owner's group ID. */ + __uid_t cuid; /* Creator's user ID. */ + __gid_t cgid; /* Creator's group ID. */ + __mode_t mode; /* Read/write permission. */ + unsigned short int __pad1; + unsigned short int __seq; /* Sequence number. */ + unsigned long long int __unused1; + unsigned long long int __unused2; + }; diff --git a/libc/sysdeps/linux/sparc64/bits/kernel_stat.h b/libc/sysdeps/linux/sparc64/bits/kernel_stat.h new file mode 100644 index 000000000..c45a595d5 --- /dev/null +++ b/libc/sysdeps/linux/sparc64/bits/kernel_stat.h @@ -0,0 +1,46 @@ +#ifndef _BITS_STAT_STRUCT_H +#define _BITS_STAT_STRUCT_H + +/* This file provides whatever this particular arch's kernel thinks + * struct kernel_stat should look like... It turns out each arch has a + * different opinion on the subject... */ + +struct kernel_stat { + unsigned int st_dev; + unsigned long st_ino; + unsigned short st_mode; + short st_nlink; + unsigned short st_uid; + unsigned short st_gid; + unsigned int st_rdev; + long st_size; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + long st_blksize; + long st_blocks; + unsigned long __unused4; + unsigned long __unused5; +}; + +struct kernel_stat64 { + unsigned long st_dev; + unsigned long st_ino; + unsigned long st_nlink; + unsigned int st_mode; + unsigned int st_uid; + unsigned int st_gid; + unsigned int __pad2; + unsigned long st_rdev; + long st_size; + long st_blksize; + long st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + long __unused4; + long __unused5; + long __unused6; +}; + +#endif /* _BITS_STAT_STRUCT_H */ diff --git a/libc/sysdeps/linux/sparc64/bits/kernel_types.h b/libc/sysdeps/linux/sparc64/bits/kernel_types.h new file mode 100644 index 000000000..d38ac8e40 --- /dev/null +++ b/libc/sysdeps/linux/sparc64/bits/kernel_types.h @@ -0,0 +1,43 @@ +/* Note that we use the exact same include guard #define names + * as asm/posix_types.h. This will avoid gratuitous conflicts + * with the posix_types.h kernel header, and will ensure that + * our private content, and not the kernel header, will win. + * -Erik + */ +#ifndef __ASM_GENERIC_POSIX_TYPES_H +#define __ASM_GENERIC_POSIX_TYPES_H + +typedef unsigned long __kernel_size_t; +typedef long __kernel_ssize_t; +typedef long __kernel_ptrdiff_t; +typedef long __kernel_time_t; +typedef long __kernel_clock_t; +typedef int __kernel_pid_t; +typedef int __kernel_ipc_pid_t; +typedef unsigned int __kernel_uid_t; +typedef unsigned int __kernel_gid_t; +typedef unsigned int __kernel_dev_t; +typedef unsigned long __kernel_ino_t; +typedef unsigned int __kernel_mode_t; +typedef unsigned short __kernel_umode_t; +typedef unsigned int __kernel_nlink_t; +typedef int __kernel_daddr_t; +typedef long __kernel_off_t; +typedef char * __kernel_caddr_t; +typedef unsigned short __kernel_uid16_t; +typedef unsigned short __kernel_gid16_t; +typedef unsigned short __kernel_old_uid_t; +typedef unsigned short __kernel_old_gid_t; +typedef __kernel_dev_t __kernel_old_dev_t; +typedef long __kernel_long_t; +typedef unsigned long __kernel_ulong_t; +typedef unsigned int __kernel_uid32_t; +typedef unsigned int __kernel_gid32_t; +typedef int __kernel_suseconds_t; +typedef long long __kernel_loff_t; + +typedef struct { + int val[2]; +} __kernel_fsid_t; + +#endif diff --git a/libc/sysdeps/linux/sparc64/bits/mathdef.h b/libc/sysdeps/linux/sparc64/bits/mathdef.h new file mode 100644 index 000000000..921a2bce5 --- /dev/null +++ b/libc/sysdeps/linux/sparc64/bits/mathdef.h @@ -0,0 +1,40 @@ +/* Copyright (C) 1997, 1998, 1999, 2000, 2004, 2006 + 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, see + . */ + +#if !defined _MATH_H && !defined _COMPLEX_H +# error "Never use directly; include instead" +#endif + +/* FIXME! This file describes properties of the compiler, not the machine; + it should not be part of libc! */ + +#if defined __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF +# define _MATH_H_MATHDEF 1 + +/* SPARC has both `float' and `double' arithmetic. */ +typedef float float_t; +typedef double double_t; + +/* The values returned by `ilogb' for 0 and NaN respectively. */ +# define FP_ILOGB0 (-2147483647) +# define FP_ILOGBNAN (2147483647) + +#endif /* ISO C99 */ + +#if !defined __NO_LONG_DOUBLE_MATH && !defined __UCLIBC_HAS_LONG_DOUBLE_MATH__ +# define __NO_LONG_DOUBLE_MATH 1 +#endif diff --git a/libc/sysdeps/linux/sparc64/bits/mathinline.h b/libc/sysdeps/linux/sparc64/bits/mathinline.h new file mode 100644 index 000000000..8bb35f6d8 --- /dev/null +++ b/libc/sysdeps/linux/sparc64/bits/mathinline.h @@ -0,0 +1,197 @@ +/* Inline math functions for SPARC. + Copyright (C) 1999, 2000, 2001, 2002, 2004, 2006 + Free Software Foundation, Inc. + Contributed by Jakub Jelinek . + + 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, see + . */ + +#ifndef _MATH_H +# error "Never use directly; include instead." +#endif + +#ifdef __GNUC__ + +#if defined __USE_ISOC99 && !__GNUC_PREREQ (3, 0) +# undef isgreater +# undef isgreaterequal +# undef isless +# undef islessequal +# undef islessgreater +# undef isunordered + +# define __unordered_v9cmp(x, y, op, qop) \ + (__extension__ \ + ({ unsigned __r; \ + if (sizeof (x) == 4 && sizeof (y) == 4) \ + { \ + float __x = (x); float __y = (y); \ + __asm__ ("fcmps\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0" \ + : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc"); \ + } \ + else if (sizeof (x) <= 8 && sizeof (y) <= 8) \ + { \ + double __x = (x); double __y = (y); \ + __asm__ ("fcmpd\t%%fcc3,%1,%2\n\tmov" op "\t%%fcc3,1,%0" \ + : "=r" (__r) : "f" (__x), "f" (__y), "0" (0) : "cc"); \ + } \ + else \ + { \ + long double __x = (x); long double __y = (y); \ + extern int _Qp_cmp (const long double *a, const long double *b); \ + __r = qop; \ + } \ + __r; })) + +# define isgreater(x, y) __unordered_v9cmp(x, y, "g", _Qp_cmp (&__x, &__y) == 2) +# define isgreaterequal(x, y) __unordered_v9cmp(x, y, "ge", (_Qp_cmp (&__x, &__y) & 1) == 0) +# define isless(x, y) __unordered_v9cmp(x, y, "l", _Qp_cmp (&__x, &__y) == 1) +# define islessequal(x, y) __unordered_v9cmp(x, y, "le", (_Qp_cmp (&__x, &__y) & 2) == 0) +# define islessgreater(x, y) __unordered_v9cmp(x, y, "lg", ((_Qp_cmp (&__x, &__y) + 1) & 2) != 0) +# define isunordered(x, y) __unordered_v9cmp(x, y, "u", _Qp_cmp (&__x, &__y) == 3) + +#endif /* __USE_ISOC99 */ + +#if (!defined __NO_MATH_INLINES || defined __LIBC_INTERNAL_MATH_INLINES) && defined __OPTIMIZE__ + +# ifdef __cplusplus +# define __MATH_INLINE __inline +# else +# define __MATH_INLINE __extern_inline +# endif /* __cplusplus */ + +/* The gcc, version 2.7 or below, has problems with all this inlining + code. So disable it for this version of the compiler. */ +# if __GNUC_PREREQ (2, 8) + +# ifdef __USE_ISOC99 + +/* Test for negative number. Used in the signbit() macro. */ +__MATH_INLINE int +__NTH (__signbitf (float __x)) +{ + __extension__ union { float __f; int __i; } __u = { __f: __x }; + return __u.__i < 0; +} + +__MATH_INLINE int +__NTH (__signbit (double __x)) +{ + __extension__ union { double __d; long int __i; } __u = { __d: __x }; + return __u.__i < 0; +} + +__MATH_INLINE int +__NTH (__signbitl (long double __x)) +{ + __extension__ union { long double __l; long int __i[2]; } __u = { __l: __x }; + return __u.__i[0] < 0; +} + +# endif /* __USE_ISOC99 */ + +# if !defined __NO_MATH_INLINES && !__GNUC_PREREQ (3, 2) + +__MATH_INLINE double +__NTH (sqrt (double __x)) +{ + register double __r; + __asm__ ("fsqrtd %1,%0" : "=f" (__r) : "f" (__x)); + return __r; +} + +__MATH_INLINE float +__NTH (sqrtf (float __x)) +{ + register float __r; + __asm__ ("fsqrts %1,%0" : "=f" (__r) : "f" (__x)); + return __r; +} + +__MATH_INLINE long double +__NTH (sqrtl (long double __x)) +{ + long double __r; + extern void _Qp_sqrt (long double *, __const__ long double *); + _Qp_sqrt (&__r, &__x); + return __r; +} +# elif !defined __NO_LONG_DOUBLE_MATH +__MATH_INLINE long double +sqrtl (long double __x) __THROW +{ + extern long double _Q_sqrt (__const__ long double); + return _Q_sqrt (__x); +} + +# endif /* !__NO_MATH_INLINES && !GCC 3.2+ */ + +/* This code is used internally in the GNU libc. */ +# ifdef __LIBC_INTERNAL_MATH_INLINES +__MATH_INLINE double +__ieee754_sqrt (double __x) +{ + register double __r; + __asm__ ("fsqrtd %1,%0" : "=f" (__r) : "f" (__x)); + return __r; +} + +__MATH_INLINE float +__ieee754_sqrtf (float __x) +{ + register float __r; + __asm__ ("fsqrts %1,%0" : "=f" (__r) : "f" (__x)); + return __r; +} + +__MATH_INLINE long double +__ieee754_sqrtl (long double __x) +{ + long double __r; + extern void _Qp_sqrt (long double *, __const__ long double *); + _Qp_sqrt(&__r, &__x); + return __r; +} +# elif !defined __NO_LONG_DOUBLE_MATH +__MATH_INLINE long double +__ieee754_sqrtl (long double __x) +{ + extern long double _Q_sqrt (__const__ long double); + return _Q_sqrt (__x); +} +# endif /* __LIBC_INTERNAL_MATH_INLINES */ +# endif /* gcc 2.8+ */ + +# ifdef __USE_ISOC99 + +# ifndef __NO_MATH_INLINES + +__MATH_INLINE double __NTH (fdim (double __x, double __y)); +__MATH_INLINE double +__NTH (fdim (double __x, double __y)) +{ + return __x <= __y ? 0 : __x - __y; +} + +__MATH_INLINE float __NTH (fdimf (float __x, float __y)); +__MATH_INLINE float +__NTH (fdimf (float __x, float __y)) +{ + return __x <= __y ? 0 : __x - __y; +} + +# endif /* !__NO_MATH_INLINES */ +# endif /* __USE_ISOC99 */ +#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */ +#endif /* __GNUC__ */ diff --git a/libc/sysdeps/linux/sparc64/bits/mman.h b/libc/sysdeps/linux/sparc64/bits/mman.h new file mode 100644 index 000000000..9ac2b7011 --- /dev/null +++ b/libc/sysdeps/linux/sparc64/bits/mman.h @@ -0,0 +1,106 @@ +/* Definitions for POSIX memory map interface. Linux/SPARC version. + Copyright (C) 1997,1999,2000,2003,2005,2006 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, see + . */ + +#ifndef _SYS_MMAN_H +# error "Never use directly; include 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. */ +#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of + growsdown vma (mprotect only). */ +#define PROT_GROWSUP 0x02000000 /* Extend change to start of + growsup vma (mprotect only). */ + +/* 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 0x00 +# define MAP_ANONYMOUS 0x20 /* Don't use a file. */ +# define MAP_ANON MAP_ANONYMOUS +# define MAP_RENAME MAP_ANONYMOUS +#endif + +/* These are Linux-specific. */ +#ifdef __USE_MISC +# define MAP_GROWSDOWN 0x0200 /* Stack-like segment. */ +# define MAP_DENYWRITE 0x0800 /* ETXTBSY */ +# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */ +# define MAP_LOCKED 0x0100 /* Lock the mapping. */ +# define MAP_NORESERVE 0x0040 /* Don't check for reservations. */ +# define _MAP_NEW 0x80000000 /* Binary compatibility with SunOS. */ +# define MAP_POPULATE 0x8000 /* Populate (prefault) pagetables. */ +# define MAP_NONBLOCK 0x10000 /* Do not block on IO. */ +# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could + be uninitialized. */ +#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 0x2000 /* Lock all currently mapped pages. */ +#define MCL_FUTURE 0x4000 /* Lock all additions to address + space. */ + +/* Flags for `mremap'. */ +#ifdef __USE_GNU +# define MREMAP_MAYMOVE 1 +# define MREMAP_FIXED 2 +#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. */ +# define MADV_FREE 5 /* Content can be freed (Solaris). */ +# define MADV_REMOVE 9 /* Remove these pages and resources. */ +# define MADV_DONTFORK 10 /* Do not inherit across fork. */ +# define MADV_DOFORK 11 /* Do inherit across fork. */ +#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 diff --git a/libc/sysdeps/linux/sparc64/bits/msq.h b/libc/sysdeps/linux/sparc64/bits/msq.h new file mode 100644 index 000000000..f514e442c --- /dev/null +++ b/libc/sysdeps/linux/sparc64/bits/msq.h @@ -0,0 +1,72 @@ +/* Copyright (C) 1995, 1996, 1997, 2000 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, see + . */ + +#ifndef _SYS_MSG_H +# error "Never use directly; include instead." +#endif + +#include + +/* Define options for message queue functions. */ +#define MSG_NOERROR 010000 /* no error if message is too big */ +#ifdef __USE_GNU +# define MSG_EXCEPT 020000 /* recv any msg except of specified type */ +#endif + +/* Types used in the structure definition. */ +typedef unsigned long int msgqnum_t; +typedef unsigned long int msglen_t; + + +/* Structure of record for one message inside the kernel. + The type `struct msg' is opaque. */ +struct msqid_ds +{ + struct ipc_perm msg_perm; /* structure describing operation permission */ + __time_t msg_stime; /* time of last msgsnd command */ + __time_t msg_rtime; /* time of last msgrcv command */ + __time_t msg_ctime; /* time of last change */ + unsigned long int __msg_cbytes; /* current number of bytes on queue */ + msgqnum_t msg_qnum; /* number of messages currently on queue */ + msglen_t msg_qbytes; /* max number of bytes allowed on queue */ + __pid_t msg_lspid; /* pid of last msgsnd() */ + __pid_t msg_lrpid; /* pid of last msgrcv() */ + unsigned long int __unused1; + unsigned long int __unused2; +}; + +#ifdef __USE_MISC + +# define msg_cbytes __msg_cbytes + +/* ipcs ctl commands */ +# define MSG_STAT 11 +# define MSG_INFO 12 + +/* buffer for msgctl calls IPC_INFO, MSG_INFO */ +struct msginfo + { + int msgpool; + int msgmap; + int msgmax; + int msgmnb; + int msgmni; + int msgssz; + int msgtql; + unsigned short int msgseg; + }; + +#endif /* __USE_MISC */ diff --git a/libc/sysdeps/linux/sparc64/bits/poll.h b/libc/sysdeps/linux/sparc64/bits/poll.h new file mode 100644 index 000000000..b6ebbb4c4 --- /dev/null +++ b/libc/sysdeps/linux/sparc64/bits/poll.h @@ -0,0 +1,48 @@ +/* Copyright (C) 1997, 2001, 2006 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, see + . */ + +#ifndef _SYS_POLL_H +# error "Never use directly; include instead." +#endif + +/* Event types that can be polled for. These bits may be set in `events' + to indicate the interesting event types; they will appear in `revents' + to indicate the status of the file descriptor. */ +#define POLLIN 0x001 /* There is data to read. */ +#define POLLPRI 0x002 /* There is urgent data to read. */ +#define POLLOUT 0x004 /* Writing now will not block. */ + +#ifdef __USE_XOPEN +/* These values are defined in XPG4.2. */ +# define POLLRDNORM 0x040 /* Normal data may be read. */ +# define POLLRDBAND 0x080 /* Priority data may be read. */ +# define POLLWRNORM POLLOUT /* Writing now will not block. */ +# define POLLWRBAND 0x100 /* Priority data may be written. */ +#endif + +#ifdef __USE_GNU +/* These are extensions for Linux. */ +# define POLLMSG 0x200 +# define POLLREMOVE 0x400 +# define POLLRDHUP 0x800 +#endif + +/* Event types always implicitly polled for. These bits need not be set in + `events', but they will appear in `revents' to indicate the status of + the file descriptor. */ +#define POLLERR 0x008 /* Error condition. */ +#define POLLHUP 0x010 /* Hung up. */ +#define POLLNVAL 0x020 /* Invalid polling request. */ diff --git a/libc/sysdeps/linux/sparc64/bits/resource.h b/libc/sysdeps/linux/sparc64/bits/resource.h new file mode 100644 index 000000000..366e5c2d9 --- /dev/null +++ b/libc/sysdeps/linux/sparc64/bits/resource.h @@ -0,0 +1,239 @@ +/* Bit values & structures for resource limits. Linux/SPARC version. + Copyright (C) 1994, 1996, 1997, 1998, 1999, 2000, 2004, 2005 + 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, see + . */ + +#ifndef _SYS_RESOURCE_H +# error "Never use directly; include instead." +#endif + +#include + +/* Transmute defines to enumerations. The macro re-definitions are + necessary because some programs want to test for operating system + features with #ifdef RUSAGE_SELF. In ISO C the reflexive + definition is a no-op. */ + +/* Kinds of resource limit. */ +enum __rlimit_resource +{ + /* Per-process CPU limit, in seconds. */ + RLIMIT_CPU = 0, +#define RLIMIT_CPU RLIMIT_CPU + + /* Largest file that can be created, in bytes. */ + RLIMIT_FSIZE = 1, +#define RLIMIT_FSIZE RLIMIT_FSIZE + + /* Maximum size of data segment, in bytes. */ + RLIMIT_DATA = 2, +#define RLIMIT_DATA RLIMIT_DATA + + /* Maximum size of stack segment, in bytes. */ + RLIMIT_STACK = 3, +#define RLIMIT_STACK RLIMIT_STACK + + /* Largest core file that can be created, in bytes. */ + RLIMIT_CORE = 4, +#define RLIMIT_CORE RLIMIT_CORE + + /* Largest resident set size, in bytes. + This affects swapping; processes that are exceeding their + resident set size will be more likely to have physical memory + taken from them. */ + __RLIMIT_RSS = 5, +#define RLIMIT_RSS __RLIMIT_RSS + + /* Number of open files. */ + RLIMIT_NOFILE = 6, + __RLIMIT_OFILE = RLIMIT_NOFILE, /* BSD name for same. */ +#define RLIMIT_NOFILE RLIMIT_NOFILE +#define RLIMIT_OFILE __RLIMIT_OFILE + + /* Address space limit (?) */ + RLIMIT_AS = 9, +#define RLIMIT_AS RLIMIT_AS + + /* Number of processes. */ + __RLIMIT_NPROC = 7, +#define RLIMIT_NPROC __RLIMIT_NPROC + + /* Locked-in-memory address space. */ + __RLIMIT_MEMLOCK = 8, +#define RLIMIT_MEMLOCK __RLIMIT_MEMLOCK + + /* Maximum number of file locks. */ + __RLIMIT_LOCKS = 10, +#define RLIMIT_LOCKS __RLIMIT_LOCKS + + /* Maximum number of pending signals. */ + __RLIMIT_SIGPENDING = 11, +#define RLIMIT_SIGPENDING __RLIMIT_SIGPENDING + + /* Maximum bytes in POSIX message queues. */ + __RLIMIT_MSGQUEUE = 12, +#define RLIMIT_MSGQUEUE __RLIMIT_MSGQUEUE + + /* Maximum nice priority allowed to raise to. + Nice levels 19 .. -20 correspond to 0 .. 39 + values of this resource limit. */ + __RLIMIT_NICE = 13, +#define RLIMIT_NICE __RLIMIT_NICE + + /* Maximum realtime priority allowed for non-priviledged + processes. */ + __RLIMIT_RTPRIO = 14, +#define RLIMIT_RTPRIO __RLIMIT_RTPRIO + + __RLIMIT_NLIMITS = 15, + __RLIM_NLIMITS = __RLIMIT_NLIMITS +#define RLIMIT_NLIMITS __RLIMIT_NLIMITS +#define RLIM_NLIMITS __RLIM_NLIMITS +}; + +/* Value to indicate that there is no limit. */ +#if __WORDSIZE == 64 + +#ifndef __USE_FILE_OFFSET64 +# define RLIM_INFINITY ((unsigned long int)(~0UL)) +#else +# define RLIM_INFINITY 0xffffffffffffffffuLL +#endif + +#ifdef __USE_LARGEFILE64 +# define RLIM64_INFINITY 0xffffffffffffffffuLL +#endif + +#else + +#ifndef __USE_FILE_OFFSET64 +# define RLIM_INFINITY ((long int)(~0UL >> 1)) +#else +# define RLIM_INFINITY 0x7fffffffffffffffLL +#endif + +#ifdef __USE_LARGEFILE64 +# define RLIM64_INFINITY 0x7fffffffffffffffLL +#endif + +#endif + +/* We can represent all limits. */ +#define RLIM_SAVED_MAX RLIM_INFINITY +#define RLIM_SAVED_CUR RLIM_INFINITY + + +/* Type for resource quantity measurement. */ +#ifndef __USE_FILE_OFFSET64 +typedef __rlim_t rlim_t; +#else +typedef __rlim64_t rlim_t; +#endif +#ifdef __USE_LARGEFILE64 +typedef __rlim64_t rlim64_t; +#endif + +struct rlimit + { + /* The current (soft) limit. */ + rlim_t rlim_cur; + /* The hard limit. */ + rlim_t rlim_max; + }; + +#ifdef __USE_LARGEFILE64 +struct rlimit64 + { + /* The current (soft) limit. */ + rlim64_t rlim_cur; + /* The hard limit. */ + rlim64_t rlim_max; + }; +#endif + +/* Whose usage statistics do you want? */ +enum __rusage_who +{ + /* The calling process. */ + RUSAGE_SELF = 0, +#define RUSAGE_SELF RUSAGE_SELF + + /* All of its terminated child processes. */ + RUSAGE_CHILDREN = -1 +#define RUSAGE_CHILDREN RUSAGE_CHILDREN +}; + +#define __need_timeval +#include /* For `struct timeval'. */ + +/* Structure which says how much of each resource has been used. */ +struct rusage + { + /* Total amount of user time used. */ + struct timeval ru_utime; + /* Total amount of system time used. */ + struct timeval ru_stime; + /* Maximum resident set size (in kilobytes). */ + long int ru_maxrss; + /* Amount of sharing of text segment memory + with other processes (kilobyte-seconds). */ + long int ru_ixrss; + /* Amount of data segment memory used (kilobyte-seconds). */ + long int ru_idrss; +