about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-01-28 22:09:12 +0000
committerUlrich Drepper <drepper@redhat.com>1999-01-28 22:09:12 +0000
commit8163845fdab02ba1943b608b635873cee50df676 (patch)
tree06a81f336e654c64ba7282356b4c79d5c91a4589
parent1f749a3ba208fd615b5524eb6bbeea212211ff1a (diff)
downloadglibc-8163845fdab02ba1943b608b635873cee50df676.tar.gz
glibc-8163845fdab02ba1943b608b635873cee50df676.tar.xz
glibc-8163845fdab02ba1943b608b635873cee50df676.zip
Update.
1999-01-28  David S. Miller  <davem@redhat.com>

	* sysdeps/sparc/sparc32/__longjmp.S: Rewrite without bogus sanity
	checks and aborts, to make longjmp based thread schemes work again.
-rw-r--r--ChangeLog5
-rw-r--r--manual/socket.texi17
-rw-r--r--sysdeps/sparc/sparc32/__longjmp.S49
3 files changed, 45 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index 8f6a6380db..266fa6c559 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+1999-01-28  David S. Miller  <davem@redhat.com>
+
+	* sysdeps/sparc/sparc32/__longjmp.S: Rewrite without bogus sanity
+	checks and aborts, to make longjmp based thread schemes work again.
+
 1999-01-28  Ulrich Drepper  <drepper@cygnus.com>
 
 	* sysdeps/unix/sysv/sysv4/solaris2/configure.in: New file.
diff --git a/manual/socket.texi b/manual/socket.texi
index 4de5b9cd56..5f31dd47d8 100644
--- a/manual/socket.texi
+++ b/manual/socket.texi
@@ -140,18 +140,17 @@ bits wide and so a de-factor standard required 32 bit variables.  This
 is important since references to variables of this type are passed to
 the kernel.
 
-But now the POSIX people came and unified the interface with their words
+But then the POSIX people came and unified the interface with the words
 "all size values are of type @code{size_t}".  But on 64 bit machines
-@code{size_t} is 64 bits wide and so variable references are not anymore
+@code{size_t} is 64 bits wide, and so variable references are not anymore
 possible.
 
-A solution is provided by the Unix98 specification which finally
-introduces a type @code{socklen_t}.  This type is used in all of the
-cases that were previously changed to use @code{size_t}.  The only
-requirement of this type is that it is an unsigned type of at least 32
-bits.  Therefore, implementations which require references to 32 bit
-variables be passed can be as happy as implementations which use right
-from the start 64 bit values.
+The Unix98 specification provides a solution by introducing a type
+@code{socklen_t}.  This type is used in all of the cases that POSIX
+changed to use @code{size_t}.  The only requirement of this type is that
+it be an unsigned type of at least 32 bits.  Therefore, implementations
+which require that references to 32 bit variables be passed can be as
+happy as implementations which use 64 bit values.
 
 
 @node Communication Styles
diff --git a/sysdeps/sparc/sparc32/__longjmp.S b/sysdeps/sparc/sparc32/__longjmp.S
index cbd941fa82..6f984b98e9 100644
--- a/sysdeps/sparc/sparc32/__longjmp.S
+++ b/sysdeps/sparc/sparc32/__longjmp.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1993, 1996, 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 93, 96, 97, 98, 99 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
@@ -19,20 +19,27 @@
 #include <sysdep.h>
 
 #define _ASM 1
-#define _SETJMP_H
-#include <bits/setjmp.h>
-#define ENV(reg) [%g1 + (reg * 4)]
+#include <jmp_buf.h>
+#define ENV(base,reg) [%base + (reg * 4)]
+#define ST_FLUSH_WINDOWS 3
+#define RW_FP [%fp + 0x38]
 
 ENTRY(__longjmp)
 	/* Store our arguments in global registers so we can still
 	   use them while unwinding frames and their register windows.  */
+
+	ld ENV(o0,JB_FP), %g3	/* Cache target FP in register %g3.  */
 	mov %o0, %g1		/* ENV in %g1 */
      	orcc %o1, %g0, %g2	/* VAL in %g2 */
      	be,a 0f			/* Branch if zero; else skip delay slot.  */
 	 mov 1, %g2		/* Delay slot only hit if zero: VAL = 1.  */
 0:
-	/* Cache target FP in register %g3.  */
-	ld ENV(JB_FP), %g3
+	xor %fp, %g3, %o0
+	add %fp, 512, %o1
+	andncc %o0, 4095, %o0
+	bne LOC(thread)
+	 cmp %o1, %g3
+	bl LOC(thread)
 
 	/* Now we will loop, unwinding the register windows up the stack
 	   until the restored %fp value matches the target value in %g3.  */
@@ -42,23 +49,31 @@ LOC(loop):
 	bl,a LOC(loop)		/* Loop while current fp is below target.  */
 	 restore		/* Unwind register window in delay slot.  */
 	be,a LOC(found)		/* Better have hit it exactly.  */
-	 ld ENV(JB_SP), %o0	/* Delay slot: extract target SP.  */
+	 ld ENV(g1,JB_SP), %o0	/* Delay slot: extract target SP.  */
 
-LOC(bogus):
-	/* Get here only if the jmp_buf or stack is clobbered.  */
-	call C_SYMBOL_NAME(abort)
-	 nop
-	unimp 0
+LOC(thread):
+	/*
+	 * Do a "flush register windows trap".  The trap handler in the
+	 * kernel writes all the register windows to their stack slots, and
+	 * marks them all as invalid (needing to be sucked up from the
+	 * stack when used).  This ensures that all information needed to
+	 * unwind to these callers is in memory, not in the register
+	 * windows.
+	 */
+	ta	ST_FLUSH_WINDOWS
+	ld	ENV(g1,JB_PC), %o7 /* Set return PC. */
+	ld	ENV(g1,JB_SP), %fp /* Set saved SP on restore below. */
+	sub	%fp, 64, %sp	/* Allocate a register frame. */
+	st	%g3, RW_FP	/* Set saved FP on restore below. */
+	retl
+	 restore %g2, 0, %o0	/* Restore values from above register frame. */
 
 LOC(found):
 	/* We have unwound register windows so %fp matches the target.  */
-	cmp %o0, %sp		/* Check jmp_buf SP vs register window.  */
-	bge,a LOC(sp_ok)	/* Saved must not be deeper than register.  */
-	 mov %o0, %sp		/* OK, install new SP.  */
-	b,a LOC(bogus)		/* Bogus, we lose.  */
+	mov %o0, %sp		/* OK, install new SP.  */
 
 LOC(sp_ok):
-	ld ENV(JB_PC), %o0	/* Extract target return PC.  */
+	ld ENV(g1,JB_PC), %o0	/* Extract target return PC.  */
 	jmp %o0 + 8		/* Return there.  */
 	 mov %g2, %o0		/* Delay slot: set return value.  */