Browse Source

Patch from George Thanos adding support for the "e1" architecture.

Eric Andersen 20 years ago
parent
commit
c7757f181f

+ 49 - 0
extra/Configs/Config.e1

@@ -0,0 +1,49 @@
+
+
+# For a description of the syntax of this configuration file,
+# see extra/config/Kconfig-language.txt
+#
+
+mainmenu "uClibc C Library Configuration"
+
+menu "Target Architecture Features and Options"
+
+config ARCH_E1 
+	bool
+	default y
+
+config HAVE_ELF
+	bool
+	default n
+
+config ARCH_CFLAGS
+	string
+	default "-I$(KERNEL_SOURCE)/include -mgnu-param" 
+
+#	--bitwise-or
+
+config ARCH_LDFLAGS
+	string
+
+config LIBGCC_CFLAGS
+	string
+
+config HAVE_ELF
+	bool
+	default n
+
+config ARCH_HAS_NO_MMU
+	bool
+	default y
+
+config ARCH_HAS_C_SYMBOL_PREFIX
+        bool
+        default y
+
+source "extra/Configs/Config.in.arch"
+
+endmenu
+
+source "extra/Configs/Config.in"
+
+

+ 64 - 0
extra/Configs/Config.e1.default

@@ -0,0 +1,64 @@
+#
+# Automatically generated make config: don't edit
+#
+
+#
+# Target Architecture Features and Options
+#
+# HAVE_ELF is not set
+ARCH_CFLAGS="-I$(KERNEL_SOURCE)/include -mgnu-param"
+ARCH_HAS_NO_MMU=y
+ARCH_HAS_C_SYMBOL_PREFIX=y
+UCLIBC_HAS_FLOATS=y
+# HAS_FPU is not set
+UCLIBC_HAS_SOFT_FLOAT=y
+# DO_C99_MATH is not set
+WARNINGS="-Wall"
+KERNEL_SOURCE="/usr/src/linux"
+UCLIBC_UCLINUX_BROKEN_MUNMAP=y
+EXCLUDE_BRK=y
+C_SYMBOL_PREFIX="_"
+HAVE_DOT_CONFIG=y
+
+#
+# General Library Settings
+#
+# DOPIC is not set
+# UCLIBC_CTOR_DTOR is not set
+# UCLIBC_PROFILING is not set
+# UCLIBC_HAS_THREADS is not set
+# UCLIBC_HAS_LFS is not set
+MALLOC=y
+# MALLOC_930716 is not set
+UCLIBC_DYNAMIC_ATEXIT=y
+HAS_SHADOW=y
+UCLIBC_HAS_REGEX=y
+UNIX98PTY_ONLY=y
+# ASSUME_DEVPTS is not set
+
+#
+# Networking Support
+#
+# UCLIBC_HAS_IPV6 is not set
+# UCLIBC_HAS_RPC is not set
+
+#
+# String and Stdio Support
+#
+UCLIBC_HAS_WCHAR=y
+# UCLIBC_HAS_LOCALE is not set
+# USE_OLD_VFPRINTF is not set
+
+#
+# Library Installation Options
+#
+DEVEL_PREFIX="/usr/$(TARGET_ARCH)-linux-uclibc"
+SYSTEM_DEVEL_PREFIX="$(DEVEL_PREFIX)"
+DEVEL_TOOL_PREFIX="$(DEVEL_PREFIX)/usr"
+
+#
+# uClibc hacking options
+#
+DODEBUG=y
+# DOASSERTS is not set
+# UCLIBC_MALLOC_DEBUGGING is not set

+ 66 - 0
libc/sysdeps/linux/e1/Makefile

@@ -0,0 +1,66 @@
+# Makefile for uClibc
+#
+# Copyright (C) 2000-2003 Erik Andersen <andersen@uclibc.org>
+#
+# 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)
+
+# If you're looking for vfork(), it is defined in include/unistd.h
+
+
+CRT0=crt0.S
+CRT0_OBJ=$(patsubst %.S,%.o, $(CRT0))
+
+SSRC=
+SOBJS=$(patsubst %.S,%.o, $(SSRC))
+
+CSRC=crt1.c syscalls.c longjmp.c setjmp.c vfork.c
+COBJS=$(patsubst %.c,%.o, $(CSRC))
+
+OBJS=$(SOBJS) $(MOBJ) $(COBJS) $(CRT0_OBJ)
+
+all: $(OBJS) $(LIBC)
+
+$(LIBC): ar-target 
+
+ar-target: $(OBJS) $(CRT0_OBJ) # Tassos
+	$(AR) $(ARFLAGS) $(LIBC) $(OBJS) #Tassos
+	cp $(CRT0_OBJ) $(TOPDIR)lib/$(CRT0_OBJ) #Tassos
+
+$(CRT0_OBJ): %.o : %.S
+	$(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:
+
+
+clean:
+	rm -f *.[oa] *~ core
+	rm -f bits/sysnum.h
+ifneq ($(strip $(HAVE_ELF)),y)
+	rm -f $(TOPDIR)/include/float.h
+endif
+

+ 7 - 0
libc/sysdeps/linux/e1/bits/endian.h

@@ -0,0 +1,7 @@
+/* e1 is big-endian.  */ /*Tassos*/
+
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
+#define __BYTE_ORDER __BIG_ENDIAN

+ 180 - 0
libc/sysdeps/linux/e1/bits/fcntl.h

@@ -0,0 +1,180 @@
+/* O_*, F_*, FD_* bit values for Linux.
+   Copyright (C) 2000 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#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_DIRECTORY	 040000	/* Must be a directory.	 */
+# define O_NOFOLLOW	0100000	/* Do not follow links.	 */
+# define O_DIRECT	0200000	/* Direct disk access.	*/
+# define O_STREAMING	04000000/* streaming access */
+#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	0400000
+#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.  */
+#ifndef __USE_FILE_OFFSET64
+# 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).	*/
+#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
+#define F_GETLK64	12	/* Get record locking info.  */
+#define F_SETLK64	13	/* Set record locking info (non-blocking).  */
+#define F_SETLKW64	14	/* 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
+
+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.  */
+
+/* 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

+ 88 - 0
libc/sysdeps/linux/e1/bits/fenv.h

@@ -0,0 +1,88 @@
+
+/*  Copyright (C) 2002-2003,    George Thanos <george.thanos@gdt.gr>
+                                Yannis Mitsos <yannis.mitsos@gdt.gr>
+
+   Copyright (C) 1997, 1998, 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, 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 SR.  */
+enum
+  {
+    FE_INEXACT = (1 << 8),
+#define FE_INEXACT	FE_INEXACT
+    FE_UNDERFLOW = (1 << 9),
+#define FE_UNDERFLOW	FE_UNDERFLOW
+    FE_OVERFLOW = (1 << 10),
+#define FE_OVERFLOW	FE_OVERFLOW
+    FE_DIVBYZERO = (1 << 11),
+#define FE_DIVBYZERO	FE_DIVBYZERO
+    FE_INVALID = (1 << 12) 
+#define FE_INVALID	FE_INVALID
+  };
+
+#define FE_ALL_EXCEPT \
+	(FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
+
+/* We support all of the four defined rounding modes.  We use
+   the bit positions in the FPCR Mode Control Byte as the values for the
+   appropriate macros.  */
+enum
+  {
+    FE_TONEAREST = 0,
+#define FE_TONEAREST	FE_TONEAREST
+    FE_TOWARDZERO = 1 << 13 ,
+#define FE_TOWARDZERO	FE_TOWARDZERO
+    FE_DOWNWARD = 2 << 13,
+#define FE_DOWNWARD	FE_DOWNWARD
+    FE_UPWARD = 3 << 13
+#define FE_UPWARD	FE_UPWARD
+  };
+
+
+/* Type representing exception flags.  */
+typedef unsigned int fexcept_t;
+
+
+/* Type representing floating-point environment.*/
+typedef struct
+{
+    unsigned int round_mode;
+    unsigned int trap_enabled;
+    unsigned int accrued_except;
+    unsigned int actual_except;
+} fenv_t;
+
+#if 0
+/* If the default argument is used we use this value.  */
+const fenv FE_DFL_ENV_OBJ = {0, 0x1C00, 0}
+#define FE_DFL_ENV	(&FE_DFL_ENV_OBJ)
+
+#ifdef __USE_GNU
+/* Floating-point environment where none of the exceptions are masked.  */
+const fenv_t FE_NOMASK_ENV_OBJ = { 0, 0x1F00, 0 };
+# define FE_NOMASK_ENV	(&FE_NOMASK_ENV_OBJ)
+#endif
+
+#endif
+
+#include <bits/fenvinline.h>

+ 298 - 0
libc/sysdeps/linux/e1/bits/fenvinline.h

@@ -0,0 +1,298 @@
+/* 
+   Inline floating-point environment handling functions for Hyperstone e1-32X.
+   Copyright (C) 2002-2003,    George Thanos <george.thanos@gdt.gr>
+                               Yannis Mitsos <yannis.mitsos@gdt.gr>
+
+   Copyright (C) 1995, 1996, 1997, 1998, 1999 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.  */
+
+#if defined __GNUC__ && !defined _SOFT_FLOAT && !defined __NO_MATH_INLINES
+
+/********************************************************** 
+ *  --- A small description of the E1-16/32X FP unit. ---
+ * FP exceptions can be enabled and disabled through 
+ * <feenableexcept>, <fedisableexcept>.
+ *
+ * - When an enabled exception takes place a SIGFPE signal
+ * is sent to the process by the exception handler. User
+ * can test for the exception that took place through
+ * <fetestexcept>.
+ * feraiseexcept works only for accrued exceptions.
+ *
+ * - When a disabld exception takes place it does not generate
+ * a trap. The user can check if any exception took place after
+ * an FP instruction by issuing an <fetestexcept> command.
+ * User should first clear the G2 register by issuing an
+ * <feclearexcept> function. 
+ * The following program is a typical example of how the user
+ * should check for exceptions that did not generate a SIGFPE
+ * signal :
+ * {
+ *   double f;
+ *   int raised;
+ *   feclearexcept (FE_ALL_EXCEPT);
+ *   f = compute ();
+ *   raised = fetestexcept (FE_OVERFLOW | FE_INVALID);
+ *   if (raised & FE_OVERFLOW) {  ...  }
+ *   if (raised & FE_INVALID) {  ...  }
+ *    ... 
+ * }
+ ***********************************************************/
+
+/* Get FPU rounding mode  */
+#define fegetround()                     \
+({                                       \
+	unsigned int tmp;                \
+	asm volatile("mov %0, SR"        \
+			:"=l"(tmp)       \
+			:/*no input*/);  \
+	tmp &= (3<<13);                  \
+	(tmp);                           \
+})
+
+/* Set FPU rounding mode  */
+#define fesetround(round)                \
+({                                       \
+	unsigned int tmp = (3 << 13);    \
+	while(1) {                       \
+	/* Clear SR.FRM field */         \
+	asm volatile("andn SR, %0"       \
+			:/*no output*/   \
+			:"l"(tmp) );     \
+	tmp &= round;                    \
+                                         \
+	if(tmp) {                        \
+		tmp = -1;                \
+		break;                   \
+	}                                \
+                                         \
+	asm volatile("or SR, %0"         \
+			:/*no input*/    \
+			:"l"(round) );   \
+	tmp = 0;                         \
+	break;                           \
+	}                                \
+	(tmp);                           \
+})
+
+/* The following functions test for accrued exceptions.
+ * No trap is generated on an FP exception.
+ */
+static inline feclearexcept(int __excepts)
+{
+	unsigned int enabled_excepts, disabled_excepts;
+
+	/* Check that __excepts is correctly set */
+	if( __excepts & (~0x1F00) )
+		return -1;
+
+	asm volatile("mov %0, SR"
+		     :"=l"(enabled_excepts)
+		     :/*no input*/ ); 
+
+	enabled_excepts  &= 0x1F00;
+	disabled_excepts = ~enabled_excepts;
+	disabled_excepts &= 0x1F00;
+
+	enabled_excepts  &= __excepts;
+	disabled_excepts &= __excepts;
+
+	/* Clear accrued exceptions */
+	asm volatile("andn G2, %0\n\t"
+		     "andn G2, %1\n\t"
+			:/*no output*/
+			:"l"(enabled_excepts),
+			 "l"(disabled_excepts >> 8) );
+	return 0;
+}
+
+/* fetestexcepts tests both for actual and accrued
+ * excepts. You can test for an exception either after
+ * an FP instruction or within a SIGFPE handler
+ */ 
+inline int fetestexcept(int __excepts)
+{	
+	unsigned int G2, G2en, G2dis;
+	unsigned int enabled_excepts, disabled_excepts;
+
+	/* Check that __excepts is correctly set */
+	if( __excepts & (~0x1F00) )
+		return -1;
+
+	asm volatile("mov %0, SR"
+		     :"=l"(enabled_excepts)
+		     :/*no input*/ ); 
+
+	enabled_excepts &= 0x1F00;
+	disabled_excepts = ~enabled_excepts;
+	disabled_excepts &= 0x1F00;
+
+ 	asm volatile("mov %0, G2"
+		    :"=l"(G2)
+		    :/*no input*/ );
+
+	G2en  = G2 & 0x1F00;
+	G2dis = G2 & 0x1F;
+	G2en  &= enabled_excepts;
+	G2dis &= (disabled_excepts >> 8);
+	return ( G2en | (G2dis << 8) );
+}
+
+static inline int feraiseexcept(int __excepts)
+{
+	asm volatile("or G2, %0"
+			:/*no output*/
+			:"l"( __excepts >> 8  ) );
+	return 0;
+}
+
+/* The following functions enable/disable individual exceptions.
+ * If enabling an exception trap is going to occur, in case of error.
+ */
+#define feenableexcept(__excepts)          \
+({                                         \
+	int __retval, __pexcepts;          \
+	int __tmpexcepts = __excepts;      \
+                                           \
+	while(1) {                         \
+	    asm volatile("mov %0, SR"      \
+		     :"=l"(__pexcepts)     \
+		     :/*no input*/ );      \
+	    __pexcepts &= 0x1F00;          \
+	                                   \
+/* Check if __except values are valid */   \
+	    if( __tmpexcepts & ~0x1F00 ) { \
+	        __retval = -1;             \
+		fprintf(stderr,"Non valid excepts\n");\
+	        break;                     \
+	    }                              \
+	                                   \
+	    asm volatile("or SR, %0"       \
+			:/*no output*/     \
+			:"l"(__tmpexcepts) ); \
+	    __retval = __pexcepts;         \
+	    break;                         \
+	}                                  \
+	(__retval);                        \
+})
+
+
+#define fedisableexcept(__excepts)         \
+({                                         \
+	int __retval, __pexcepts;          \
+	int __tmpexcepts = __excepts;      \
+	                                   \
+	while(1) {                         \
+	    asm volatile("mov %0, SR"      \
+		     :"=l"(__pexcepts)     \
+		     :/*no input*/ );      \
+	    __pexcepts &= 0x1F00;          \
+	                                   \
+/* Check if __except values are valid */   \
+	    if( __tmpexcepts & ~0x1F00 ) { \
+	        __retval = -1;             \
+		fprintf(stderr,"Non valid excepts\n");\
+	        break;                     \
+	    }                              \
+	                                   \
+	    asm volatile("andn SR, %0"     \
+			:/*no output*/     \
+			:"l"(__tmpexcepts) ); \
+	    __retval = __pexcepts;         \
+	    break;                         \
+	}                                  \
+	(__retval);                        \
+})
+
+static inline int fegetexcept(int excepts)
+{
+	unsigned int tmp;
+	asm volatile("mov %0, SR"
+		    :"=l"(tmp)
+		    :/*no input*/ );
+	tmp &= 0x1F00;
+	return tmp;
+}
+
+static inline int fegetenv(fenv_t *envp)
+{
+	asm volatile("mov %0, SR\n\t
+		      mov %1, SR\n\t
+		      mov %2, G2\n\t
+		      mov %3, G2\n\t"
+		     :"=l"(envp->round_mode),
+		      "=l"(envp->trap_enabled),
+		      "=l"(envp->accrued_except),
+		      "=l"(envp->actual_except)
+		     :/*no input*/ );
+	envp->round_mode &= (3<<13);
+	envp->trap_enabled &= 0x1F00;
+	envp->accrued_except &= 0x1F;
+	envp->accrued_except <<= 8;
+	envp->actual_except &= 0x1F00;
+}
+
+#define feholdexcept(envp)        \
+(                                         \
+	fegetenv(envp);                   \
+	fedisableexcept(FE_ALL_EXCEPT);   \
+	feclearexcept(FE_ALL_EXCEPT);     \
+	(0);                              \
+)
+
+#define fesetenv(envp)                \
+({                                                  \
+	/* Clear FRM & FTE field of SR */           \
+	unsigned long clearSR = ( 127<<8 );         \
+	asm volatile("andn SR, %0\n\t"              \
+		     "or   SR, %1\n\t"              \
+		     "or   SR, %2\n\t"              \
+		     :/*no output*/                 \
+		     :"l"(clearSR),                 \
+		      "l"(envp->round_mode),        \
+		      "l"(envp->trap_enabled) );    \
+	asm volatile("andn G2, 0x1F1F\n\t"          \
+		     "or   G2, %0\n\t"              \
+		     "or   G2, %1\n\t"              \
+		     :/*no output*/                 \
+		     :"l"( envp->accrued_except >> 8),\
+		     :"l"( envp->actual_except ) ); \
+	(0); /* return 0 */                         \
+})
+		     
+#define feupdateenv(envp)                           \
+({                                                  \
+	/* Clear FRM & FTE field of SR */           \
+	asm volatile(/* We dont clear the prev SR*/ \
+		     "or   SR, %1\n\t"              \
+		     "or   SR, %2\n\t"              \
+		     :/*no output*/                 \
+		     :"l"(clearSR),                 \
+		      "l"(envp->round_mode),        \
+		      "l"(envp->accrued_except) );  \
+	asm volatile(/* We dont clear the prev SR*/ \
+		     "or   G2, %0\n\t"              \
+		     "or   G2, %1\n\t"              \
+		     :/*no output*/                 \
+		     :"l"( envp->accrued_except >> 8),\
+		     :"l"( envp->actual_except ) ); \
+	(0); /* return 0 */                         \
+})
+		     
+
+#endif /* __GNUC__ && !_SOFT_FLOAT */
+

+ 57 - 0
libc/sysdeps/linux/e1/bits/kernel_stat.h

@@ -0,0 +1,57 @@
+#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... */
+#warning "Please verify struct kernel_stat for your architecture actually matches struct kernel_stat for x86  If it doesn't, then you will need to add a proper kernel_stat.h for your architecture..."
+
+struct kernel_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;
+};
+
+struct kernel_stat64 {
+	unsigned short	st_dev;
+	unsigned char	__pad0[10];
+#define _HAVE_STAT64___ST_INO
+	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	/*  _BITS_STAT_STRUCT_H */
+

+ 45 - 0
libc/sysdeps/linux/e1/bits/kernel_types.h

@@ -0,0 +1,45 @@
+/* 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 __ARCH_E1_POSIX_TYPES_H
+#define __ARCH_E1_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 int	__kernel_size_t;
+typedef int		__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;
+typedef long long	__kernel_loff_t;
+
+/*
+typedef struct {
+#ifdef __USE_ALL
+	int val[2];
+#else
+	int __val[2];
+#endif
+} __kernel_fsid_t;
+*/
+
+#endif /* __ARCH_E1_POSIX_TYPES_H */

+ 75 - 0
libc/sysdeps/linux/e1/bits/mman.h

@@ -0,0 +1,75 @@
+/* Definitions for POSIX memory map interface.  Linux/m68k version.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _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
+#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

+ 5 - 0
libc/sysdeps/linux/e1/bits/proto.h

@@ -0,0 +1,5 @@
+#ifndef _E1_PROTO_H_
+#define _E1_PROTO_H_
+int kprintf( char *msg, int len);
+#define KPRINTF(msg)  kprintf(msg, strlen(msg)+1)
+#endif

+ 18 - 0
libc/sysdeps/linux/e1/bits/setjmp.h

@@ -0,0 +1,18 @@
+/* This file is lisenced under LGPL.
+ * Copyright (C) 2002-2003,    George Thanos <george.thanos@gdt.gr>
+ *                             Yannis Mitsos <yannis.mitsos@gdt.gr>
+ */
+
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
+#endif
+
+typedef struct {
+	unsigned long G3;
+	unsigned long G4;
+	unsigned long SavedSP;
+	unsigned long SavedPC;
+	unsigned long SavedSR;
+	unsigned long ReturnValue;
+} __jmp_buf[1];
+

+ 22 - 0
libc/sysdeps/linux/e1/bits/syscalls.h

@@ -0,0 +1,22 @@
+/* This file is licensed under LGPL.
+ * Copyright (C) 2002-2003,    George Thanos <george.thanos@gdt.gr>
+ *                             Yannis Mitsos <yannis.mitsos@gdt.gr>
+ */
+#ifndef _BITS_SYSCALLS_H
+#define _BITS_SYSCALLS_H
+#ifndef _SYSCALL_H
+# error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
+#endif
+
+#include <features.h>
+
+/* This includes the `__NR_<name>' syscall numbers taken from the Linux kernel
+ * header files.  It also defines the traditional `SYS_<name>' macros for older
+ * programs.  */
+#include <bits/sysnum.h>
+
+/* Include the library _syscallx macros */
+#include <bits/unistd.h>
+
+#endif /* _BITS_SYSCALLS_H */
+

+ 464 - 0
libc/sysdeps/linux/e1/bits/unistd.h

@@ -0,0 +1,464 @@
+ /* This file is lisenced under LGPL.
+  * Copyright (C) 2002-2003,    George Thanos <george.thanos@gdt.gr>
+  *                             Yannis Mitsos <yannis.mitsos@gdt.gr>
+  */
+#ifndef _BITS_UNISTD_H_
+#define _BITS_UNISTD_H_
+
+#include <bits/proto.h>
+#include <errno.h>
+
+#define __E1_COFF_GCC__
+
+/* The following macros have been provided by C.Baumhof
+ * They can be inlined in contrast to the previous ones*/
+#define _syscall0(type, name)  \
+type name(void)              \
+{                                               \
+	register int par1 __asm__("L15");   \
+	register int par2 __asm__("L14");   \
+    par1 = -1;              \
+	par2 = __NR_##name;         \
+	__asm__ __volatile__(                   \
+		"trap    47"                        \
+		:"=l"(par1)                             \
+		:"0"(par1), "l"(par2)  \
+		:"memory","L14","L15");   \
+																	\
+	if( par1 < 0 ) {													\
+			__set_errno( -par1 );										\
+			return -1;											\
+	} else															\
+		return (type)(par1);                    					\
+}
+
+#define _syscall1(type, name,atype, a)  \
+type name(atype a)              \
+{                                               \
+	register int par1 __asm__("L15");   \
+	register int par2 __asm__("L14");   \
+	register int par3 __asm__("L13");   \
+    par1 = -1;              \
+	par2 = __NR_##name;         \
+	par3 = (int)a;              \
+	__asm__ __volatile__(                   \
+		"trap    47"                        \
+		:"=l"(par1)                             \
+		:"0"(par1), "l"(par2), "l"(par3)  \
+		:"memory","L13","L14","L15");   \
+																	\
+	if( par1 < 0 ) {													\
+			__set_errno( -par1 );										\
+			return -1;											\
+	} else															\
+		return (type)(par1);                    					\
+}
+
+#define _syscall2(type, name,atype, a, btype, b)  \
+type name(atype a, btype b)              \
+{                                               \
+	register int par1 __asm__("L15");   \
+	register int par2 __asm__("L14");   \
+	register int par3 __asm__("L13");   \
+	register int par4 __asm__("L12");   \
+    par1 = -1;              \
+	par2 = __NR_##name;         \
+	par3 = (int)a;              \
+	par4 = (int)b;              \
+	__asm__ __volatile__(                   \
+		"trap    47"                        \
+		:"=l"(par1)                             \
+		:"0"(par1), "l"(par2), "l"(par3), "l"(par4) \
+		:"memory","L12","L13","L14","L15");   \
+																	\
+	if( par1 < 0 ) {													\
+			__set_errno( -par1 );										\
+			return -1;											\
+	} else															\
+		return (type)(par1);                    					\
+}
+
+#define _syscall3(type, name,atype, a, btype, b, ctype, c)  \
+type name(atype a, btype b, ctype c)                      \
+{                                               \
+	register int par1 __asm__("L15");   \
+	register int par2 __asm__("L14");   \
+	register int par3 __asm__("L13");   \
+	register int par4 __asm__("L12");   \
+	register int par5 __asm__("L11");   \
+    par1 = -1;              \
+	par2 = __NR_##name;         \
+	par3 = (int)a;              \
+	par4 = (int)b;              \
+	par5 = (int)c;              \
+	__asm__ __volatile__(                   \
+		"trap    47"                        \
+		:"=l"(par1)                             \
+		:"0"(par1), "l"(par2), "l"(par3), "l"(par4), "l"(par5) \
+		:"memory","L11","L12","L13","L14","L15");    \
+																	\
+	if( par1 < 0 ) {													\
+			__set_errno( -par1 );										\
+			return -1;											\
+	} else															\
+		return (type)(par1);                    					\
+}
+
+#define _syscall4(type, name,atype, a, btype, b, ctype, c, dtype, d)  \
+type name(atype a, btype b, ctype c,dtype d)                      \
+{                                               \
+	register int par1 __asm__("L15");   \
+	register int par2 __asm__("L14");   \
+	register int par3 __asm__("L13");   \
+	register int par4 __asm__("L12");   \
+	register int par5 __asm__("L11");   \
+	register int par6 __asm__("L10");   \
+    par1 = -1;              \
+	par2 = __NR_##name;         \
+	par3 = (int)a;              \
+	par4 = (int)b;              \
+	par5 = (int)c;              \
+	par6 = (int)d;              \
+	__asm__ __volatile__(                   \
+		"trap    47"                        \
+		:"=l"(par1)                             \
+		:"0"(par1),"l"(par2),"l"(par3),"l"(par4),"l"(par5),"l"(par6) \
+		:"memory","L10","L11","L12","L13","L14","L15");    \
+																	\
+	if( par1 < 0 ) {													\
+			__set_errno( -par1 );										\
+			return -1;											\
+	} else															\
+		return (type)(par1);                    					\
+}
+
+#define _syscall5(type, name,atype, a, btype, b, ctype, c, dtype, d, etype, e)  \
+type name(atype a, btype b, ctype c,dtype d, etype e)                      \
+{                                                       \
+	register int par1 __asm__("L15");   \
+	register int par2 __asm__("L14");   \
+	register int par3 __asm__("L13");   \
+	register int par4 __asm__("L12");   \
+	register int par5 __asm__("L11");   \
+	register int par6 __asm__("L10");   \
+	register int par7 __asm__("L9");   \
+    par1 = -1;              	\
+	par2 = __NR_##name;         \
+	par3 = (int)a;              \
+	par4 = (int)b;              \
+	par5 = (int)c;              \
+	par6 = (int)d;              \
+	par7 = (int)e;              \
+	__asm__ __volatile__(                   \
+		"trap    47"                        \
+		:"=l"(par1)                             \
+		:"0"(par1),"l"(par2),"l"(par3),"l"(par4),"l"(par5),"l"(par6),"l"(par7) \
+		:"memory","L9","L10","L11","L12","L13","L14","L15");    \
+																	\
+	if( par1 < 0 ) {													\
+			__set_errno( -par1 );										\
+			return -1;											\
+	} else															\
+		return (type)(par1);                    					\
+	return (type)(par1);                    \
+}
+
+#define _syscall6(type, name,atype, a, btype, b, ctype, c, dtype, d, etype, e, ftype, f)  \
+type name(atype a, btype b, ctype c,dtype d, etype e, ftype f)                      \
+{                                                               \
+	register int par1 __asm__("L15");   \
+	register int par2 __asm__("L14");   \
+	register int par3 __asm__("L13");   \
+	register int par4 __asm__("L12");   \
+	register int par5 __asm__("L11");   \
+	register int par6 __asm__("L10");   \
+	register int par7 __asm__("L9");   \
+	register int par8 __asm__("L8");   \
+	int sys_retval;				\
+    par1 = -1;              	\
+	par2 = __NR_##name;         \
+	par3 = (int)a;              \
+	par4 = (int)b;              \
+	par5 = (int)c;              \
+	par6 = (int)d;              \
+	par7 = (int)e;              \
+	par7 = (int)f;              \
+	__asm__ __volatile__(                   \
+		"trap    47"                        \
+		:"=l"(par1)                             \
+		:"0"(par1),"l"(par2),"l"(par3),"l"(par4),"l"(par5),"l"(par6),"l"(par7),"l"(par8) \
+		:"memory","L8","L9","L10","L11","L12","L13","L14","L15");	\
+																	\
+	if( par1 < 0 ) {													\
+			__set_errno( -par1 );										\
+			return -1;											\
+	} else															\
+		return (type)(par1);                    					\
+}
+
+#define __syscall0(type, name)  \
+type name(...)                      \
+{                                               \
+	register int par1 __asm__("L15");   \
+	register int par2 __asm__("L14");   \
+	par1 = -1;              \
+	par2 = __NR_##name;         \
+	__asm__ __volatile__(                   \
+		"trap    47"                        \
+		:"=l"(par1)                             \
+		:"0"(par1), "l"(par2)\
+		:"memory","L14","L15");    \
+																	\
+	if( par1 < 0 ) {													\
+			__set_errno( -par1 );										\
+			return -1;											\
+	} else															\
+		return (type)(par1);                    					\
+}
+
+#define __syscall1(type, name, atype, a)  \
+type name(atype a, ...)                      \
+{                                               \
+	register int par1 __asm__("L15");   \
+	register int par2 __asm__("L14");   \
+	register int par3 __asm__("L13");   \
+	par1 = -1;              \
+	par2 = __NR_##name;         \
+	par3 = (int)a;              \
+	__asm__ __volatile__(                   \
+		"trap    47"                        \
+		:"=l"(par1)                             \
+		:"0"(par1), "l"(par2), "l"(par3)\
+		:"memory","L13","L14","L15");    \
+																	\
+	if( par1 < 0 ) {													\
+			__set_errno( -par1 );										\
+			return -1;											\
+	} else															\
+		return (type)(par1);                    					\
+}
+
+#define __syscall2(type, name,atype, a, btype, b)  \
+type name(atype a, btype b, ...)                      \
+{                                               \
+	register int par1 __asm__("L15");   \
+	register int par2 __asm__("L14");   \
+	register int par3 __asm__("L13");   \
+	register int par4 __asm__("L12");   \
+	par1 = -1;              \
+	par2 = __NR_##name;         \
+	par3 = (int)a;              \
+	par4 = (int)b;              \
+	__asm__ __volatile__(                   \
+		"trap    47"                        \
+		:"=l"(par1)                             \
+		:"0"(par1), "l"(par2), "l"(par3), "l"(par4)\
+		:"memory","L12","L13","L14","L15");    \
+																	\
+	if( par1 < 0 ) {													\
+			__set_errno( -par1 );										\
+			return -1;											\
+	} else															\
+		return (type)(par1);                    					\
+}
+
+#define __syscall3(type, name,atype, a, btype, b, ctype, c)  \
+type name(atype a, btype b, ctype c, ...)                      \
+{                                               \
+	register int par1 __asm__("L15");   \
+	register int par2 __asm__("L14");   \
+	register int par3 __asm__("L13");   \
+	register int par4 __asm__("L12");   \
+	register int par5 __asm__("L11");   \
+	par1 = -1;              \
+	par2 = __NR_##name;         \
+	par3 = (int)a;              \
+	par4 = (int)b;              \
+	par5 = (int)c;              \
+	__asm__ __volatile__(                   \
+		"trap    47"                        \
+		:"=l"(par1)                             \
+		:"0"(par1), "l"(par2), "l"(par3), "l"(par4), "l"(par5) \
+		:"memory","L11","L12","L13","L14","L15");    \
+																	\
+	if( par1 < 0 ) {													\
+			__set_errno( -par1 );										\
+			return -1;											\
+	} else															\
+		return (type)(par1);                    					\
+}
+
+#define __syscall4(type, name,atype, a, btype, b, ctype, c, dtype, d)  \
+type name(atype a, btype b, ctype c,dtype d, ...)                      \
+{                                               \
+	register int par1 __asm__("L15");   \
+	register int par2 __asm__("L14");   \
+	register int par3 __asm__("L13");   \
+	register int par4 __asm__("L12");   \
+	register int par5 __asm__("L11");   \
+	register int par6 __asm__("L10");   \
+	par1 = -1;              \
+	par2 = __NR_##name;         \
+	par3 = (int)a;              \
+	par4 = (int)b;              \
+	par5 = (int)c;              \
+	par6 = (int)d;              \
+	__asm__ __volatile__(                   \
+		"trap    47"                        \
+		:"=l"(par1)                             \
+		:"0"(par1),"l"(par2),"l"(par3),"l"(par4),"l"(par5),"l"(par6) \
+		:"memory","L10","L11","L12","L13","L14","L15");    \
+																	\
+	if( par1 < 0 ) {													\
+			__set_errno( -par1 );										\
+			return -1;											\
+	} else															\
+		return (type)(par1);                    					\
+}
+
+#define __syscall5(type, name,atype, a, btype, b, ctype, c, dtype, d, etype, e)  \
+type name(atype a, btype b, ctype c,dtype d, etype e, ...)                      \
+{                                                       \
+	register int par1 __asm__("L15");   \
+	register int par2 __asm__("L14");   \
+	register int par3 __asm__("L13");   \
+	register int par4 __asm__("L12");   \
+	register int par5 __asm__("L11");   \
+	register int par6 __asm__("L10");   \
+	register int par7 __asm__("L9");   \
+	par1 = -1;                  \
+	par2 = __NR_##name;         \
+	par3 = (int)a;              \
+	par4 = (int)b;              \
+	par5 = (int)c;              \
+	par6 = (int)d;              \
+	par7 = (int)e;              \
+	__asm__ __volatile__(                   \
+		"trap    47"                        \
+		:"=l"(par1)                             \
+		:"0"(par1),"l"(par2),"l"(par3),"l"(par4),"l"(par5),"l"(par6),"l"(par7) \
+		:"memory","L9","L10","L11","L12","L13","L14","L15");    \
+																	\
+	if( par1 < 0 ) {													\
+			__set_errno( -par1 );										\
+			return -1;											\
+	} else															\
+		return (type)(par1);                    					\
+}
+
+#define __syscall6(type, name,atype, a, btype, b, ctype, c, dtype, d, etype, e, ftype, f)  \
+type name(atype a, btype b, ctype c,dtype d, etype e, ftype f, ...)                      \
+{                                                               \
+	register int par1 __asm__("L15");   \
+	register int par2 __asm__("L14");   \
+	register int par3 __asm__("L13");   \
+	register int par4 __asm__("L12");   \
+	register int par5 __asm__("L11");   \
+	register int par6 __asm__("L10");   \
+	register int par7 __asm__("L9");   \
+	register int par8 __asm__("L8");   \
+	par1 = -1;                  \
+	par2 = __NR_##name;         \
+	par3 = (int)a;              \
+	par4 = (int)b;              \
+	par5 = (int)c;              \
+	par6 = (int)d;              \
+	par7 = (int)e;              \
+	par7 = (int)f;              \
+	__asm__ __volatile__(                   \
+		"trap    47"                        \
+		:"=l"(par1)                             \
+		:"0"(par1),"l"(par2),"l"(par3),"l"(par4),"l"(par5),"l"(par6),"l"(par7),"l"(par8) \
+		:"memory","L8","L9","L10","L11","L12","L13","L14","L15");    \
+																	\
+	if( par1 < 0 ) {													\
+			__set_errno( -par1 );										\
+			return -1;											\
+	} else															\
+		return (type)(par1);                    					\
+}
+
+#include <sys/types.h>
+/* Taken from <bits/errno.h> */
+#ifndef _LIBC
+/* We don't support pthreads for the moment*/
+#define __set_errno(val) ((errno) = (val))
+#endif
+
+#if 0
+#define _syscall3(type, name,atype, a , btype, b, ctype, c)  \
+type name(atype a, btype b, ctype c,)                      \
+{                                               \
+		__asm__ __volatile__(					\
+			"movi  L9, -1\n\t"                  \
+			"movi  L8, %0\n\t"					\
+			"ldw.d G3, L7, 0\n\t"				\
+			"ldw.d G3, L6, 4\n\t"				\
+			"ldw.d G3, L5, 8\n\t"				\
+		:/* no output */						\
+		:"i"(__NR_##name)						\
+		:"cc","memory","%L5","L6","L7","L8","L9");\
+        __asm__ __volatile__(                   \
+			"trap    47\n\t"                    \
+			"mov L2, L9\n\t");                  \
+}
+
+#define _syscall4(type, name,atype, a, btype, b, ctype, c, dtype, d)  \
+type name(atype a, btype b, ctype c,dtype d)                      \
+{                                               \
+		__asm__ __volatile__(					\
+			"movi  L11, -1\n\t"                  \
+			"movi  L10, %0\n\t"					\
+			"ldw.d G3, L9, 0\n\t"				\
+			"ldw.d G3, L8, 4\n\t"				\
+			"ldw.d G3, L7, 8\n\t"				\
+			"ldw.d G3, L6, 12\n\t"				\
+		:/* no output */						\
+		:"i"(__NR_##name)						\
+		:"cc","memory","L6","L7","L8","L9","L10","L11");\
+        __asm__ __volatile__(                   \
+			"trap    47\n\t"                    \
+			"mov L2, L11\n\t");                  \
+}
+
+#define _syscall5(type, name,atype, a, btype, b, ctype, c, dtype, d, etype, e)  \
+type name(atype a, btype b, ctype c,dtype d, etype e)                      \
+{                                                       \
+		__asm__ __volatile__(					\
+			"movi  L13, -1\n\t"                  \
+			"movi  L12, %0\n\t"					\
+			"ldw.d G3, L11, 0\n\t"				\
+			"ldw.d G3, L10, 4\n\t"				\
+			"ldw.d G3, L9, 8\n\t"				\
+			"ldw.d G3, L8, 12\n\t"				\
+			"ldw.d G3, L7, 16\n\t"				\
+		:/* no output */						\
+		:"i"(__NR_##name)						\
+		:"cc","memory","L7","L8","L9","L10","L11","L12","L13");\
+        __asm__ __volatile__(                   \
+			"trap    47\n\t"                    \
+			"mov L2, L13\n\t");                  \
+}
+
+#define _syscall6(type, name,atype, a, btype, b, ctype, c, dtype, d, etype, e, ftype, f)  \
+type name(atype a, btype b, ctype c,dtype d, etype e, ftype f)                      \
+{                                                               \
+		__asm__ __volatile__(					\
+			"movi  L15, -1\n\t"                  \
+			"movi  L14, %0\n\t"					\
+			"ldw.d G3, L13, 0\n\t"				\
+			"ldw.d G3, L12, 4\n\t"				\
+			"ldw.d G3, L11, 8\n\t"				\
+			"ldw.d G3, L10, 12\n\t"				\
+			"ldw.d G3, L9, 16\n\t"				\
+			"ldw.d G3, L8, 20\n\t"				\
+		:/* no output */						\
+		:"i"(__NR_##name)						\
+		:"cc","memory","L8","L9","L10","L11","L12","L13","L14","L15");\
+        __asm__ __volatile__(                   \
+			"trap    47\n\t"                    \
+			"mov L2, L15\n\t");                  \
+}
+#endif
+
+#endif /* !_HYPERSTONE_NOMMU_UNISTD_H_ */

+ 22 - 0
libc/sysdeps/linux/e1/bits/wordsize.h

@@ -0,0 +1,22 @@
+/* Copyright (C) 2002-2003,    George Thanos <george.thanos@gdt.gr>
+                               Yannis Mitsos <yannis.mitsos@gdt.gr>
+
+   Copyright (C) 1999 Free Software Foundation, Inc.
+   This file is part of the GNU C library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define __WORDSIZE	32

+ 8 - 0
libc/sysdeps/linux/e1/crt0.S

@@ -0,0 +1,8 @@
+/*  This file is lisenced under LGPL
+ *  Copyright (C) 2002-2003,    George Thanos <george.thanos@gdt.gr>
+ *                              Yannis Mitsos <yannis.mitsos@gdt.gr>
+ */
+
+.global __start
+__start:
+	call L1, 0, __uClibc_start

+ 48 - 0
libc/sysdeps/linux/e1/crt1.c

@@ -0,0 +1,48 @@
+/* vi: set sw=4 ts=4: */
+/* uClibc/sysdeps/linux/m68k/crt0.S
+ * Pull stuff off the stack and get uClibc moving.
+ *
+ * Copyright (C) 2002-2003,    George Thanos <george.thanos@gdt.gr>
+ *                             Yannis Mitsos <yannis.mitsos@gdt.gr>
+ *
+ * Copyright (C) 2000,2001 by Erik Andersen <andersen@uclibc.org>
+ *
+ * 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
+ */
+
+/* Stick in a dummy reference to main(), so that if an application
+ * is linking when the main() function is in a static library (.a)
+ * we can be sure that main() actually gets linked in */
+extern void main(int argc,void *argv,void *envp);
+//void (*mainp)(int argc,void *argv,void *envp) = main;
+
+void __uClibc_main(int argc,void *argv,void *envp);
+
+void _uClibc_start(unsigned int first_arg)
+{
+	unsigned int argc;
+	char **argv, **envp;
+	unsigned long *stack;
+
+	stack = (unsigned long*) first_arg;
+	argc = *(stack);
+	argv = (char **)(stack + 1);
+	envp = (char **)(stack + 1 + argc + 1);
+
+	__uClibc_main(argc, argv, envp);
+}
+
+void __main() { }
+

+ 72 - 0
libc/sysdeps/linux/e1/longjmp.c

@@ -0,0 +1,72 @@
+/*  This file is lisenced under LGPL
+ *  Copyright (C) 2002-2003,    George Thanos <george.thanos@gdt.gr>
+ *                              Yannis Mitsos <yannis.mitsos@gdt.gr>
+ */
+
+#include <syscall.h>
+#include <setjmp.h>
+#include <stdio.h>
+#include <signal.h>
+
+#define __NR_e1newSP  224
+static inline _syscall1(int, e1newSP, unsigned long, SavedSP )
+
+unsigned long jmpbuf_ptr;
+
+void longjmp(jmp_buf state, int value )
+{
+	if(!value)
+		state->__jmpbuf->ReturnValue = 1;
+	else
+		state->__jmpbuf->ReturnValue = value;
+
+	jmpbuf_ptr = (unsigned long)state; 
+	e1newSP(state->__jmpbuf->SavedSP);
+
+#define _state_ ((struct __jmp_buf_tag*)jmpbuf_ptr)
+	asm volatile("mov L0, %0\n\t"
+		     "mov L1, %1\n\t"
+		     "mov L2, %2\n\t"
+		     "mov G3, %3\n\t"
+		     "mov G4, %4\n\t"
+		     "ret PC, L1\n\t"
+		     :/*no output*/
+		     :"l"(_state_->__jmpbuf->ReturnValue),
+		      "l"(_state_->__jmpbuf->SavedPC),
+		      "l"(_state_->__jmpbuf->SavedSR),
+		      "l"(_state_->__jmpbuf->G3),
+		      "l"(_state_->__jmpbuf->G4)
+		     :"%G3", "%G4", "%L0", "%L1" );
+#undef _state_
+}
+
+void siglongjmp(sigjmp_buf state, int value )
+{
+	if( state->__mask_was_saved )
+		sigprocmask(SIG_SETMASK, &state->__saved_mask, NULL);
+
+	if(!value)
+		state->__jmpbuf->ReturnValue = 1;
+	else
+		state->__jmpbuf->ReturnValue = value;
+
+	jmpbuf_ptr = (unsigned long)state; 
+	e1newSP(state->__jmpbuf->SavedSP);
+	
+
+#define _state_ ((struct __jmp_buf_tag*)jmpbuf_ptr)
+	asm volatile("mov L0, %0\n\t"
+		     "mov L1, %1\n\t"
+		     "mov L2, %2\n\t"
+		     "mov G3, %3\n\t"
+		     "mov G4, %4\n\t"
+		     "ret PC, L1\n\t"
+		     :/*no output*/
+		     :"l"(_state_->__jmpbuf->ReturnValue),
+		      "l"(_state_->__jmpbuf->SavedPC),
+		      "l"(_state_->__jmpbuf->SavedSR),
+		      "l"(_state_->__jmpbuf->G3),
+		      "l"(_state_->__jmpbuf->G4)
+		     :"%G3", "%G4", "%L0", "%L1" );
+#undef _state_
+}

+ 54 - 0
libc/sysdeps/linux/e1/setjmp.c

@@ -0,0 +1,54 @@
+/*  This file is lisenced under LGPL
+ *  Copyright (C) 2002-2003,    George Thanos <george.thanos@gdt.gr>
+ *                              Yannis Mitsos <yannis.mitsos@gdt.gr>
+ */
+
+#include <setjmp.h>
+#include <stdio.h>
+#include <signal.h>
+
+int setjmp( jmp_buf state)
+{
+	asm volatile(	"mov %0, G3\n\t"           
+			"mov %1, G4\n\t" 
+			:"=l"(state->__jmpbuf->G3), 
+			 "=l"(state->__jmpbuf->G4) 
+			:/*no input*/ 
+			:"%G3", "%G4" );
+
+	asm volatile(   "setadr  %0\n\t"
+			"mov %1, L1\n\t"
+			"mov %2, L2\n\t"
+			:"=l"(state->__jmpbuf->SavedSP),
+			 "=l"(state->__jmpbuf->SavedPC),
+			 "=l"(state->__jmpbuf->SavedSR)
+			:/*no input*/);
+	return 0;
+}
+
+int sigsetjmp( sigjmp_buf state , int savesigs)
+{
+
+	if(savesigs) {
+		state->__mask_was_saved = 1;
+		/* how arg in <sigprocmask> is not significant */
+		sigprocmask(SIG_SETMASK, NULL, &state->__saved_mask);
+	} else
+		state->__mask_was_saved = 0;
+
+	asm volatile(	"mov %0, G3\n\t"           
+			"mov %1, G4\n\t" 
+			:"=l"(state->__jmpbuf->G3), 
+			 "=l"(state->__jmpbuf->G4) 
+			:/*no input*/ 
+			:"%G3", "%G4" );
+
+	asm volatile(   "setadr  %0\n\t"
+			"mov %1, L2\n\t"
+			"mov %2, L3\n\t"
+			:"=l"(state->__jmpbuf->SavedSP),
+			 "=l"(state->__jmpbuf->SavedPC),
+			 "=l"(state->__jmpbuf->SavedSR)
+			:/*no input*/);
+	return 0;
+}

+ 31 - 0
libc/sysdeps/linux/e1/sys/procfs.h

@@ -0,0 +1,31 @@
+/* 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.  */
+
+#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.  */
+
+#endif	/* sys/procfs.h */

+ 25 - 0
libc/sysdeps/linux/e1/sys/reg.h

@@ -0,0 +1,25 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _SYS_REG_H
+#define _SYS_REG_H	1
+
+/* Index into an array of 4 byte integers returned from ptrace for
+   location of the users' stored general purpose registers. */
+
+#endif	/* _SYS_REG_H */

+ 109 - 0
libc/sysdeps/linux/e1/sys/ucontext.h

@@ -0,0 +1,109 @@
+/* Copyright (C) 1997, 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.  */
+
+/* System V/m68k ABI compliant context switching support.  */
+
+#ifndef _SYS_UCONTEXT_H
+#define _SYS_UCONTEXT_H	1
+
+#include <features.h>
+#include <signal.h>
+
+/* Type for general register.  */
+typedef int greg_t;
+
+/* Number of general registers.  */
+#define NGREG	18
+
+/* Container for all general registers.  */
+typedef greg_t gregset_t[NGREG];
+
+/* Number of each register is the `gregset_t' array.  */
+enum
+{
+  R_D0 = 0,
+#define R_D0	R_D0
+  R_D1 = 1,
+#define R_D1	R_D1
+  R_D2 = 2,
+#define R_D2	R_D2
+  R_D3 = 3,
+#define R_D3	R_D3
+  R_D4 = 4,
+#define R_D4	R_D4
+  R_D5 = 5,
+#define R_D5	R_D5
+  R_D6 = 6,
+#define R_D6	R_D6
+  R_D7 = 7,
+#define R_D7	R_D7
+  R_A0 = 8,
+#define R_A0	R_A0
+  R_A1 = 9,
+#define R_A1	R_A1
+  R_A2 = 10,
+#define R_A2	R_A2
+  R_A3 = 11,
+#define R_A3	R_A3
+  R_A4 = 12,
+#define R_A4	R_A4
+  R_A5 = 13,
+#define R_A5	R_A5
+  R_A6 = 14,
+#define R_A6	R_A6
+  R_A7 = 15,
+#define R_A7	R_A7
+  R_SP = 15,
+#define R_SP	R_SP
+  R_PC = 16,
+#define R_PC	R_PC
+  R_PS = 17
+#define R_PS	R_PS
+};
+
+/* Structure to describe FPU registers.  */
+typedef struct fpregset
+{
+  int f_fpregs[8][3];
+  int f_pcr;
+  int f_psr;
+  int f_fpiaddr;
+} fpregset_t;
+
+/* Context to describe whole processor state.  */
+typedef struct
+{
+  int version;
+  gregset_t gregs;
+  fpregset_t fpregs;
+} mcontext_t;
+
+#define MCONTEXT_VERSION 2
+
+/* Userlevel context.  */
+typedef struct ucontext
+{
+  unsigned long int uc_flags;
+  struct ucontext *uc_link;
+  __sigset_t uc_sigmask;
+  stack_t uc_stack;
+  mcontext_t uc_mcontext;
+  long int uc_filler[174];
+} ucontext_t;
+
+#endif /* sys/ucontext.h */

+ 11 - 0
libc/sysdeps/linux/e1/syscalls.c

@@ -0,0 +1,11 @@
+/*  This file is lisenced under LGPL
+ *  Copyright (C) 2002-2003,    George Thanos <george.thanos@gdt.gr>
+ *                              Yannis Mitsos <yannis.mitsos@gdt.gr>
+ */
+
+#include <syscall.h>
+
+/* We now need a declaration of the `errno' variable.  */
+extern int errno;
+#   define __set_errno(val) ((errno) = (val))
+_syscall2( int, kprintf, char *, msg, int, len)

+ 7 - 0
libc/sysdeps/linux/e1/vfork.c

@@ -0,0 +1,7 @@
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <sys/errno.h>
+
+#define __NR___libc_vfork __NR_vfork
+inline	_syscall0(pid_t, __libc_vfork);
+inline	_syscall0(pid_t, vfork);