about summary refs log tree commit diff
path: root/sysdeps/sparc
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/sparc')
-rw-r--r--sysdeps/sparc/dl-machine.h9
-rw-r--r--sysdeps/sparc/elf/start.c2
-rw-r--r--sysdeps/sparc/fpu_control.h24
-rw-r--r--sysdeps/sparc/setjmp.S8
-rw-r--r--sysdeps/sparc/udiv_qrnnd.S2
5 files changed, 18 insertions, 27 deletions
diff --git a/sysdeps/sparc/dl-machine.h b/sysdeps/sparc/dl-machine.h
index ceaf9eedce..1ab3762ea0 100644
--- a/sysdeps/sparc/dl-machine.h
+++ b/sysdeps/sparc/dl-machine.h
@@ -295,10 +295,10 @@ _start:\n\
   or    %l2,%lo(_GLOBAL_OFFSET_TABLE_-(2b-.)),%l2\n\
   or    %l3,%lo(_dl_default_scope),%l3\n\
   add   %o7,%l2,%l1\n\
-  # %l1 has the GOT. %l3 has _dl_default_scope offset\n\
-  # Now, load _dl_default_scope [2]\n\
-  add   %l3,4,%l3\n\
+  # %l1 has the GOT. %l3 has _dl_default_scope GOT offset\n\
   ld    [%l1+%l3],%l4\n\
+  # %l4 has pointer to _dl_default_scope.  Now, load _dl_default_scope [2]\n\
+  ld    [%l4+8],%l4\n\
   # %l4 has _dl_default_scope [2]\n\
   # call _dl_init_next until it returns 0, pass _dl_default_scope [2]\n\
 3:\n\
@@ -308,7 +308,8 @@ _start:\n\
   bz,a  4f\n\
    nop\n\
   call  %o0\n\
-   nop\n\
+  /* Pass pointer to argument block to this init function */\n\
+   add %sp,64,%o0\n\
   b,a   3b\n\
 4:\n\
   # Clear the _dl_starting_up variable and pass _dl_fini in %g1 as per ELF ABI.\n\
diff --git a/sysdeps/sparc/elf/start.c b/sysdeps/sparc/elf/start.c
index f9c97f89bc..f1e80195ca 100644
--- a/sysdeps/sparc/elf/start.c
+++ b/sysdeps/sparc/elf/start.c
@@ -60,8 +60,8 @@ _start (void)
 #ifdef ELF_INIT_FINI
   {
     extern void _fini (void);
-    atexit (_fini);
     _init ();
+    atexit (_fini);
   }
 #endif
   exit (main (argc, argv, envp));
diff --git a/sysdeps/sparc/fpu_control.h b/sysdeps/sparc/fpu_control.h
index cfd85844c3..5ef3824702 100644
--- a/sysdeps/sparc/fpu_control.h
+++ b/sysdeps/sparc/fpu_control.h
@@ -31,12 +31,12 @@
 #define _FPU_SINGLE   0x10000000     /* DO NOT USE */
 
 /* rounding control / Sparc */
-#define _FPU_RC_NEAREST 0x0        /* RECOMMENDED */
-#define _FPU_RC_DOWN    0x80000000
-#define _FPU_RC_UP      0xc0000000
+#define _FPU_RC_DOWN    0xc0000000
+#define _FPU_RC_UP      0x80000000
 #define _FPU_RC_ZERO    0x40000000
+#define _FPU_RC_NEAREST 0x0        /* RECOMMENDED */
 
-#define _FPU_RESERVED 0x300000  /* Reserved bits in cw */
+#define _FPU_RESERVED   0x30300000  /* Reserved bits in cw */
 
 
 /* Now two recommended cw */
@@ -45,26 +45,16 @@
      - extended precision
      - rounding to nearest
      - exceptions on overflow, zero divide and NaN */
-#define _FPU_DEFAULT  0x1f
+#define _FPU_DEFAULT  0x1e
 
 /* IEEE:  same as above, but exceptions */
 #define _FPU_IEEE     0x0
 
-/* private namespace. It should only be used by crt0.o. */
-extern unsigned short __fpu_control;
-
 /* Type of the control word.  */
-typedef unsigned int fpu_control_t __attribute__ ((__mode__ (__HI__)));
+typedef unsigned int fpu_control_t;
 
 #define _FPU_GETCW(cw) __asm__ ("st %%fsr,%0" : "=m" (*&cw))
-#define _FPU_SETCW(cw) __asm__ ("ld %0,%%fsr" : "=m" (*&cw))
-
-#if 0
-/* The intel original macros */
-/* Macros for accessing the hardware control word.  */
-#define _FPU_GETCW(cw) __asm__ ("fnstcw %0" : "=m" (*&cw))
-#define _FPU_SETCW(cw) __asm__ ("fldcw %0" : : "m" (*&cw))
-#endif
+#define _FPU_SETCW(cw) __asm__ ("ld %0,%%fsr" : : "m" (*&cw))
 
 /* Default control word set at startup.  */
 extern fpu_control_t __fpu_control;
diff --git a/sysdeps/sparc/setjmp.S b/sysdeps/sparc/setjmp.S
index f07a348fe3..9e93668d96 100644
--- a/sysdeps/sparc/setjmp.S
+++ b/sysdeps/sparc/setjmp.S
@@ -31,15 +31,15 @@ ENTRY (__sigsetjmp)
 	call 1f
 	nop
 1:
-	sethi %hi(_GLOBAL_OFFSET_TABLE_-(2b-.)),%l7
-	or    %l7,%lo(_GLOBAL_OFFSET_TABLE_-(2b-.)),%l7
-	add   %l7,%o7,%l7
+	sethi %hi(_GLOBAL_OFFSET_TABLE_-(2b-.)),%g2
+	or    %g2,%lo(_GLOBAL_OFFSET_TABLE_-(2b-.)),%g2
+	add   %g2,%o7,%g2
 	sethi %hi(C_SYMBOL_NAME (__sigjmp_save)), %g3
 	or    %g3,%lo(C_SYMBOL_NAME (__sigjmp_save)), %g3
 	st    %sp, [%o0 + (JB_SP * 4)]
 	st    %fp, [%o0 + (JB_FP * 4)]
 	mov   %g1,%o7
-	ld    [%l7+%g3],%g1
+	ld    [%g2+%g3],%g1
 	jmp   %g1
 	st   %o7, [%o0+(JB_PC*4)]
 #else
diff --git a/sysdeps/sparc/udiv_qrnnd.S b/sysdeps/sparc/udiv_qrnnd.S
index e5d30679e1..9126b64f50 100644
--- a/sysdeps/sparc/udiv_qrnnd.S
+++ b/sysdeps/sparc/udiv_qrnnd.S
@@ -26,7 +26,6 @@
 ! n1		i1
 ! n0		i2
 ! d		i3
-
 #include "DEFS.h"
 #include "sysdep.h"
 #undef ret	/* Kludge for glibc */
@@ -38,6 +37,7 @@ LC1:	.double	0r2147483648
 
 	.align	4
 	.global	__udiv_qrnnd
+	.type	__udiv_qrnnd,@function
 FUNC(__udiv_qrnnd)
 	!#PROLOGUE# 0
 	save	%sp,-104,%sp