This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Sparc fixes


Hi!

sparc64 clone was broken in both glibc (patch below) and in the kernel (will
commit soon), now all threading tests pass on sparc64 :).
Besides this, this patch tries to unify the headers Thorsten complained
about, with exception of bits/syscall.h (need to find out how sparc* can
override that bits/syscall.h rule) and gnu/stubs.h (no idea so far how to do that
actually).

2000-09-26  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/sparc/sparc32/bits/endian.h: Remove.
	* sysdeps/sparc/sparc32/ieee754.h: New.
	* sysdeps/sparc/sparc64/bits/endian.h: Move...
	* sysdeps/sparc/bits/endian.h: ...here.
	* sysdeps/unix/sysv/linux/sparc/sparc32/clone.S (__clone): Optimize.
	* sysdeps/unix/sysv/linux/sparc/sparc64/clone.S (__clone): Check
	%o1, not %o0 to see if we're parent or child.  Optimize.

--- libc/sysdeps/sparc/sparc32/bits/endian.h.jj	Tue Jan  4 17:11:59 2000
+++ libc/sysdeps/sparc/sparc32/bits/endian.h	Tue Sep 26 17:02:10 2000
@@ -1,7 +0,0 @@
-/* SPARC is big-endian.  */
-
-#ifndef _ENDIAN_H
-# error "Never use <bits/endian.h> directly; include <endian.h> instead."
-#endif
-
-#define __BYTE_ORDER __BIG_ENDIAN
--- libc/sysdeps/sparc/sparc32/ieee754.h.jj	Tue Sep 26 17:20:54 2000
+++ libc/sysdeps/sparc/sparc32/ieee754.h	Tue Jan  4 17:11:56 2000
@@ -0,0 +1,171 @@
+/* Copyright (C) 1992, 1995, 1996, 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 _IEEE754_H
+
+#define _IEEE754_H 1
+#include <features.h>
+
+#include <endian.h>
+
+__BEGIN_DECLS
+
+union ieee754_float
+  {
+    float f;
+
+    /* This is the IEEE 754 single-precision format.  */
+    struct
+      {
+#if	__BYTE_ORDER == __BIG_ENDIAN
+	unsigned int negative:1;
+	unsigned int exponent:8;
+	unsigned int mantissa:23;
+#endif				/* Big endian.  */
+#if	__BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int mantissa:23;
+	unsigned int exponent:8;
+	unsigned int negative:1;
+#endif				/* Little endian.  */
+      } ieee;
+
+    /* This format makes it easier to see if a NaN is a signalling NaN.  */
+    struct
+      {
+#if	__BYTE_ORDER == __BIG_ENDIAN
+	unsigned int negative:1;
+	unsigned int exponent:8;
+	unsigned int quiet_nan:1;
+	unsigned int mantissa:22;
+#endif				/* Big endian.  */
+#if	__BYTE_ORDER == __LITTLE_ENDIAN
+	unsigned int mantissa:22;
+	unsigned int quiet_nan:1;
+	unsigned int exponent:8;
+	unsigned int negative:1;
+#endif				/* Little endian.  */
+      } ieee_nan;
+  };
+
+#define IEEE754_FLOAT_BIAS	0x7f /* Added to exponent.  */
+
+
+union ieee754_double
+  {
+    double d;
+
+    /* This is the IEEE 754 double-precision format.  */
+    struct
+      {
+#if	__BYTE_ORDER == __BIG_ENDIAN
+	unsigned int negative:1;
+	unsigned int exponent:11;
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa0:20;
+	unsigned int mantissa1:32;
+#endif				/* Big endian.  */
+#if	__BYTE_ORDER == __LITTLE_ENDIAN
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa1:32;
+	unsigned int mantissa0:20;
+	unsigned int exponent:11;
+	unsigned int negative:1;
+#endif				/* Little endian.  */
+      } ieee;
+
+    /* This format makes it easier to see if a NaN is a signalling NaN.  */
+    struct
+      {
+#if	__BYTE_ORDER == __BIG_ENDIAN
+	unsigned int negative:1;
+	unsigned int exponent:11;
+	unsigned int quiet_nan:1;
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa0:19;
+	unsigned int mantissa1:32;
+#else
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa1:32;
+	unsigned int mantissa0:19;
+	unsigned int quiet_nan:1;
+	unsigned int exponent:11;
+	unsigned int negative:1;
+#endif
+      } ieee_nan;
+  };
+
+#define IEEE754_DOUBLE_BIAS	0x3ff /* Added to exponent.  */
+
+
+union ieee854_long_double
+  {
+    long double d;
+
+    /* This is the IEEE 854 quad-precision format.  */
+    struct
+      {
+#if	__BYTE_ORDER == __BIG_ENDIAN
+	unsigned int negative:1;
+	unsigned int exponent:15;
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa0:16;
+	unsigned int mantissa1:32;
+	unsigned int mantissa2:32;
+	unsigned int mantissa3:32;
+#endif				/* Big endian.  */
+#if	__BYTE_ORDER == __LITTLE_ENDIAN
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa3:32;
+	unsigned int mantissa2:32;
+	unsigned int mantissa1:32;
+	unsigned int mantissa0:16;
+	unsigned int exponent:15;
+	unsigned int negative:1;
+#endif				/* Little endian.  */
+      } ieee;
+
+    /* This format makes it easier to see if a NaN is a signalling NaN.  */
+    struct
+      {
+#if	__BYTE_ORDER == __BIG_ENDIAN
+	unsigned int negative:1;
+	unsigned int exponent:15;
+	unsigned int quiet_nan:1;
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa0:15;
+	unsigned int mantissa1:32;
+	unsigned int mantissa2:32;
+	unsigned int mantissa3:32;
+#else
+	/* Together these comprise the mantissa.  */
+	unsigned int mantissa3:32;
+	unsigned int mantissa2:32;
+	unsigned int mantissa1:32;
+	unsigned int mantissa0:15;
+	unsigned int quiet_nan:1;
+	unsigned int exponent:15;
+	unsigned int negative:1;
+#endif
+      } ieee_nan;
+  };
+
+#define IEEE854_LONG_DOUBLE_BIAS 0x3fff /* Added to exponent.  */
+
+__END_DECLS
+
+#endif /* ieee754.h */
--- libc/sysdeps/sparc/sparc64/bits/endian.h.jj	Tue Jan  4 17:11:59 2000
+++ libc/sysdeps/sparc/sparc64/bits/endian.h	Tue Sep 26 17:01:55 2000
@@ -1,12 +0,0 @@
-/* Sparc is big-endian, but v9 supports endian conversion on loads/stores
-   and GCC supports such a mode.  Be prepared.  */
-
-#ifndef _ENDIAN_H
-# error "Never use <bits/endian.h> directly; include <endian.h> instead."
-#endif
-
-#ifdef __LITTLE_ENDIAN__
-# define __BYTE_ORDER __LITTLE_ENDIAN
-#else
-# define __BYTE_ORDER __BIG_ENDIAN
-#endif
--- libc/sysdeps/sparc/bits/endian.h.jj	Tue Sep 26 17:01:49 2000
+++ libc/sysdeps/sparc/bits/endian.h	Tue Jan  4 17:11:59 2000
@@ -0,0 +1,12 @@
+/* Sparc is big-endian, but v9 supports endian conversion on loads/stores
+   and GCC supports such a mode.  Be prepared.  */
+
+#ifndef _ENDIAN_H
+# error "Never use <bits/endian.h> directly; include <endian.h> instead."
+#endif
+
+#ifdef __LITTLE_ENDIAN__
+# define __BYTE_ORDER __LITTLE_ENDIAN
+#else
+# define __BYTE_ORDER __BIG_ENDIAN
+#endif
--- libc/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S.jj	Tue Jan  4 17:12:06 2000
+++ libc/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S	Sat Sep 23 20:19:59 2000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
    Contributed by Richard Henderson (rth@tamu.edu).
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -35,30 +35,26 @@ __clone:
 	/* sanity check arguments */
 	tst	%i0
 	be	.Lerror
-	 tst	%i1
+	 orcc	%i1,%g0,%o1
 	be	.Lerror
-	 nop
+	 mov	%i2,%o0
 
 	/* Do the system call */
-	mov	%i1,%o1
-	mov	%i2,%o0
 	set	__NR_clone,%g1
 	ta	0x10
 	bcs	.Lerror
 	 tst	%o1
 	bne	__thread_start
 	 nop
-	mov	%o0,%i0
 	ret
-	 restore
+	 restore %o0,%g0,%o0
 
 .Lerror:
 	call	__errno_location
 	 or	%g0,EINVAL,%i0
 	st	%i0,[%o0]
-	mov	-1,%i0
 	ret
-	 restore
+	 restore %g0,-1,%o0
 
 	.size	__clone, .-__clone
 
--- libc/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S.jj	Tue Jan  4 17:12:06 2000
+++ libc/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S	Tue Sep 26 15:24:59 2000
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 2000 Free Software Foundation, Inc.
    Contributed by Richard Henderson (rth@tamu.edu).
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -45,7 +45,7 @@ __clone:
 	ta	0x6d
 	bcs,pn	%xcc, 99f
 	 nop
-	brnz,pn	%o0, __thread_start
+	brnz,pn	%o1, __thread_start
 	 mov	%o0, %i0
 	ret
 	 restore
@@ -70,9 +70,8 @@ __clone:
 	 nop
 	st	%i0, [%o0]
 #endif
-	mov	-1,%i0
 	ret
-	 restore
+	 restore %g0,-1,%o0
 	.size __clone, .-__clone
 
 	.type __thread_start,@function

	Jakub

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]