summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Anderberg <tobias.anderberg@axis.com>2002-09-16 08:08:37 +0000
committerTobias Anderberg <tobias.anderberg@axis.com>2002-09-16 08:08:37 +0000
commit35df59db508dbf23437f3253f25147191796e19f (patch)
tree59047d1c78611a04816d17cb8182666e1ae4b3b1
parentda6874a62e91b80e39cfd8f20a5b9d36ec28db0b (diff)
Initial version of the CRIS port.
-rw-r--r--libc/sysdeps/linux/cris/Makefile59
-rw-r--r--libc/sysdeps/linux/cris/__init_brk.c32
-rw-r--r--libc/sysdeps/linux/cris/__longjmp.S40
-rw-r--r--libc/sysdeps/linux/cris/bits/byteswap.h47
-rw-r--r--libc/sysdeps/linux/cris/bits/endian.h7
-rw-r--r--libc/sysdeps/linux/cris/bits/fcntl.h141
-rw-r--r--libc/sysdeps/linux/cris/bits/huge_val.h81
-rw-r--r--libc/sysdeps/linux/cris/bits/kernel_stat.h80
-rw-r--r--libc/sysdeps/linux/cris/bits/kernel_types.h45
-rw-r--r--libc/sysdeps/linux/cris/bits/mathcalls.h333
-rw-r--r--libc/sysdeps/linux/cris/bits/mman.h93
-rw-r--r--libc/sysdeps/linux/cris/bits/setjmp.h64
-rw-r--r--libc/sysdeps/linux/cris/bits/shm.h84
-rw-r--r--libc/sysdeps/linux/cris/bits/syscalls.h10
-rw-r--r--libc/sysdeps/linux/cris/bits/wordsize.h19
-rw-r--r--libc/sysdeps/linux/cris/brk.c31
-rw-r--r--libc/sysdeps/linux/cris/crt0.c49
-rw-r--r--libc/sysdeps/linux/cris/fork.c10
-rw-r--r--libc/sysdeps/linux/cris/ipc.c4
-rw-r--r--libc/sysdeps/linux/cris/libc.map3
-rw-r--r--libc/sysdeps/linux/cris/sbrk.c36
-rw-r--r--libc/sysdeps/linux/cris/setjmp.S76
-rw-r--r--libc/sysdeps/linux/cris/sys/ucontext.h95
-rw-r--r--libc/sysdeps/linux/cris/syscall-cris.c41
-rw-r--r--libc/sysdeps/linux/cris/syscall.S18
-rw-r--r--libc/sysdeps/linux/cris/sysdep.h125
-rw-r--r--libc/sysdeps/linux/cris/vfork.c11
27 files changed, 1634 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/cris/Makefile b/libc/sysdeps/linux/cris/Makefile
new file mode 100644
index 000000000..398139be5
--- /dev/null
+++ b/libc/sysdeps/linux/cris/Makefile
@@ -0,0 +1,59 @@
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+TOPDIR=../../../../
+include $(TOPDIR)Rules.mak
+ASFLAGS=$(CFLAGS)
+
+CRT0=crt0.c
+CRT0_OBJ=$(patsubst %.c,%.o, $(CRT0))
+
+SSRC= setjmp.S __longjmp.S
+ifeq ($(UNIFIED_SYSCALL),true)
+ SSRC += __uClibc_syscall.S
+endif
+SOBJS=$(patsubst %.S,%.o, $(SSRC))
+
+CSRC= __init_brk.c brk.c sbrk.c vfork.c
+COBJS=$(patsubst %.c,%.o, $(CSRC))
+
+OBJS=$(SOBJS) $(COBJS)
+
+
+all: $(OBJS) $(LIBC)
+
+$(LIBC): ar-target
+
+ar-target: $(OBJS) $(CRT0_OBJ)
+ $(AR) $(ARFLAGS) $(LIBC) $(OBJS)
+ cp $(CRT0_OBJ) $(TOPDIR)libc/$(CRT0_OBJ)
+
+$(CRT0_OBJ): %.o : %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+ $(STRIPTOOL) -x -R .note -R .comment $*.o
+
+$(SOBJS): %.o : %.S
+ $(CC) $(CFLAGS) -c $< -o $@
+ $(STRIPTOOL) -x -R .note -R .comment $*.o
+
+$(COBJS): %.o : %.c
+ $(CC) $(CFLAGS) -c $< -o $@
+ $(STRIPTOOL) -x -R .note -R .comment $*.o
+
+headers:
+ @(TOPDIR=$(TOPDIR) CC=$(CC) /bin/sh $(TOPDIR)/extra/scripts/gen_bits_syscall_h.sh > bits/syscall.h )
+
+clean:
+ rm -f *.[oa] *~ core
+
diff --git a/libc/sysdeps/linux/cris/__init_brk.c b/libc/sysdeps/linux/cris/__init_brk.c
new file mode 100644
index 000000000..0f5624b85
--- /dev/null
+++ b/libc/sysdeps/linux/cris/__init_brk.c
@@ -0,0 +1,32 @@
+/* From libc-5.3.12 */
+
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <errno.h>
+#include "sysdep.h"
+
+void * ___brk_addr = 0;
+
+int
+__init_brk (void)
+{
+ if (___brk_addr == 0) {
+ /* Notice that we don't need to save/restore the GOT
+ * register since that is not call clobbered by the syscall
+ */
+
+ asm ("clear.d $r10\n\t"
+ "movu.w " STR(__NR_brk) ",$r9\n\t"
+ "break 13\n\t"
+ "move.d $r10, %0"
+ : "=r" (___brk_addr)
+ :
+ : "r9", "r10");
+
+ if (___brk_addr == 0) {
+ __set_errno(ENOMEM);
+ return -1;
+ }
+ }
+ return 0;
+}
diff --git a/libc/sysdeps/linux/cris/__longjmp.S b/libc/sysdeps/linux/cris/__longjmp.S
new file mode 100644
index 000000000..98472a673
--- /dev/null
+++ b/libc/sysdeps/linux/cris/__longjmp.S
@@ -0,0 +1,40 @@
+/* longjmp for CRIS.
+ 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 Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sysdep.h>
+#define _SETJMP_H
+#define _ASM
+#include <bits/setjmp.h>
+
+/* Saving and restoring CCR is meaningless, so we don't do it. */
+ENTRY (__longjmp)
+ /* Note that r10 = jmp_buf, r11 = retval. */
+ move [$r10+16*4],$srp
+ test.d $r11
+ beq 0f /* Already a 1 in place. */
+ nop
+ /* Offset for r9, the return value (see setjmp). */
+ move.d $r11,[$r10+6*4]
+0:
+ movem [$r10],$pc
+END (__longjmp)
+
+ .weak longjmp
+ longjmp = __longjmp
+
diff --git a/libc/sysdeps/linux/cris/bits/byteswap.h b/libc/sysdeps/linux/cris/bits/byteswap.h
new file mode 100644
index 000000000..60544a0ad
--- /dev/null
+++ b/libc/sysdeps/linux/cris/bits/byteswap.h
@@ -0,0 +1,47 @@
+#define ___swab16(x) \
+({ \
+ unsigned short __x = (x); \
+ ((unsigned short)( \
+ (((unsigned short)(__x) & (unsigned short)0x00ffU) << 8) | \
+ (((unsigned short)(__x) & (unsigned short)0xff00U) >> 8) )); \
+})
+
+#define ___swab32(x) \
+({ \
+ unsigned long __x = (x); \
+ ((unsigned long)( \
+ (((unsigned long)(__x) & (unsigned long)0x000000ffUL) << 24) | \
+ (((unsigned long)(__x) & (unsigned long)0x0000ff00UL) << 8) | \
+ (((unsigned long)(__x) & (unsigned long)0x00ff0000UL) >> 8) | \
+ (((unsigned long)(__x) & (unsigned long)0xff000000UL) >> 24) )); \
+})
+
+/* these are CRIS specific */
+
+static inline unsigned short __fswab16(unsigned short x)
+{
+ __asm__ ("swapb %0" : "=r" (x) : "0" (x));
+
+ return(x);
+}
+
+static inline unsigned long __fswab32(unsigned long x)
+{
+ __asm__ ("swapwb %0" : "=r" (x) : "0" (x));
+
+ return(x);
+}
+
+# define __bswap_16(x) \
+(__builtin_constant_p((unsigned short)(x)) ? \
+ ___swab16((x)) : \
+ __fswab16((x)))
+
+# define __bswap_32(x) \
+(__builtin_constant_p((unsigned long)(x)) ? \
+ ___swab32((x)) : \
+ __fswab32((x)))
+
+
+
+
diff --git a/libc/sysdeps/linux/cris/bits/endian.h b/libc/sysdeps/linux/cris/bits/endian.h
new file mode 100644
index 000000000..90e290b92
--- /dev/null
+++ b/libc/sysdeps/linux/cris/bits/endian.h
@@ -0,0 +1,7 @@
+/* cris is little-endian. */
+
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
+#define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/libc/sysdeps/linux/cris/bits/fcntl.h b/libc/sysdeps/linux/cris/bits/fcntl.h
new file mode 100644
index 000000000..d47a66191
--- /dev/null
+++ b/libc/sysdeps/linux/cris/bits/fcntl.h
@@ -0,0 +1,141 @@
+/* O_*, F_*, FD_* bit values for Linux.
+ Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _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
+# define O_LARGEFILE 0100000
+#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). */
+
+/* XXX missing */
+#define F_GETLK64 5 /* Get record locking info. */
+#define F_SETLK64 6 /* Set record locking info (non-blocking). */
+#define F_SETLKW64 7 /* Set record locking info (blocking). */
+
+#ifdef __USE_BSD
+# 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
+
+/* 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
+
+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. */
+ };
+
+#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. */
diff --git a/libc/sysdeps/linux/cris/bits/huge_val.h b/libc/sysdeps/linux/cris/bits/huge_val.h
new file mode 100644
index 000000000..43f576d8a
--- /dev/null
+++ b/libc/sysdeps/linux/cris/bits/huge_val.h
@@ -0,0 +1,81 @@
+/* `HUGE_VAL' constants for ix86 (where it is infinity).
+ Used by <stdlib.h> and <math.h> functions for overflow.
+ Copyright (C) 1992, 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _MATH_H
+# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
+#endif
+
+#include <features.h>
+
+/* IEEE positive infinity (-HUGE_VAL is negative infinity). */
+
+#if __GNUC_PREREQ(2,96)
+# define HUGE_VAL (__extension__ 0x1.0p2047)
+#else
+# define __HUGE_VAL_bytes { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
+
+# define __huge_val_t union { unsigned char __c[8]; double __d; }
+# ifdef __GNUC__
+# define HUGE_VAL (__extension__ \
+ ((__huge_val_t) { __c: __HUGE_VAL_bytes }).__d)
+# else /* Not GCC. */
+static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
+# define HUGE_VAL (__huge_val.__d)
+# endif /* GCC. */
+#endif /* GCC 2.95 */
+
+
+/* ISO C99 extensions: (float) HUGE_VALF and (long double) HUGE_VALL. */
+
+#ifdef __USE_ISOC99
+
+# if __GNUC_PREREQ(2,96)
+
+# define HUGE_VALF (__extension__ 0x1.0p255f)
+# define HUGE_VALL (__extension__ 0x1.0p32767L)
+
+# else
+
+# define __HUGE_VALF_bytes { 0, 0, 0x80, 0x7f }
+
+# define __huge_valf_t union { unsigned char __c[4]; float __f; }
+# ifdef __GNUC__
+# define HUGE_VALF (__extension__ \
+ ((__huge_valf_t) { __c: __HUGE_VALF_bytes }).__f)
+# else /* Not GCC. */
+static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
+# define HUGE_VALF (__huge_valf.__f)
+# endif /* GCC. */
+
+
+# define __HUGE_VALL_bytes { 0, 0, 0, 0, 0, 0, 0, 0x80, 0xff, 0x7f, 0, 0 }
+
+# define __huge_vall_t union { unsigned char __c[12]; long double __ld; }
+# ifdef __GNUC__
+# define HUGE_VALL (__extension__ \
+ ((__huge_vall_t) { __c: __HUGE_VALL_bytes }).__ld)
+# else /* Not GCC. */
+static __huge_vall_t __huge_vall = { __HUGE_VALL_bytes };
+# define HUGE_VALL (__huge_vall.__ld)
+# endif /* GCC. */
+
+# endif /* GCC 2.95 */
+
+#endif /* __USE_ISOC99. */
diff --git a/libc/sysdeps/linux/cris/bits/kernel_stat.h b/libc/sysdeps/linux/cris/bits/kernel_stat.h
new file mode 100644
index 000000000..5f0c0f4fe
--- /dev/null
+++ b/libc/sysdeps/linux/cris/bits/kernel_stat.h
@@ -0,0 +1,80 @@
+/* Taken from linux/include/asm-cris/stat.h */
+
+#ifndef _CRIS_STAT_H
+#define _CRIS_STAT_H
+
+struct __old_kernel_stat {
+ unsigned short st_dev;
+ unsigned short st_ino;
+ unsigned short st_mode;
+ unsigned short st_nlink;
+ unsigned short st_uid;
+ unsigned short st_gid;
+ unsigned short st_rdev;
+ unsigned long st_size;
+ unsigned long st_atime;
+ unsigned long st_mtime;
+ unsigned long st_ctime;
+};
+
+struct stat {
+ unsigned short st_dev;
+ unsigned short __pad1;
+ unsigned long st_ino;
+ unsigned short st_mode;
+ unsigned short st_nlink;
+ unsigned short st_uid;
+ unsigned short st_gid;
+ unsigned short st_rdev;
+ unsigned short __pad2;
+ unsigned long st_size;
+ unsigned long st_blksize;
+ unsigned long st_blocks;
+ unsigned long st_atime;
+ unsigned long __unused1;
+ unsigned long st_mtime;
+ unsigned long __unused2;
+ unsigned long st_ctime;
+ unsigned long __unused3;
+ unsigned long __unused4;
+ unsigned long __unused5;
+};
+
+/* This matches struct stat64 in glibc2.1, hence the absolutely
+ * insane amounts of padding around dev_t's.
+ */
+struct stat64 {
+ unsigned short st_dev;
+ unsigned char __pad0[10];
+
+#define STAT64_HAS_BROKEN_ST_INO 1
+ unsigned long __st_ino;
+
+ unsigned int st_mode;
+ unsigned int st_nlink;
+
+ unsigned long st_uid;
+ unsigned long st_gid;
+
+ unsigned short st_rdev;
+ unsigned char __pad3[10];
+
+ long long st_size;
+ unsigned long st_blksize;
+
+ unsigned long st_blocks; /* Number 512-byte blocks allocated. */
+ unsigned long __pad4; /* future possible st_blocks high bits */
+
+ unsigned long st_atime;
+ unsigned long __pad5;
+
+ unsigned long st_mtime;
+ unsigned long __pad6;
+
+ unsigned long st_ctime;
+ unsigned long __pad7; /* will be high 32 bits of ctime someday */
+
+ unsigned long long st_ino;
+};
+
+#endif
diff --git a/libc/sysdeps/linux/cris/bits/kernel_types.h b/libc/sysdeps/linux/cris/bits/kernel_types.h
new file mode 100644
index 000000000..e5cdacc7b
--- /dev/null
+++ b/libc/sysdeps/linux/cris/bits/kernel_types.h
@@ -0,0 +1,45 @@
+/* Taken from linux/include/asm-cris/posix_types.h */
+
+#ifndef __ARCH_CRIS_POSIX_TYPES_H
+#define __ARCH_CRIS_POSIX_TYPES_H
+
+typedef unsigned short __kernel_dev_t;
+typedef unsigned long __kernel_ino_t;
+typedef unsigned short __kernel_mode_t;
+typedef unsigned short __kernel_nlink_t;
+typedef long __kernel_off_t;
+typedef int __kernel_pid_t;
+typedef unsigned short __kernel_ipc_pid_t;
+typedef unsigned short __kernel_uid_t;
+typedef unsigned short __kernel_gid_t;
+typedef unsigned long __kernel_size_t;
+typedef long __kernel_ssize_t;
+typedef int __kernel_ptrdiff_t;
+typedef long __kernel_time_t;
+typedef long __kernel_suseconds_t;
+typedef long __kernel_clock_t;
+typedef int __kernel_daddr_t;
+typedef char * __kernel_caddr_t;
+typedef unsigned short __kernel_uid16_t;
+typedef unsigned short __kernel_gid16_t;
+typedef unsigned int __kernel_uid32_t;
+typedef unsigned int __kernel_gid32_t;
+
+typedef unsigned short __kernel_old_uid_t;
+typedef unsigned short __kernel_old_gid_t;
+
+#ifdef __GNUC__
+typedef long long __kernel_loff_t;
+#endif
+
+typedef struct {
+#if defined(__USE_ALL)
+ int val[2];
+#else
+ int __val[2];
+#endif
+} __kernel_fsid_t;
+
+/* should this ifdef be here ? */
+
+#endif /* __ARCH_CRIS_POSIX_TYPES_H */
diff --git a/libc/sysdeps/linux/cris/bits/mathcalls.h b/libc/sysdeps/linux/cris/bits/mathcalls.h
new file mode 100644
index 000000000..c1181f737
--- /dev/null
+++ b/libc/sysdeps/linux/cris/bits/mathcalls.h
@@ -0,0 +1,333 @@
+/* Prototype declarations for math functions; helper file for <math.h>.
+ Copyright (C) 1996,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. */
+
+/* NOTE: Because of the special way this file is used by <math.h>, this
+ file must NOT be protected from multiple inclusion as header files
+ usually are.
+
+ This file provides prototype declarations for the math functions.
+ Most functions are declared using the macro:
+
+ __MATHCALL (NAME,[_r], (ARGS...));
+
+ This means there is a function `NAME' returning `double' and a function
+ `NAMEf' returning `float'. Each place `_Mdouble_' appears in the
+ prototype, that is actually `double' in the prototype for `NAME' and
+ `float' in the prototype for `NAMEf'. Reentrant variant functions are
+ called `NAME_r' and `NAMEf_r'.
+
+ Functions returning other types like `int' are declared using the macro:
+
+ __MATHDECL (TYPE, NAME,[_r], (ARGS...));
+
+ This is just like __MATHCALL but for a function returning `TYPE'
+ instead of `_Mdouble_'. In all of these cases, there is still
+ both a `NAME' and a `NAMEf' that takes `float' arguments.
+
+ Note that there must be no whitespace before the argument passed for
+ NAME, to make token pasting work with -traditional. */
+
+#ifndef _MATH_H
+ #error "Never include <bits/mathcalls.h> directly; include <math.h> instead."
+#endif
+
+
+/* Trigonometric functions. */
+
+/* Arc cosine of X. */
+__MATHCALL (acos,, (_Mdouble_ __x));
+/* Arc sine of X. */
+__MATHCALL (asin,, (_Mdouble_ __x));
+/* Arc tangent of X. */
+__MATHCALL (atan,, (_Mdouble_ __x));
+/* Arc tangent of Y/X. */
+__MATHCALL (atan2,, (_Mdouble_ __y, _Mdouble_ __x));
+
+/* Cosine of X. */
+__MATHCALL (cos,, (_Mdouble_ __x));
+/* Sine of X. */
+__MATHCALL (sin,, (_Mdouble_ __x));
+/* Tangent of X. */
+__MATHCALL (tan,, (_Mdouble_ __x));
+
+#ifdef __USE_GNU
+/* Cosine and sine of X. */
+__MATHDECL (void,sincos,,
+ (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx));
+#endif
+
+/* Hyperbolic functions. */
+
+/* Hyperbolic cosine of X. */
+__MATHCALL (cosh,, (_Mdouble_ __x));
+/* Hyperbolic sine of X. */
+__MATHCALL (sinh,, (_Mdouble_ __x));
+/* Hyperbolic tangent of X. */
+__MATHCALL (tanh,, (_Mdouble_ __x));
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
+/* Hyperbolic arc cosine of X. */
+__MATHCALL (acosh,, (_Mdouble_ __x));
+/* Hyperbolic arc sine of X. */
+__MATHCALL (asinh,, (_Mdouble_ __x));
+/* Hyperbolic arc tangent of X. */
+__MATHCALL (atanh,, (_Mdouble_ __x));
+#endif
+
+/* Exponential and logarithmic functions. */
+
+/* Exponential function of X. */
+__MATHCALL (exp,, (_Mdouble_ __x));
+
+#ifdef __USE_GNU
+/* A function missing in all standards: compute exponent to base ten. */
+__MATHCALL (exp10,, (_Mdouble_ __x));
+/* Another name occasionally used. */
+__MATHCALL (pow10,, (_Mdouble_ __x));
+#endif
+
+/* Break VALUE into a normalized fraction and an integral power of 2. */
+__MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent));
+
+/* X times (two to the EXP power). */
+__MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent));
+
+/* Natural logarithm of X. */
+__MATHCALL (log,, (_Mdouble_ __x));
+
+/* Base-ten logarithm of X. */
+__MATHCALL (log10,, (_Mdouble_ __x));
+
+/* Break VALUE into integral and fractional parts. */
+__MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr));
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
+/* Return exp(X) - 1. */
+__MATHCALL (expm1,, (_Mdouble_ __x));
+
+/* Return log(1 + X). */
+__MATHCALL (log1p,, (_Mdouble_ __x));
+
+/* Return the base 2 signed integral exponent of X. */
+__MATHCALL (logb,, (_Mdouble_ __x));
+#endif
+
+#ifdef __USE_ISOC99
+/* Compute base-2 exponential of X. */
+__MATHCALL (exp2,, (_Mdouble_ __x));
+
+/* Compute base-2 logarithm of X. */
+__MATHCALL (log2,, (_Mdouble_ __x));
+#endif
+
+
+/* Power functions. */
+
+/* Return X to the Y power. */
+__MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y));
+
+/* Return the square root of X. */
+__MATHCALL (sqrt,, (_Mdouble_ __x));
+
+#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
+/* Return `sqrt(X*X + Y*Y)'. */
+__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
+/* Return the cube root of X. */
+__MATHCALL (cbrt,, (_Mdouble_ __x));
+#endif
+
+
+/* Nearest integer, absolute value, and remainder functions. */
+
+/* Smallest integral value not less than X. */
+__MATHCALL (ceil,, (_Mdouble_ __x));
+
+/* Absolute value of X. */
+__MATHCALLX (fabs,, (_Mdouble_ __x), (__const__));
+
+/* Largest integer not greater than X. */
+__MATHCALL (floor,, (_Mdouble_ __x));
+
+/* Floating-point modulo remainder of X/Y. */
+__MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
+
+
+/* Return 0 if VALUE is finite or NaN, +1 if it
+ is +Infinity, -1 if it is -Infinity. */
+__MATHDECL_1 (int,__isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
+
+/* Return nonzero if VALUE is finite and not NaN. */
+__MATHDECL_1 (int,__finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
+
+#ifdef __USE_MISC
+/* Return 0 if VALUE is finite or NaN, +1 if it
+ is +Infinity, -1 if it is -Infinity. */
+__MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
+
+/* Return nonzero if VALUE is finite and not NaN. */
+__MATHDECL_1 (int,finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
+
+/* Return the remainder of X/Y. */
+__MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y));
+
+
+/* Return the fractional part of X after dividing out `ilogb (X)'. */
+__MATHCALL (significand,, (_Mdouble_ __x));
+#endif /* Use misc. */
+
+#if defined __USE_MISC || defined __USE_ISOC99
+/* Return X with its signed changed to Y's. */
+__MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
+#endif
+
+#ifdef __USE_ISOC99
+/* Return representation of NaN for double type. */
+__MATHCALLX (nan,, (__const char *__tagb), (__const__));
+#endif
+
+
+/* Return nonzero if VALUE is not a number. */
+__MATHDECL_1 (int,__isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
+
+#if defined __USE_MISC || defined __USE_XOPEN
+/* Return nonzero if VALUE is not a number. */
+__MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
+
+/* Bessel functions. */
+__MATHCALL (j0,, (_Mdouble_));
+__MATHCALL (j1,, (_Mdouble_));
+__MATHCALL (jn,, (int, _Mdouble_));
+__MATHCALL (y0,, (_Mdouble_));
+__MATHCALL (y1,, (_Mdouble_));
+__MATHCALL (yn,, (int, _Mdouble_));
+#endif
+
+
+#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
+/* Error and gamma functions. */
+__MATHCALL (erf,, (_Mdouble_));
+__MATHCALL (erfc,, (_Mdouble_));
+__MATHCALL (lgamma,, (_Mdouble_));
+#endif
+
+#ifdef __USE_ISOC99
+__MATHCALL (tgamma,, (_Mdouble_));
+#endif
+
+#if defined __USE_MISC || defined __USE_XOPEN
+/* Obsolete alias for `lgamma'. */
+__MATHCALL (gamma,, (_Mdouble_));
+#endif
+
+#ifdef __USE_MISC
+/* Reentrant version of lgamma. This function uses the global variable
+ `signgam'. The reentrant version instead takes a pointer and stores
+ the value through it. */
+__MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp));
+#endif
+
+
+#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
+/* Return the integer nearest X in the direction of the
+ prevailing rounding mode. */
+__MATHCALL (rint,, (_Mdouble_ __x));
+
+/* Return X + epsilon if X < Y, X - epsilon if X > Y. */
+__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
+# ifdef __USE_ISOC99
+__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__));
+# endif
+
+/* Return the remainder of integer divison X / Y with infinite precision. */
+__MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y));
+
+# if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
+/* Return X times (2 to the Nth power). */
+__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
+# endif
+
+# if defined __USE_MISC || defined __USE_ISOC99
+/* Return X times (2 to the Nth power). */
+__MATHCALL (scalbn,, (_Mdouble_ __x, int __n));
+# endif
+
+/* Return the binary exponent of X, which must be nonzero. */
+__MATHDECL (int,ilogb,, (_Mdouble_ __x));
+#endif
+
+#ifdef __USE_ISOC99
+/* Return X times (2 to the Nth power). */
+__MATHCALL (scalbln,, (_Mdoubl