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.
This commit is contained in:
Ulrich Drepper 1999-01-28 22:09:12 +00:00
parent 1f749a3ba2
commit 8163845fda
3 changed files with 45 additions and 26 deletions

View File

@ -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> 1999-01-28 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/sysv4/solaris2/configure.in: New file. * sysdeps/unix/sysv/sysv4/solaris2/configure.in: New file.

View File

@ -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 is important since references to variables of this type are passed to
the kernel. 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 "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. possible.
A solution is provided by the Unix98 specification which finally The Unix98 specification provides a solution by introducing a type
introduces a type @code{socklen_t}. This type is used in all of the @code{socklen_t}. This type is used in all of the cases that POSIX
cases that were previously changed to use @code{size_t}. The only changed to use @code{size_t}. The only requirement of this type is that
requirement of this type is that it is an unsigned type of at least 32 it be an unsigned type of at least 32 bits. Therefore, implementations
bits. Therefore, implementations which require references to 32 bit which require that references to 32 bit variables be passed can be as
variables be passed can be as happy as implementations which use right happy as implementations which use 64 bit values.
from the start 64 bit values.
@node Communication Styles @node Communication Styles

View File

@ -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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
@ -19,20 +19,27 @@
#include <sysdep.h> #include <sysdep.h>
#define _ASM 1 #define _ASM 1
#define _SETJMP_H #include <jmp_buf.h>
#include <bits/setjmp.h> #define ENV(base,reg) [%base + (reg * 4)]
#define ENV(reg) [%g1 + (reg * 4)] #define ST_FLUSH_WINDOWS 3
#define RW_FP [%fp + 0x38]
ENTRY(__longjmp) ENTRY(__longjmp)
/* Store our arguments in global registers so we can still /* Store our arguments in global registers so we can still
use them while unwinding frames and their register windows. */ 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 */ mov %o0, %g1 /* ENV in %g1 */
orcc %o1, %g0, %g2 /* VAL in %g2 */ orcc %o1, %g0, %g2 /* VAL in %g2 */
be,a 0f /* Branch if zero; else skip delay slot. */ be,a 0f /* Branch if zero; else skip delay slot. */
mov 1, %g2 /* Delay slot only hit if zero: VAL = 1. */ mov 1, %g2 /* Delay slot only hit if zero: VAL = 1. */
0: 0:
/* Cache target FP in register %g3. */ xor %fp, %g3, %o0
ld ENV(JB_FP), %g3 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 /* Now we will loop, unwinding the register windows up the stack
until the restored %fp value matches the target value in %g3. */ 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. */ bl,a LOC(loop) /* Loop while current fp is below target. */
restore /* Unwind register window in delay slot. */ restore /* Unwind register window in delay slot. */
be,a LOC(found) /* Better have hit it exactly. */ 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): LOC(thread):
/* Get here only if the jmp_buf or stack is clobbered. */ /*
call C_SYMBOL_NAME(abort) * Do a "flush register windows trap". The trap handler in the
nop * kernel writes all the register windows to their stack slots, and
unimp 0 * 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): LOC(found):
/* We have unwound register windows so %fp matches the target. */ /* We have unwound register windows so %fp matches the target. */
cmp %o0, %sp /* Check jmp_buf SP vs register window. */ mov %o0, %sp /* OK, install new SP. */
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. */
LOC(sp_ok): 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. */ jmp %o0 + 8 /* Return there. */
mov %g2, %o0 /* Delay slot: set return value. */ mov %g2, %o0 /* Delay slot: set return value. */