[uClibc-cvs] CVS update of uClibc/libc/sysdeps/linux/h8300 (Makefile __longjmp.S bits/atomicity.h bits/huge_val.h bits/kernel_stat.h bits/kernel_types.h bits/mman.h bits/resource.h bits/setjmp.h bits/sigcontextinfo.h bits/stackinfo.h bits/syscalls.h bits/wordsize.h brk.c bsd-_setjmp.S bsd-setjmp.S clone.S crt0.S crti.S crtn.S pt-machine.h ptrace.c setjmp.S sys/procfs.h vfork.S)

Erik Andersen andersen at codepoet.org
Thu Jul 15 07:34:01 UTC 2004


    Date: Thursday, July 15, 2004 @ 01:34:00
  Author: andersen
    Path: /var/cvs/uClibc/libc/sysdeps/linux/h8300

   Added: __longjmp.S (1.1) bits/atomicity.h (1.1) bits/sigcontextinfo.h
          (1.1) bits/stackinfo.h (1.1) brk.c (1.1) bsd-_setjmp.S (1.1)
          bsd-setjmp.S (1.1) clone.S (1.1) crti.S (1.1) crtn.S (1.1)
          pt-machine.h (1.1) sys/procfs.h (1.1)
Modified: Makefile (1.11 -> 1.12) bits/kernel_stat.h (1.3 -> 1.4)
          bits/kernel_types.h (1.2 -> 1.3) bits/mman.h (1.3 -> 1.4)
          bits/setjmp.h (1.3 -> 1.4) bits/syscalls.h (1.6 -> 1.7)
          bits/wordsize.h (1.3 -> 1.4) crt0.S (1.8 -> 1.9) ptrace.c (1.2
          -> 1.3) setjmp.S (1.2 -> 1.3) vfork.S (1.3 -> 1.4)
 Removed: bits/huge_val.h (1.3) bits/resource.h (1.3)

h8300 updates from Yoshinori Sato


Index: uClibc/libc/sysdeps/linux/h8300/Makefile
diff -u uClibc/libc/sysdeps/linux/h8300/Makefile:1.11 uClibc/libc/sysdeps/linux/h8300/Makefile:1.12
--- uClibc/libc/sysdeps/linux/h8300/Makefile:1.11	Sat Nov 22 14:21:56 2003
+++ uClibc/libc/sysdeps/linux/h8300/Makefile	Thu Jul 15 01:33:59 2004
@@ -19,6 +19,9 @@
 TOPDIR=../../../../
 include $(TOPDIR)Rules.mak
 ASFLAGS=$(CFLAGS)
+ifeq ($(DOPIC),y)
+ASFLAGS+=-D__PIC__
+endif
 
 #FIXME -- this arch should include its own crti.S and crtn.S
 UCLIBC_CTOR_DTOR=n
@@ -27,17 +30,17 @@
 CRT0_OBJ = crt0.o crt1.o
 CTOR_TARGETS=$(TOPDIR)lib/crti.o $(TOPDIR)lib/crtn.o
 
-SSRC=setjmp.S vfork.S # longjmp.S _start.S clone.S
+SSRC=__longjmp.S bsd-_setjmp.S bsd-setjmp.S clone.S setjmp.S vfork.S
 SOBJS=$(patsubst %.S,%.o, $(SSRC))
 
-CSRC=ptrace.c
+CSRC=ptrace.c brk.c
 COBJS=$(patsubst %.c,%.o, $(CSRC))
 
 OBJS=$(SOBJS) $(COBJS)
 
 all: $(OBJS) $(LIBC)
 
-$(LIBC): ar-target 
+$(LIBC): ar-target
 
 ar-target: $(OBJS) $(CRT0_OBJ) $(CTOR_TARGETS)
 	$(AR) $(ARFLAGS) $(LIBC) $(OBJS)
@@ -48,7 +51,7 @@
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
 $(SOBJS): %.o : %.S
-	$(CC) $(CFLAGS) -c $< -o $@
+	$(CC) $(ASFLAGS) -c $< -o $@
 	$(STRIPTOOL) -x -R .note -R .comment $*.o
 
 $(COBJS): %.o : %.c
@@ -83,7 +86,4 @@
 
 clean:
 	$(RM) *.[oa] *~ core
-ifneq ($(strip $(HAVE_ELF)),y)
-	$(RM) $(TOPDIR)/include/float.h
-endif
 
Index: uClibc/libc/sysdeps/linux/h8300/__longjmp.S
diff -u /dev/null uClibc/libc/sysdeps/linux/h8300/__longjmp.S:1.1
--- /dev/null	Thu Jul 15 01:34:00 2004
+++ uClibc/libc/sysdeps/linux/h8300/__longjmp.S	Thu Jul 15 01:33:59 2004
@@ -0,0 +1,26 @@
+#define _ASM
+#define _SETJMP_H
+#include <bits/setjmp.h>
+
+#ifdef __H8300S__
+	.h8300s
+#else
+	.h8300h
+#endif
+	.text
+	
+.global ___longjmp
+
+___longjmp:
+	mov.l	er1,er1
+	bne	1f
+	sub.l	er1,er1
+	inc.l	#1,er1
+1:
+	mov.l	@er0+,er4
+	mov.l	@er0+,er5
+	mov.l	@er0+,er6
+	mov.l	@er0+,sp
+	mov.l	@er0+,er3	; return PC
+	adds	#4,sp		; adjust return stack
+	jmp	@er3
Index: uClibc/libc/sysdeps/linux/h8300/bits/atomicity.h
diff -u /dev/null uClibc/libc/sysdeps/linux/h8300/bits/atomicity.h:1.1
--- /dev/null	Thu Jul 15 01:34:00 2004
+++ uClibc/libc/sysdeps/linux/h8300/bits/atomicity.h	Thu Jul 15 01:33:59 2004
@@ -0,0 +1,79 @@
+/* Low-level functions for atomic operations.  H8/300 version.
+   Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _ATOMICITY_H
+#define _ATOMICITY_H	1
+
+#include <inttypes.h>
+
+
+static inline uint32_t
+__attribute__ ((unused))
+exchange_and_add (volatile uint32_t *mem, uint32_t val)
+{
+  uint32_t result;
+  __asm__ __volatile__ ("stc ccr, at -sp\n\t"
+			"orc #0x80,ccr\n\t"
+			"mov.l %1,er1\n\t"
+			"mov.l %0,%1\n\t"
+			"add.l er1,%0\n\t"
+			"ldc @sp+,ccr"
+			: "=r" (result), "=m" (*mem) 
+			: "0" (val), "1" (*mem)
+			: "er1");
+  return result;
+}
+
+static inline void
+__attribute__ ((unused))
+atomic_add (volatile uint32_t *mem, int val)
+{
+  __asm__ __volatile__ ("stc ccr, at -sp\n\t"
+			"orc #0x80,ccr\n\t"
+			"mov.l %0,er0\n\t"
+			"add %1,er0\n\t"
+			"mov.l er0,%0\n\t"
+			"ldc @sp+,ccr"
+			: "=m" (*mem) 
+			: "r" (val), "0" (*mem)
+			: "er0");
+}
+
+static inline int
+__attribute__ ((unused))
+compare_and_swap (volatile long int *p, long int oldval, long int newval)
+{
+  int ret = 0;
+
+  __asm__ __volatile__ ("stc ccr, at -sp\n\t"
+			"orc #0x80,ccr\n\t"
+			"mov.l %1,er0\n\t"
+			"cmp.l %2,er0\n\t"
+			"bne 1f\n\t"
+			"mov.l %3,%1\n\t"
+			"inc.l #1,%0\n"
+			"1:\n\t"
+			"ldc @sp+,ccr"
+			: "=r"(ret),"=m"(*p)
+			: "r"(oldval),"r"(newval),"0"(ret),"1"(*p)
+			: "er0");
+  return ret;
+}
+
+#endif /* atomicity.h */
Index: uClibc/libc/sysdeps/linux/h8300/bits/huge_val.h
diff -u uClibc/libc/sysdeps/linux/h8300/bits/huge_val.h:1.3 uClibc/libc/sysdeps/linux/h8300/bits/huge_val.h:removed
--- uClibc/libc/sysdeps/linux/h8300/bits/huge_val.h:1.3	Mon Apr  1 04:44:33 2002
+++ uClibc/libc/sysdeps/linux/h8300/bits/huge_val.h	Thu Jul 15 01:34:01 2004
@@ -1,75 +0,0 @@
-/* `HUGE_VAL' constants for m68k (where it is infinity).
-   Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU 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 _MATH_H
-# error "Never use <bits/huge_val.h> directly; include <math.h> instead."
-#endif
-
-
-#include <features.h>
-#include <sys/cdefs.h>
-
-/* IEEE positive infinity (-HUGE_VAL is negative infinity).  */
-
-#ifdef	__GNUC__
-
-# define HUGE_VAL					\
-  (__extension__					\
-   ((union { unsigned long long __l; double __d; })	\
-    { __l: 0x7ff0000000000000ULL }).__d)
-
-#else /* not GCC */
-
-static union { unsigned char __c[8]; double __d; } __huge_val =
-  { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } };
-# define HUGE_VAL	(__huge_val.__d)
-
-#endif	/* GCC.  */
-
-
-/* ISO C 9X extensions: (float) HUGE_VALF and (long double) HUGE_VALL.  */
-
-#ifdef __USE_ISOC9X
-
-# ifdef __GNUC__
-
-#  define HUGE_VALF					\
-  (__extension__					\
-   ((union { unsigned long __l; float __f; })		\
-    { __l: 0x7f800000UL }).__f)
-
-#  define HUGE_VALL					\
-  (__extension__					\
-   ((union { unsigned long __l[3]; long double __ld; })	\
-    { __l: { 0x7fff0000UL, 0x80000000UL, 0UL } }).__ld)
-
-# else /* not GCC */
-
-static union { unsigned char __c[4]; float __f; } __huge_valf =
-  { { 0x7f, 0x80, 0, 0 } };
-#  define HUGE_VALF	(__huge_valf.__f)
-
-static union { unsigned char __c[12]; long double __ld; } __huge_vall =
-  { { 0x7f, 0xff, 0, 0, 0x80, 0, 0, 0, 0, 0, 0, 0 } };
-#  define HUGE_VALL	(__huge_vall.__ld)
-
-# endif	/* GCC.  */
-
-#endif	/* __USE_ISOC9X.  */
Index: uClibc/libc/sysdeps/linux/h8300/bits/kernel_stat.h
diff -u uClibc/libc/sysdeps/linux/h8300/bits/kernel_stat.h:1.3 uClibc/libc/sysdeps/linux/h8300/bits/kernel_stat.h:1.4
--- uClibc/libc/sysdeps/linux/h8300/bits/kernel_stat.h:1.3	Fri Jan 24 09:10:31 2003
+++ uClibc/libc/sysdeps/linux/h8300/bits/kernel_stat.h	Thu Jul 15 01:33:59 2004
@@ -38,13 +38,12 @@
 	unsigned int	st_nlink;
 	unsigned long	st_uid;
 	unsigned long	st_gid;
-	unsigned char	__pad2[6];
 	unsigned short	st_rdev;
-	unsigned char	__pad3[2];
+	unsigned char	__pad3[10];
 	long long	st_size;
 	unsigned long	st_blksize;
-	unsigned long	__pad4;		/* future possible st_blocks high bits */
 	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;
Index: uClibc/libc/sysdeps/linux/h8300/bits/kernel_types.h
diff -u uClibc/libc/sysdeps/linux/h8300/bits/kernel_types.h:1.2 uClibc/libc/sysdeps/linux/h8300/bits/kernel_types.h:1.3
--- uClibc/libc/sysdeps/linux/h8300/bits/kernel_types.h:1.2	Fri Feb  6 00:07:08 2004
+++ uClibc/libc/sysdeps/linux/h8300/bits/kernel_types.h	Thu Jul 15 01:33:59 2004
@@ -1,11 +1,11 @@
-/* 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_H8300_POSIX_TYPES_H
-#define __ARCH_H8300_POSIX_TYPES_H
+#ifndef _BITS_KERNEL_TYPES_H
+#define _BITS_KERNEL_TYPES_H
+
+/* Sigh.  We need to carefully wrap this one...  No guarantees
+ * that the asm/posix_types.h kernel header is working.  Many
+ * arches have broken headers that introduce tons of gratuitous
+ * conflicts with uClibc's namespace.   See bits/kernel_types.h
+ * for i386, arm, etc for examples... */
 
 typedef unsigned short	__kernel_dev_t;
 typedef unsigned long	__kernel_ino_t;
@@ -28,14 +28,10 @@
 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 __kernel_dev_t	__kernel_old_dev_t;
-
-#ifdef __GNUC__
 typedef long long	__kernel_loff_t;
-#endif
+typedef __kernel_dev_t	__kernel_old_dev_t;
 
 typedef struct {
 #ifdef __USE_ALL
@@ -45,4 +41,4 @@
 #endif
 } __kernel_fsid_t;
 
-#endif /* __ARCH_H8300_POSIX_TYPES_H */
+#endif /* _BITS_KERNEL_TYPES_H */
Index: uClibc/libc/sysdeps/linux/h8300/bits/mman.h
diff -u uClibc/libc/sysdeps/linux/h8300/bits/mman.h:1.3 uClibc/libc/sysdeps/linux/h8300/bits/mman.h:1.4
--- uClibc/libc/sysdeps/linux/h8300/bits/mman.h:1.3	Wed Nov 20 23:43:15 2002
+++ uClibc/libc/sysdeps/linux/h8300/bits/mman.h	Thu Jul 15 01:33:59 2004
@@ -1,5 +1,5 @@
-/* Definitions for BSD-style memory management.
-   Copyright (C) 1994-1998,2000,01 Free Software Foundation, Inc.
+/* 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
@@ -17,23 +17,23 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-/* These are the bits used by 4.4 BSD and its derivatives.  On systems
-   (such as GNU) where these facilities are not system services but can be
-   emulated in the C library, these are the definitions we emulate.  */
-
 #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_NONE	 0x00	/* No access.  */
-#define	PROT_READ	 0x01	/* Pages can be read.  */
-#define	PROT_WRITE	 0x02	/* Pages can be written.  */
-#define	PROT_EXEC	 0x04	/* Pages can be executed.  */
+#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.  */
Index: uClibc/libc/sysdeps/linux/h8300/bits/resource.h
diff -u uClibc/libc/sysdeps/linux/h8300/bits/resource.h:1.3 uClibc/libc/sysdeps/linux/h8300/bits/resource.h:removed
--- uClibc/libc/sysdeps/linux/h8300/bits/resource.h:1.3	Mon Apr  1 04:44:33 2002
+++ uClibc/libc/sysdeps/linux/h8300/bits/resource.h	Thu Jul 15 01:34:01 2004
@@ -1,204 +0,0 @@
-/* Bit values & structures for resource limits.  Linux version.
-   Copyright (C) 1994, 1996, 1997, 1998, 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 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 _SYS_RESOURCE_H
-# error "Never use <bits/resource.h> directly; include <sys/resource.h> instead."
-#endif
-
-#include <bits/types.h>
-
-/* 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 = 7,
-  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 = 6,
-#define RLIMIT_NPROC RLIMIT_NPROC
-
-  /* Locked-in-memory address space.  */
-  RLIMIT_MEMLOCK = 8,
-#define RLIMIT_MEMLOCK RLIMIT_MEMLOCK
-
-  RLIM_NLIMITS = 10
-#define RLIMIT_NLIMITS RLIMIT_NLIMITS
-#define RLIM_NLIMITS RLIM_NLIMITS
-};
-
-/* Value to indicate that there is no limit.  */
-#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
-
-/* 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
-
-  /* Both.  */
-  RUSAGE_BOTH = -2
-#define RUSAGE_BOTH RUSAGE_BOTH
-};
-
-#define __need_timeval
-#include <bits/time.h>		/* 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;
-    /* Amount of stack memory used (kilobyte-seconds).  */
-    long int ru_isrss;
-    /* Number of soft page faults (i.e. those serviced by reclaiming
-       a page from the list of pages awaiting reallocation.  */
-    long int ru_minflt;
-    /* Number of hard page faults (i.e. those that required I/O).  */
-    long int ru_majflt;
-    /* Number of times a process was swapped out of physical memory.  */
-    long int ru_nswap;
-    /* Number of input operations via the file system.  Note: This
-       and `ru_oublock' do not include operations with the cache.  */
-    long int ru_inblock;
-    /* Number of output operations via the file system.  */
-    long int ru_oublock;
-    /* Number of IPC messages sent.  */
-    long int ru_msgsnd;
-    /* Number of IPC messages received.  */
-    long int ru_msgrcv;
-    /* Number of signals delivered.  */
-    long int ru_nsignals;
-    /* Number of voluntary context switches, i.e. because the process
-       gave up the process before it had to (usually to wait for some
-       resource to be available).  */
-    long int ru_nvcsw;
-    /* Number of involuntary context switches, i.e. a higher priority process
-       became runnable or the current process used up its time slice.  */
-    long int ru_nivcsw;
-  };
-
-/* Priority limits.  */
-#define PRIO_MIN	-20	/* Minimum priority a process can have.  */
-#define PRIO_MAX	20	/* Maximum priority a process can have.  */
-
-/* The type of the WHICH argument to `getpriority' and `setpriority',
-   indicating what flavor of entity the WHO argument specifies.  */
-enum __priority_which
-{
-  PRIO_PROCESS = 0,		/* WHO is a process ID.  */
-#define PRIO_PROCESS PRIO_PROCESS
-  PRIO_PGRP = 1,		/* WHO is a process group ID.  */
-#define PRIO_PGRP PRIO_PGRP
-  PRIO_USER = 2			/* WHO is a user ID.  */
-#define PRIO_USER PRIO_USER
-};
Index: uClibc/libc/sysdeps/linux/h8300/bits/setjmp.h
diff -u uClibc/libc/sysdeps/linux/h8300/bits/setjmp.h:1.3 uClibc/libc/sysdeps/linux/h8300/bits/setjmp.h:1.4
--- uClibc/libc/sysdeps/linux/h8300/bits/setjmp.h:1.3	Mon Apr  1 04:44:34 2002
+++ uClibc/libc/sysdeps/linux/h8300/bits/setjmp.h	Thu Jul 15 01:33:59 2004
@@ -1,43 +1,27 @@
-/* Copyright (C) 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.  */
-
-/* Define the machine-dependent type `jmp_buf'.  H8/300H version.  */
+/* Copyright (C) 2004, Yoshinori Sato <ysato at users.sourceforge.jp> */
+/* Define the machine-dependent type `jmp_buf'.  H8/300 version.  */
 
 #ifndef _SETJMP_H
 # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
 #endif
 
-#include <signal.h>
+#ifndef	_ASM
 
 typedef struct
   {
-    /* er1-er5 */
-    long int __regs[5];
-
-    /* er6 */
-    int *__fp;
-    /* sp */
-    int *__sp;
-    /* pc */
-    void *__pc;
+    unsigned long __regs[4];  /* save er4 - er7(sp) */
+    unsigned long __pc;       /* the return address */
   } __jmp_buf[1];
 
+#endif /* _ASM */
+
+#define JB_REGS   0
+#define JB_PC     16
+#define JB_SIZE   20
+
+
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
 #define _JMPBUF_UNWINDS(jmpbuf, address) \
-  ((void *) (address) < (void *) (jmpbuf)->__sp)
+  ((void *) (address) < (void *) (jmpbuf)->__regs[3])
Index: uClibc/libc/sysdeps/linux/h8300/bits/sigcontextinfo.h
diff -u /dev/null uClibc/libc/sysdeps/linux/h8300/bits/sigcontextinfo.h:1.1
--- /dev/null	Thu Jul 15 01:34:01 2004
+++ uClibc/libc/sysdeps/linux/h8300/bits/sigcontextinfo.h	Thu Jul 15 01:33:59 2004
@@ -0,0 +1,26 @@
+/* Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Andreas Schwab <schwab at issan.informatik.uni-dortmund.de>, 1998.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#define SIGCONTEXT int _code, struct sigcontext *
+#define SIGCONTEXT_EXTRA_ARGS _code,
+#define GET_PC(ctx)	((void *) (ctx)->sc_pc)
+#define GET_FRAME(ctx)	((void *) __builtin_frame_address (1))
+#define GET_STACK(ctx)	((void *) (ctx)->sc_usp)
+#define CALL_SIGHANDLER(handler, signo, ctx) \
+  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
Index: uClibc/libc/sysdeps/linux/h8300/bits/stackinfo.h
diff -u /dev/null uClibc/libc/sysdeps/linux/h8300/bits/stackinfo.h:1.1
--- /dev/null	Thu Jul 15 01:34:01 2004
+++ uClibc/libc/sysdeps/linux/h8300/bits/stackinfo.h	Thu Jul 15 01:33:59 2004
@@ -0,0 +1,28 @@
+/* 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.  */
+
+/* This file contains a bit of information about the stack allocation
+   of the processor.  */
+
+#ifndef _STACKINFO_H
+#define _STACKINFO_H	1
+
+/* On h8300 the stack grows down.  */
+#define _STACK_GROWS_DOWN	1
+
+#endif	/* stackinfo.h */
Index: uClibc/libc/sysdeps/linux/h8300/bits/syscalls.h
diff -u uClibc/libc/sysdeps/linux/h8300/bits/syscalls.h:1.6 uClibc/libc/sysdeps/linux/h8300/bits/syscalls.h:1.7
--- uClibc/libc/sysdeps/linux/h8300/bits/syscalls.h:1.6	Wed Sep  4 23:29:39 2002
+++ uClibc/libc/sysdeps/linux/h8300/bits/syscalls.h	Thu Jul 15 01:33:59 2004
@@ -1,19 +1,157 @@
-#ifndef _BITS_SYSCALLS_H
-#define _BITS_SYSCALLS_H
+/* Unlike the asm/unistd.h kernel header file (which this is partly based on),
+ * this file must be able to cope with PIC and non-PIC code.  For some arches
+ * there is no difference.  For x86 (which has far too few registers) there is
+ * a difference.   Regardless, including asm/unistd.h is hereby officially
+ * forbidden.  Don't do it.  It is bad for you. 
+ */ 
 #ifndef _SYSCALL_H
 # error "Never use <bits/syscalls.h> directly; include <sys/syscall.h> instead."
 #endif
 
-#include <features.h>
-
-/* Do something very evil for now.  Until we create our own syscall
- * macros, short circuit bits/sysnum.h  and use asm/unistd.h instead */
-#include <asm/unistd.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>
 
-#endif /* _BITS_SYSCALLS_H */
+
+#define __syscall_return(type, res) \
+do { \
+	if ((unsigned long)(res) >= (unsigned long)(-125)) { \
+	/* avoid using res which is declared to be in register d0; \
+	   errno might expand to a function call and clobber it.  */ \
+		int __err = -(res); \
+		errno = __err; \
+		res = -1; \
+	} \
+	return (type) (res); \
+} while (0)
+
+#define _syscall0(type, name)							\
+type name(void)									\
+{										\
+  register long __res __asm__("er0");						\
+  __asm__ __volatile__ ("mov.l	%1,er0\n\t"					\
+  			"trapa	#0\n\t"						\
+			: "=r" (__res)						\
+			: "ir" (__NR_##name)					\
+			: "cc");						\
+  if ((unsigned long)(__res) >= (unsigned long)(-125)) {			\
+    errno = -__res;								\
+    __res = -1;									\
+  }										\
+  return (type)__res;								\
+}
+
+#define _syscall1(type, name, atype, a)						\
+type name(atype a)								\
+{										\
+  register long __res __asm__("er0");						\
+  __asm__ __volatile__ ("mov.l	%2, er1\n\t"					\
+  			"mov.l	%1, er0\n\t"					\
+  			"trapa	#0\n\t"						\
+			: "=r" (__res)						\
+			: "ir" (__NR_##name),					\
+			  "g" ((long)a)						\
+			: "cc", "er1");					\
+  if ((unsigned long)(__res) >= (unsigned long)(-125)) {			\
+    errno = -__res;								\
+    __res = -1;									\
+  }										\
+  return (type)__res;								\
+}
+
+#define _syscall2(type, name, atype, a, btype, b)				\
+type name(atype a, btype b)							\
+{										\
+  register long __res __asm__("er0");						\
+  __asm__ __volatile__ ("mov.l	%3, er2\n\t"					\
+  			"mov.l	%2, er1\n\t"					\
+			"mov.l	%1, er0\n\t"					\
+  			"trapa	#0\n\t"						\
+			: "=r" (__res)						\
+			: "ir" (__NR_##name),					\
+			  "g" ((long)a),					\
+			  "g" ((long)b)						\
+			: "cc", "er1", "er2"); 				\
+  if ((unsigned long)(__res) >= (unsigned long)(-125)) {			\
+    errno = -__res;								\
+    __res = -1;									\
+  }										\
+  return (type)__res;								\
+}
+
+#define _syscall3(type, name, atype, a, btype, b, ctype, c)			\
+type name(atype a, btype b, ctype c)						\
+{										\
+  register long __res __asm__("er0");						\
+  __asm__ __volatile__ ("mov.l	%4, er3\n\t"					\
+			"mov.l	%3, er2\n\t"					\
+  			"mov.l	%2, er1\n\t"					\
+			"mov.l	%1, er0\n\t"					\
+  			"trapa	#0\n\t"						\
+			: "=r" (__res)						\
+			: "ir" (__NR_##name),					\
+			  "g" ((long)a),					\
+			  "g" ((long)b),					\
+			  "g" ((long)c)						\
+			: "cc", "er1", "er2", "er3");  			\
+  if ((unsigned long)(__res) >= (unsigned long)(-125)) {			\
+    errno = -__res;								\
+    __res = -1;									\
+  }										\
+  return (type)__res;								\
+}
+
+#define _syscall4(type, name, atype, a, btype, b, ctype, c, dtype, d)		\
+type name(atype a, btype b, ctype c, dtype d)					\
+{										\
+  register long __res __asm__("er0");						\
+  __asm__ __volatile__ ("mov.l	%5, er4\n\t"					\
+			"mov.l	%4, er3\n\t"					\
+			"mov.l	%3, er2\n\t"					\
+  			"mov.l	%2, er1\n\t"					\
+			"mov.l	%1, er0\n\t"					\
+  			"trapa	#0\n\t"						\
+			: "=r" (__res)						\
+			: "ir" (__NR_##name),					\
+			  "g" ((long)a),					\
+			  "g" ((long)b),					\
+			  "g" ((long)c),					\
+			  "g" ((long)d)						\
+			: "cc", "er1", "er2", "er3", "er4");			\
+  if ((unsigned long)(__res) >= (unsigned long)(-125)) {			\
+    errno = -__res;								\
+    __res = -1;									\
+  }										\
+  return (type)__res;								\
+}
+
+#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 long __res __asm__("er0");						\
+  __asm__ __volatile__ ( \
+                        "mov.l  er5, at -sp\n\t"                                   \
+			"mov.l	%5, er4\n\t"					\
+			"mov.l	%4, er3\n\t"					\
+			"mov.l	%3, er2\n\t"					\
+  			"mov.l	%2, er1\n\t"					\
+			"mov.l	%1, er0\n\t"					\
+			"mov.l	%6, er5\n\t"					\
+  			"trapa	#0\n\t"						\
+                       "mov.l  @sp+,er5\n\t"                                   \
+			: "=r" (__res)						\
+			: "ir" (__NR_##name),					\
+			  "g" ((long)a),					\
+			  "g" ((long)b),					\
+			  "g" ((long)c),					\
+			  "g" ((long)d),					\
+			  "m" ((long)e)						\
+			: "cc", "er1", "er2", "er3", "er4");		        \
+  if ((unsigned long)(__res) >= (unsigned long)(-125)) {		       	\
+    errno = -__res;								\
+    __res = -1;									\
+  }										\
+  return (type)__res;								\
+}
 
Index: uClibc/libc/sysdeps/linux/h8300/bits/wordsize.h
diff -u uClibc/libc/sysdeps/linux/h8300/bits/wordsize.h:1.3 uClibc/libc/sysdeps/linux/h8300/bits/wordsize.h:1.4
--- uClibc/libc/sysdeps/linux/h8300/bits/wordsize.h:1.3	Mon Apr  1 04:44:34 2002
+++ uClibc/libc/sysdeps/linux/h8300/bits/wordsize.h	Thu Jul 15 01:33:59 2004
@@ -1,19 +1 @@
-/* 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
+#define __WORDSIZE 32
Index: uClibc/libc/sysdeps/linux/h8300/brk.c
diff -u /dev/null uClibc/libc/sysdeps/linux/h8300/brk.c:1.1
--- /dev/null	Thu Jul 15 01:34:01 2004
+++ uClibc/libc/sysdeps/linux/h8300/brk.c	Thu Jul 15 01:33:59 2004
@@ -0,0 +1,33 @@
+/* brk on H8/300 by ysato */
+
+#include <errno.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+
+/* This must be initialized data because commons can't have aliases.  */
+void *___brk_addr = 0;
+
+
+int brk (void *addr)
+{
+    void *newbrk;
+
+    asm ("mov.l %2,er1\n\t"
+	 "mov.l %1,er0\n\t"
+	 "trapa #0\n\t"
+	 "mov.l er0,%0"
+	 : "=r" (newbrk)
+	 : "0" (__NR_brk), "g" (addr)
+	 : "er0","er1");
+
+    ___brk_addr = newbrk;
+
+    if (newbrk < addr)
+    {
+	__set_errno (ENOMEM);
+	return -1;
+    }
+
+    return 0;
+}
Index: uClibc/libc/sysdeps/linux/h8300/bsd-_setjmp.S
diff -u /dev/null uClibc/libc/sysdeps/linux/h8300/bsd-_setjmp.S:1.1
--- /dev/null	Thu Jul 15 01:34:01 2004
+++ uClibc/libc/sysdeps/linux/h8300/bsd-_setjmp.S	Thu Jul 15 01:33:59 2004
@@ -0,0 +1,27 @@
+/* BSD `_setjmp' entry point to `sigsetjmp (..., 0)'.  H8/300 version. */
+
+#define _ASM
+#define _SETJMP_H
+#include <bits/setjmp.h>
+
+#ifdef __H8300S__
+	.h8300s
+#else
+	.h8300h
+#endif
+	.text
+	
+.global __setjmp
+
+__setjmp:
+	add.l	#JB_SIZE,er0
+	mov.l	@sp,er1		; return PC
+	mov.l	er1, at -er0
+	mov.l	sp, at -er0
+	mov.l	er6, at -er0
+	mov.l	er5, at -er0
+	mov.l	er4, at -er0
+	mov.l	er0,er1
+	sub.l	er0,er0
+	mov.l	er0,@(JB_SIZE:16,er1)
+	rts
Index: uClibc/libc/sysdeps/linux/h8300/bsd-setjmp.S
diff -u /dev/null uClibc/libc/sysdeps/linux/h8300/bsd-setjmp.S:1.1
--- /dev/null	Thu Jul 15 01:34:01 2004
+++ uClibc/libc/sysdeps/linux/h8300/bsd-setjmp.S	Thu Jul 15 01:33:59 2004
@@ -0,0 +1,30 @@
+/* BSD `_setjmp' entry point to `sigsetjmp (..., 1)'.  H8/300 version. */
+
+#define _ASM
+#define _SETJMP_H
+#include <bits/setjmp.h>
+
+#ifdef __H8300S__
+	.h8300s
+#else
+	.h8300h
+#endif
+	.text
+	
+.global _setjmp
+
+_setjmp:
+	add.l	#JB_SIZE,er0
+	mov.l	@sp,er1		; return PC
+	mov.l	er1, at -er0
+	mov.l	sp, at -er0
+	mov.l	er6, at -er0
+	mov.l	er5, at -er0
+	mov.l	er4, at -er0
+	sub.l	er0,er0
+#if !defined(__PIC__)
+	jmp	@___sigjmp_save
+#else
+	mov.l	@(___sigjmp_save at GOTOFF,er5),er1
+	jmp	@er3
+#endif
Index: uClibc/libc/sysdeps/linux/h8300/clone.S
diff -u /dev/null uClibc/libc/sysdeps/linux/h8300/clone.S:1.1
--- /dev/null	Thu Jul 15 01:34:01 2004
+++ uClibc/libc/sysdeps/linux/h8300/clone.S	Thu Jul 15 01:33:59 2004
@@ -0,0 +1,78 @@
+/* Adapted from glibc */
+/* Copyright (C) 1996, 1997 Free Software Foundation, Inc. */
+
+/* clone is even more special than fork as it mucks with stacks
+   and invokes a function in the right context after its all over.  */
+
+#define _ERRNO_H
+#include <bits/errno.h>
+#include <sys/syscall.h>
+
+/* int _clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
+
+#ifdef __H8300H__
+	.h8300h
+#endif
+#ifdef __H8300S__
+	.h8300s
+#endif
+
+.text
+.globl	_clone
+.globl	___clone
+_clone:
+___clone:
+	/* Sanity check arguments.  */
+	mov.l	#-EINVAL,er3
+	mov.l	er0,er0			/* no NULL function pointers */
+	beq	__syscall_error
+	mov.l	er1,er1			/* no NULL stack pointers */
+	beq	__syscall_error
+
+	/* Allocate space and copy the argument onto the new stack.  */
+	mov.l	@(4:16,sp),er3
+	mov.l	er3, at -er1
+
+	/* Do the system call */
+	mov.l	er0,er3			/* er3 = child entry */
+	mov.l	er1,er0
+	mov.l	er2,er1			/* er1 = flags */
+	mov.l	er0,er2			/* er2 = child sp */
+	mov.l	#__NR_clone,r0
+	trapa	#0
+	mov.l	er0,er0
+	bmi	__syscall_error
+	beq	thread_start
+
+	rts
+
+__syscall_error:
+	neg.l	er0
+	mov.l	er0, at -sp
+#if !defined(__PIC__)
+	jsr	@__errno_location
+#else
+	mov.l	@(__errno_location at GOTOFF,er5),er1
+	jsr	@er1
+#endif
+	mov.l	@sp,er1
+	mov.l	er1, at er0
+	sub.l	er0,er0
+	dec.l	#1,er0
+
+	rts
+
+thread_start:
+	mov.l	@sp+,er0		/* restore args */
+	jsr     @er3
+	mov.l	er0,er1
+	mov.l	#__NR_exit,er0
+	trapa	#0
+
+#if defined(__HAVE_ELF__)
+	.weak clone
+	clone = __clone
+#else
+	.set clone,__clone
+#endif
+
Index: uClibc/libc/sysdeps/linux/h8300/crt0.S
diff -u uClibc/libc/sysdeps/linux/h8300/crt0.S:1.8 uClibc/libc/sysdeps/linux/h8300/crt0.S:1.9
--- uClibc/libc/sysdeps/linux/h8300/crt0.S:1.8	Fri May 14 04:51:02 2004
+++ uClibc/libc/sysdeps/linux/h8300/crt0.S	Thu Jul 15 01:33:59 2004
@@ -36,7 +36,12 @@
 	mov.l	@(0,sp),er0	/* argc */
 	mov.l	@(4,sp),er1	/* argv */
 	mov.l	@(8,sp),er2	/* envp */
+#if !defined(__PIC__)
 	jsr	@___uClibc_main
+#else
+	mov.l	@(___uClibc_main at GOTOFF,er5),er3
+	jsr	@er3
+#endif
 
 	/* If that didn't kill us, ... */
 __exit:
Index: uClibc/libc/sysdeps/linux/h8300/crti.S
diff -u /dev/null uClibc/libc/sysdeps/linux/h8300/crti.S:1.1
--- /dev/null	Thu Jul 15 01:34:01 2004
+++ uClibc/libc/sysdeps/linux/h8300/crti.S	Thu Jul 15 01:33:59 2004
@@ -0,0 +1,30 @@
+#ifdef __H8300H__
+	.h8300h
+#endif
+#ifdef __H8300S__
+	.h8300s
+#endif
+	.file	"initfini.c"
+; #APP
+
+	.section .init
+; #NO_APP
+	.align 1
+	.global __init
+__init:
+	mov.l	er6, at -er7
+	mov.l	er7,er6
+; #APP
+	.align 1
+
+	.section .fini
+; #NO_APP
+	.align 1
+	.global __fini
+__fini:
+	mov.l	er6, at -er7
+	mov.l	er7,er6
+; #APP
+	.align 1
+
+	.end
Index: uClibc/libc/sysdeps/linux/h8300/crtn.S
diff -u /dev/null uClibc/libc/sysdeps/linux/h8300/crtn.S:1.1
--- /dev/null	Thu Jul 15 01:34:01 2004
+++ uClibc/libc/sysdeps/linux/h8300/crtn.S	Thu Jul 15 01:33:59 2004
@@ -0,0 +1,30 @@
+#ifdef __H8300H__
+	.h8300h
+#endif
+#ifdef __H8300S__
+	.h8300s
+#endif
+	.file	"initfini.c"
+; #APP
+
+	.section .init
+; #NO_APP
+	.align 1
+	.global __init
+; #NO_APP
+	mov.l	@er7+,er6
+	rts
+	.size	__init, .-__init
+; #APP
+
+	.section .fini
+; #NO_APP
+	.align 1
+	.global __fini
+; #NO_APP
+	mov.l	@er7+,er6
+	rts
+	.size	__fini, .-__fini
+; #APP
+
+	.end
Index: uClibc/libc/sysdeps/linux/h8300/pt-machine.h
diff -u /dev/null uClibc/libc/sysdeps/linux/h8300/pt-machine.h:1.1
--- /dev/null	Thu Jul 15 01:34:01 2004
+++ uClibc/libc/sysdeps/linux/h8300/pt-machine.h	Thu Jul 15 01:33:59 2004
@@ -0,0 +1,58 @@
+/* Machine-dependent pthreads configuration and inline functions.
+   H8/300 version.
+   Copyright (C) 1996, 1998, 2000, 2002 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Richard Henderson <rth at 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; 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 _PT_MACHINE_H
+#define _PT_MACHINE_H   1
+
+#ifndef PT_EI
+# define PT_EI extern inline
+#endif
+
+extern long int testandset (int *spinlock);
+
+/* Spinlock implementation; required.  */
+PT_EI long int
+testandset (int *spinlock)
+{
+  char ret;
+
+  __asm__ __volatile__(
+      "sub.w %0,%0\n\t"
+      "stc ccr, at -sp\n\t"
+      "orc #0x80,ccr\n\t"
+      "bld #0,@%2\n\t"
+      "bset #0,@%2\n\t"
+      "rotxl.w %0\n\t"
+      "ldc @sp+,ccr\n\t"
+      :"=r"(ret),"=m"(*spinlock)
+      :"g"(spinlock)
+      :"cc");
+
+  return ret;
+}
+
+
+/* Get some notion of the current stack.  Need not be exactly the top
+   of the stack, just something somewhere in the current frame.  */
+#define CURRENT_STACK_FRAME  stack_pointer
+register char * stack_pointer __asm__ ("%sp");
+
+#endif /* pt-machine.h */
Index: uClibc/libc/sysdeps/linux/h8300/ptrace.c
diff -u uClibc/libc/sysdeps/linux/h8300/ptrace.c:1.2 uClibc/libc/sysdeps/linux/h8300/ptrace.c:1.3
--- uClibc/libc/sysdeps/linux/h8300/ptrace.c:1.2	Sat Feb 16 13:03:25 2002
+++ uClibc/libc/sysdeps/linux/h8300/ptrace.c	Thu Jul 15 01:33:59 2004
@@ -1,24 +1,15 @@
 
 #include <errno.h>
 #include <asm/ptrace.h>
-#include <sys/syscall.h>
-#include <stdarg.h>
+#include <asm/unistd.h>
 
 int
-ptrace(int request, ... /* int pid, int addr, int data */)
+ptrace(int request, int pid, int addr, int data)
 {
-	long ret;
-	long res;
-	int pid,addr,data;
-	va_list ap;
+	int ret;
+	int res;
 
-	va_start(ap,request);
-	pid  = va_arg(ap,int);
-	addr = va_arg(ap,int);
-	data = va_arg(ap,int);
-	va_end(ap);
-
-	if (request > 0 && request < 4) (long *)data = &ret;
+	if (request > 0 && request < 4) data = (int)&ret;
 
 	__asm__ volatile ("sub.l er0,er0\n\t"
                           "mov.b %1,r0l\n\t"
@@ -30,7 +21,8 @@
 			  "mov.l er0,%0"
 		:"=g" (res)
 		:"i" (__NR_ptrace), "g" (request), "g" (pid),
-		 "g" (addr), "g" (data) : "er0", "er1", "er2", "er3", "er4");
+		 "g" (addr), "g" (data)
+		: "er0", "er1", "er2", "er3", "er4");
 
 	if (res >= 0) {
 		if (request > 0 && request < 4) {
Index: uClibc/libc/sysdeps/linux/h8300/setjmp.S
diff -u uClibc/libc/sysdeps/linux/h8300/setjmp.S:1.2 uClibc/libc/sysdeps/linux/h8300/setjmp.S:1.3
--- uClibc/libc/sysdeps/linux/h8300/setjmp.S:1.2	Tue Apr 29 08:46:31 2003
+++ uClibc/libc/sysdeps/linux/h8300/setjmp.S	Thu Jul 15 01:33:59 2004
@@ -1,49 +1,23 @@
+#define _ASM
+#define _SETJMP_H
+#include <bits/setjmp.h>
+
 #ifdef __H8300S__
 	.h8300s
 #else
 	.h8300h
 #endif
 	.text
-	
-.global __setjmp
+
 .global ___sigsetjmp
-.global ___longjmp
 
-__setjmp:
 ___sigsetjmp:
-	add.l	#20,er0
-	mov.l	er6, at er0
+	add.l	#JB_SIZE,er0
+	mov.l	@sp,er1		; return PC
+	mov.l	er1, at -er0
+	mov.l	sp, at -er0
+	mov.l	er6, at -er0
 	mov.l	er5, at -er0
 	mov.l	er4, at -er0
-	mov.l	er3, at -er0
-	mov.l	er2, at -er0
-	mov.l	er1, at -er0
-	mov.l	sp,@(24,er0)
-	mov.l	@sp,er1
-	mov.l	er1,@(28,er0)
 	sub.l	er0,er0
 	rts
-
-___longjmp:
-	mov.l	er1,er1
-	bne	1f
-	sub.l	er1,er1
-	inc.l	#1,er1
-1:
-	adds	#4,er0
-	adds	#4,er0
-	mov.l	@er0+,er3
-	mov.l	@er0+,er4
-	mov.l	@er0+,er5
-	mov.l	@er0+,er6
-	mov.l	@er0+,sp
-	mov.l	@er0,er2
-	mov.l	er2, at sp
-	mov.l	er1,er2
-	mov.l	er0,er1
-	mov.l	er2,er0
-	sub.l	#28,er1
-	mov.l	@(4,er1),er2
-	mov.l	@er1,er1
-	rts
-
Index: uClibc/libc/sysdeps/linux/h8300/sys/procfs.h
diff -u /dev/null uClibc/libc/sysdeps/linux/h8300/sys/procfs.h:1.1
--- /dev/null	Thu Jul 15 01:34:01 2004
+++ uClibc/libc/sysdeps/linux/h8300/sys/procfs.h	Thu Jul 15 01:34:00 2004
@@ -0,0 +1,126 @@
+/* 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.  */
+
+#include <features.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/user.h>
+
+__BEGIN_DECLS
+
+/* Type for a general-purpose register.  */
+typedef unsigned long elf_greg_t;
+
+/* And the whole bunch of them.  We could have used `struct
+   user_regs_struct' directly in the typedef, but tradition says that
+   the register set is an array, which does have some peculiar
+   semantics, so leave it that way.  */
+#define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+/* Register set for the floating-point registers.  */
+typedef struct user_m68kfp_struct elf_fpregset_t;
+
+
+/* Signal info.  */
+struct elf_siginfo
+  {
+    int si_signo;			/* Signal number.  */
+    int si_code;			/* Extra code.  */
+    int si_errno;			/* Errno.  */
+  };
+
+
+/* Definitions to generate Intel SVR4-like core files.  These mostly
+   have the same names as the SVR4 types with "elf_" tacked on the
+   front to prevent clashes with Linux definitions, and the typedef
+   forms have been avoided.  This is mostly like the SVR4 structure,
+   but more Linuxy, with things that Linux does not support and which
+   GDB doesn't really use excluded.  */
+
+struct elf_prstatus
+  {
+    struct elf_siginfo pr_info;		/* Info associated with signal.  */
+    short int pr_cursig;		/* Current signal.  */
+    unsigned long int pr_sigpend;	/* Set of pending signals.  */
+    unsigned long int pr_sighold;	/* Set of held signals.  */
+    __pid_t pr_pid;
+    __pid_t pr_ppid;
+    __pid_t pr_pgrp;
+    __pid_t pr_sid;
+    struct timeval pr_utime;		/* User time.  */
+    struct timeval pr_stime;		/* System time.  */
+    struct timeval pr_cutime;		/* Cumulative user time.  */
+    struct timeval pr_cstime;		/* Cumulative system time.  */
+    elf_gregset_t pr_reg;		/* GP registers.  */
+    int pr_fpvalid;			/* True if math copro being used.  */
+  };
+
+
+#define ELF_PRARGSZ     (80)    /* Number of chars for args.  */
+
+struct elf_prpsinfo
+  {
+    char pr_state;			/* Numeric process state.  */
+    char pr_sname;			/* Char for pr_state.  */
+    char pr_zomb;			/* Zombie.  */
+    char pr_nice;			/* Nice val.  */
+    unsigned long int pr_flag;		/* Flags.  */
+    unsigned short int pr_uid;
+    unsigned short int pr_gid;
+    int pr_pid, pr_ppid, pr_pgrp, pr_sid;
+    /* Lots missing */
+    char pr_fname[16];			/* Filename of executable.  */
+    char pr_psargs[ELF_PRARGSZ];	/* Initial part of arg list.  */
+  };
+
+
+/* The rest of this file provides the types for emulation of the
+   Solaris <proc_service.h> interfaces that should be implemented by
+   users of libthread_db.  */
+
+/* Addresses.  */
+typedef void *psaddr_t;
+
+/* Register sets.  Linux has different names.  */
+typedef elf_gregset_t prgregset_t;
+typedef elf_fpregset_t prfpregset_t;
+
+/* We don't have any differences between processes and threads,
+   therefore have only one PID type.  */
+typedef __pid_t lwpid_t;
+
+/* Process status and info.  In the end we do provide typedefs for them.  */
+typedef struct elf_prstatus prstatus_t;
+typedef struct elf_prpsinfo prpsinfo_t;
+
+__END_DECLS
+
+#endif	/* sys/procfs.h */
Index: uClibc/libc/sysdeps/linux/h8300/vfork.S
diff -u uClibc/libc/sysdeps/linux/h8300/vfork.S:1.3 uClibc/libc/sysdeps/linux/h8300/vfork.S:1.4
--- uClibc/libc/sysdeps/linux/h8300/vfork.S:1.3	Tue Apr 29 08:46:31 2003
+++ uClibc/libc/sysdeps/linux/h8300/vfork.S	Thu Jul 15 01:33:59 2004
@@ -28,7 +28,12 @@
 	jmp	@er1                     /* don't return,  just jmp directly */
 fix_errno:
 	neg.l	er0
+#if !defined(__PIC__)
 	mov.l	er0, at _errno
+#else
+	mov.l	@(_errno at GOTOFF,er5),er2
+	mov.l	er0, at er2
+#endif
 	sub.l	er0,er0
 	dec.l	#1,er0
 	jmp	@er1                     /* don't return,  just jmp directly */



More information about the uClibc-cvs mailing list