PERFORCE change 132658 for review
Oleksandr Tymoshenko
gonzo at FreeBSD.org
Sun Jan 6 15:28:15 PST 2008
http://perforce.freebsd.org/chv.cgi?CH=132658
Change 132658 by gonzo at gonzo_jeeves on 2008/01/06 23:27:59
o Re-integrate src/lib/libc/mips/gen/... at 131856 from mips2
to eliminate consequences of changeset 132626 (sorry for
jumping the gun)
Pointyhat to: me
Affected files ...
.. //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/_setjmp.S#3 integrate
.. //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/fabs.S#3 integrate
.. //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/ldexp.S#3 integrate
.. //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/modf.S#3 integrate
.. //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/setjmp.S#3 integrate
.. //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/sigsetjmp.S#3 integrate
Differences ...
==== //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/_setjmp.S#3 (text+ko) ====
@@ -1,3 +1,5 @@
+/* $NetBSD: _setjmp.S,v 1.20 2005/10/07 17:16:40 tsutsui Exp $ */
+
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -13,7 +15,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -33,22 +35,14 @@
#include <machine/regnum.h>
#include <machine/asm.h>
-#if defined(LIBC_SCCS)
- .text
- //.asciz "$OpenBSD: _setjmp.S,v 1.5 1996/08/19 08:15:51 tholo Exp $"
- .asciz "$FreeBSD$"
-#endif /* LIBC_SCCS */
+#if defined(LIBC_SCCS) && !defined(lint)
+ ASMSTR("from: @(#)_setjmp.s 8.1 (Berkeley) 6/4/93")
+ ASMSTR("$NetBSD: _setjmp.S,v 1.20 2005/10/07 17:16:40 tsutsui Exp $")
+#endif /* LIBC_SCCS and not lint */
-/* These defs must be consistent with ucontext_t. We really ought to employ
- * something like genassym here, but...
- */
-
-#define UC_SIGMASK 0x00 /* offsetof(ucontext_t, uc_sigmask) */
-#define UC_ONSTACK 0x10 /* offsetof(ucontext_t, uc_mcontext.mc_onstack) */
-#define UC_PC 0x14 /* offsetof(ucontext_t, uc_mcontext.mc_pc) */
-#define UC_REGS 0x18 /* offsetof(ucontext_t, uc_mcontext.mc_regs) */
-#define UC_FPUSED 0xa0 /* offsetof(ucontext_t, uc_mcontext.mc_fpused) */
-#define UC_FPREGS 0xa4 /* offsetof(ucontext_t, uc_mcontext.mc_fpregs) */
+#ifdef __ABICALLS__
+ .abicalls
+#endif
/*
* C library -- _setjmp, _longjmp
@@ -61,81 +55,55 @@
* The previous signal state is NOT restored.
*/
+
LEAF(_setjmp)
+#ifdef __ABICALLS__
.set noreorder
- li v0, 0xACEDBADE # sigcontext magic number
- sw ra, UC_PC(a0) # sc_pc = return address
- sw v0, (ZERO * 4) + UC_REGS (a0) # saved in sc_regs[0]
- sw s0, (S0 * 4) + UC_REGS (a0)
- sw s1, (S1 * 4) + UC_REGS (a0)
- sw s2, (S2 * 4) + UC_REGS (a0)
- sw s3, (S3 * 4) + UC_REGS (a0)
- sw s4, (S4 * 4) + UC_REGS (a0)
- sw s5, (S5 * 4) + UC_REGS (a0)
- sw s6, (S6 * 4) + UC_REGS (a0)
- sw s7, (S7 * 4) + UC_REGS (a0)
- sw s8, (S8 * 4) + UC_REGS (a0)
- sw sp, (SP * 4) + UC_REGS (a0)
-#ifndef SOFTFLOAT
- cfc1 v0, $31 # too bad cant check if FP used
- swc1 $f20, (F20_NUM * 4) + UC_FPREGS (a0)
- swc1 $f21, (F21_NUM * 4) + UC_FPREGS (a0)
- swc1 $f22, (F22_NUM * 4) + UC_FPREGS (a0)
- swc1 $f23, (F23_NUM * 4) + UC_FPREGS (a0)
- swc1 $f24, (F24_NUM * 4) + UC_FPREGS (a0)
- swc1 $f25, (F25_NUM * 4) + UC_FPREGS (a0)
- swc1 $f26, (F26_NUM * 4) + UC_FPREGS (a0)
- swc1 $f27, (F27_NUM * 4) + UC_FPREGS (a0)
- swc1 $f28, (F28_NUM * 4) + UC_FPREGS (a0)
- swc1 $f29, (F29_NUM * 4) + UC_FPREGS (a0)
- swc1 $f30, (F30_NUM * 4) + UC_FPREGS (a0)
- swc1 $f31, (F31_NUM * 4) + UC_FPREGS (a0)
- sw v0, (FSR_NUM * 4) + UC_FPREGS (a0)
-#endif /*SOFTFLOAT */
+ .cpload t9
+ .cprestore 16
+#endif
+ li v0, _JB_MAGIC__SETJMP
+ sw v0, (_JB_MAGIC * SZREG)(a0)
+ sw ra, (_JB_REG_RA * SZREG)(a0)
+ sw s0, (_JB_REG_S0 * SZREG)(a0)
+ sw s1, (_JB_REG_S1 * SZREG)(a0)
+ sw s2, (_JB_REG_S2 * SZREG)(a0)
+ sw s3, (_JB_REG_S3 * SZREG)(a0)
+ sw s4, (_JB_REG_S4 * SZREG)(a0)
+ sw s5, (_JB_REG_S5 * SZREG)(a0)
+ sw s6, (_JB_REG_S6 * SZREG)(a0)
+ sw s7, (_JB_REG_S7 * SZREG)(a0)
+ sw sp, (_JB_REG_SP * SZREG)(a0)
+ sw s8, (_JB_REG_S8 * SZREG)(a0)
+
j ra
move v0, zero
END(_setjmp)
LEAF(_longjmp)
-#ifdef ABICALLS
- subu sp, sp, 32
+#ifdef __ABICALLS__
+ .set noreorder
+ .cpload t9
.cprestore 16
-#endif
- .set noreorder
- lw v0, (ZERO * 4) + UC_REGS (a0) # get magic number
- lw ra, UC_PC (a0)
- bne v0, 0xACEDBADE, botch # jump if error
-
- addu sp, sp, 32 # does not matter, sanity
- lw s0, (S0 * 4) + UC_REGS (a0)
- lw s1, (S1 * 4) + UC_REGS (a0)
- lw s2, (S2 * 4) + UC_REGS (a0)
- lw s3, (S3 * 4) + UC_REGS (a0)
- lw s4, (S4 * 4) + UC_REGS (a0)
- lw s5, (S5 * 4) + UC_REGS (a0)
- lw s6, (S6 * 4) + UC_REGS (a0)
- lw s7, (S7 * 4) + UC_REGS (a0)
- lw v0, (FSR_NUM * 4) + UC_FPREGS (a0) # get fpu status
- lw sp, (SP * 4) + UC_REGS (a0)
- lw s8, (S8 * 4) + UC_REGS (a0)
-#ifndef SOFTFLOAT
- ctc1 v0, $31
- lwc1 $f20, (F20_NUM * 4) + UC_FPREGS (a0)
- lwc1 $f21, (F21_NUM * 4) + UC_FPREGS (a0)
- lwc1 $f22, (F22_NUM * 4) + UC_FPREGS (a0)
- lwc1 $f23, (F23_NUM * 4) + UC_FPREGS (a0)
- lwc1 $f24, (F24_NUM * 4) + UC_FPREGS (a0)
- lwc1 $f25, (F25_NUM * 4) + UC_FPREGS (a0)
- lwc1 $f26, (F26_NUM * 4) + UC_FPREGS (a0)
- lwc1 $f27, (F27_NUM * 4) + UC_FPREGS (a0)
- lwc1 $f28, (F28_NUM * 4) + UC_FPREGS (a0)
- lwc1 $f29, (F29_NUM * 4) + UC_FPREGS (a0)
- lwc1 $f30, (F30_NUM * 4) + UC_FPREGS (a0)
- lwc1 $f31, (F31_NUM * 4) + UC_FPREGS (a0)
-#endif /* SOFTFLOAT */
+#endif
+ lw v0, (_JB_MAGIC * SZREG)(a0)
+ lw ra, (_JB_REG_RA * SZREG)(a0)
+ li t0, _JB_MAGIC__SETJMP
+ bne v0, t0, botch # jump if error
+ lw s0, (_JB_REG_S0 * SZREG)(a0)
+ lw s1, (_JB_REG_S1 * SZREG)(a0)
+ lw s2, (_JB_REG_S2 * SZREG)(a0)
+ lw s3, (_JB_REG_S3 * SZREG)(a0)
+ lw s4, (_JB_REG_S4 * SZREG)(a0)
+ lw s5, (_JB_REG_S5 * SZREG)(a0)
+ lw s6, (_JB_REG_S6 * SZREG)(a0)
+ lw s7, (_JB_REG_S7 * SZREG)(a0)
+ lw sp, (_JB_REG_SP * SZREG)(a0)
+ lw s8, (_JB_REG_S8 * SZREG)(a0)
j ra
move v0, a1
+
botch:
jal _C_LABEL(longjmperror)
nop
==== //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/fabs.S#3 (text+ko) ====
@@ -1,3 +1,5 @@
+/* $NetBSD: fabs.S,v 1.7 2003/08/07 16:42:15 agc Exp $ */
+
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
@@ -13,7 +15,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -32,10 +34,16 @@
#include <machine/asm.h>
-#if defined(LIBC_SCCS)
- .text
- .asciz "$FreeBSD$"
-#endif /* LIBC_SCCS */
+#if defined(LIBC_SCCS) && !defined(lint)
+ ASMSTR("from: @(#)fabs.s 8.1 (Berkeley) 2/16/94")
+ ASMSTR("$NetBSD: fabs.S,v 1.7 2003/08/07 16:42:15 agc Exp $")
+#endif /* LIBC_SCCS and not lint */
+
+
+#ifdef __ABICALLS__
+ .abicalls
+#endif
+ .set noreorder
/*
* fabs(x)
@@ -44,7 +52,6 @@
* Return absolute value of x.
*/
LEAF(fabs)
- .set noreorder
j ra
abs.d $f0, $f12 # compute absolute value of x
END(fabs)
==== //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/ldexp.S#3 (text+ko) ====
@@ -1,3 +1,5 @@
+/* $NetBSD: ldexp.S,v 1.8 2003/08/07 16:42:15 agc Exp $ */
+
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -13,7 +15,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -32,10 +34,14 @@
#include <machine/asm.h>
-#if defined(LIBC_SCCS)
- .text
- .asciz "$FreeBSD$"
-#endif /* LIBC_SCCS */
+#if defined(LIBC_SCCS) && !defined(lint)
+ ASMSTR("from: @(#)ldexp.s 8.1 (Berkeley) 6/4/93")
+ ASMSTR("$NetBSD: ldexp.S,v 1.8 2003/08/07 16:42:15 agc Exp $")
+#endif /* LIBC_SCCS and not lint */
+
+#ifdef __ABICALLS__
+ .abicalls
+#endif
#define DEXP_INF 0x7ff
#define DEXP_BIAS 1023
@@ -43,7 +49,7 @@
#define DEXP_MAX 1023
#define DFRAC_BITS 52
#define DIMPL_ONE 0x00100000
-#define DLEAD_ZEROS (31 - 20)
+#define DLEAD_ZEROS 31 - 20
#define STICKYBIT 1
#define GUARDBIT 0x80000000
#define DSIGNAL_NAN 0x00040000
@@ -57,7 +63,6 @@
* Return x * (2**N), for integer values N.
*/
LEAF(ldexp)
- .set reorder
mfc1 v1, $f13 # get MSW of x
mfc1 t3, $f12 # get LSW of x
sll t1, v1, 1 # get x exponent
@@ -88,28 +93,28 @@
move v0, t3
addu t9, 32
1:
- srl t4, v0, 16
- bne t4, zero, 1f
+ srl ta0, v0, 16
+ bne ta0, zero, 1f
addu t9, 16
sll v0, 16
1:
- srl t4, v0, 24
- bne t4, zero, 1f
+ srl ta0, v0, 24
+ bne ta0, zero, 1f
addu t9, 8
sll v0, 8
1:
- srl t4, v0, 28
- bne t4, zero, 1f
+ srl ta0, v0, 28
+ bne ta0, zero, 1f
addu t9, 4
sll v0, 4
1:
- srl t4, v0, 30
- bne t4, zero, 1f
+ srl ta0, v0, 30
+ bne ta0, zero, 1f
addu t9, 2
sll v0, 2
1:
- srl t4, v0, 31
- bne t4, zero, 1f
+ srl ta0, v0, 31
+ bne ta0, zero, 1f
addu t9, 1
/*
* Now shift t2,t3 the correct number of bits.
@@ -128,8 +133,8 @@
1:
subu v0, v0, t9 # shift fraction left < 32 bits
sll t2, t2, t9
- srl t4, t3, v0
- or t2, t2, t4
+ srl ta0, t3, v0
+ or t2, t2, ta0
sll t3, t3, t9
2:
bge t1, DEXP_INF, 8f # overflow?
@@ -152,17 +157,17 @@
blt t1, -30, 2f # will all bits in t3 be shifted out?
srl t2, t2, 31 - 20 # shift fraction back to normal position
subu t1, t1, 1
- sll t4, t2, t1 # shift right t2,t3 based on exponent
+ sll ta0, t2, t1 # shift right t2,t3 based on exponent
srl t8, t3, t1 # save bits shifted out
negu t1
srl t3, t3, t1
- or t3, t3, t4
+ or t3, t3, ta0
srl t2, t2, t1
bge t8, zero, 1f # does result need to be rounded?
addu t3, t3, 1 # round result
- sltu t4, t3, 1
+ sltu ta0, t3, 1
sll t8, t8, 1
- addu t2, t2, t4
+ addu t2, t2, ta0
bne t8, zero, 1f # round result to nearest
and t3, t3, ~1
1:
@@ -180,9 +185,9 @@
srl t3, t2, t1
bge t8, zero, 1f # does result need to be rounded?
addu t3, t3, 1 # round result
- sltu t4, t3, 1
+ sltu ta0, t3, 1
sll t8, t8, 1
- mtc1 t4, $f1 # exponent and upper fraction
+ mtc1 ta0, $f1 # exponent and upper fraction
bne t8, zero, 1f # round result to nearest
and t3, t3, ~1
1:
@@ -200,7 +205,7 @@
j ra
8:
li t1, 0x7ff00000 # result is infinity (MSW)
- mtc1 t1, $f1
+ mtc1 t1, $f1
mtc1 zero, $f0 # result is infinity (LSW)
bge v1, zero, 1f # should result be negative infinity?
neg.d $f0, $f0 # result is negative infinity
==== //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/modf.S#3 (text+ko) ====
@@ -1,3 +1,5 @@
+/* $NetBSD: modf.S,v 1.10 2003/08/07 16:42:15 agc Exp $ */
+
/*-
* Copyright (c) 1991, 1993, 1995
* The Regents of the University of California. All rights reserved.
@@ -13,7 +15,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -32,10 +34,14 @@
#include <machine/asm.h>
-#if defined(LIBC_SCCS)
- .text
- .asciz "$FreeBSD$"
-#endif /* LIBC_SCCS */
+#if defined(LIBC_SCCS) && !defined(lint)
+ ASMSTR("from: @(#)modf.s 8.1 (Berkeley) 6/4/93")
+ ASMSTR("$NetBSD: modf.S,v 1.10 2003/08/07 16:42:15 agc Exp $")
+#endif /* LIBC_SCCS and not lint */
+
+#ifdef __ABICALLS__
+ .abicalls
+#endif
/*
* double modf(val, iptr)
@@ -43,7 +49,11 @@
* returns: xxx and n (in *iptr) where val == n.xxx
*/
LEAF(modf)
+#ifdef __ABICALLS__
+ .set noreorder
+ .cpload t9
.set reorder
+#endif
cfc1 t0, $31 # get the control register
li.d $f2, 4503599627370496e0 # f2 <- 2^52
@@ -53,17 +63,17 @@
mov.d $f0, $f12 # f0 <- f12
abs.d $f4, $f12 # f4 <- |f12|
- c.olt.d $f4, $f2 # f4 ? < f2
- bc1f 1f # leave f0 alone if Nan, infinity
+ c.olt.d $f4, $f2 # f4 ? < f2
+ bc1f 1f # leave f0 alone if Nan, infinity
# or >=2^52
c.eq.d $f12,$f4 # was f12 positive ?
add.d $f4,$f2,$f4 # round off to integer
bc1f 2f # No -> will have to negate result
sub.d $f0,$f4,$f2 # Remove fudge factor
j 1f # integer fraction got
-2:
+2:
sub.d $f0,$f2,$f4 # Remove fudge factor and negate
-1:
+1:
ctc1 t0, $31 # restore old rounding mode
s.d $f0, 0(a2) # save the integer part
sub.d $f0, $f12, $f0 # subtract val - integer part
==== //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/setjmp.S#3 (text+ko) ====
@@ -1,3 +1,5 @@
+/* $NetBSD: setjmp.S,v 1.17 2005/09/17 11:49:39 tsutsui Exp $ */
+
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
@@ -13,11 +15,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -34,26 +32,17 @@
* SUCH DAMAGE.
*/
-#include <sys/syscall.h>
+#include <machine/regnum.h>
#include <machine/asm.h>
-#include <machine/regnum.h>
-#if defined(LIBC_SCCS)
- .text
- //.asciz "$OpenBSD: setjmp.S,v 1.6 1997/07/23 20:55:25 kstailey Exp $"
- .asciz "$FreeBSD$"
-#endif /* LIBC_SCCS */
+#if defined(LIBC_SCCS) && !defined(lint)
+ ASMSTR("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93")
+ ASMSTR("$NetBSD: setjmp.S,v 1.17 2005/09/17 11:49:39 tsutsui Exp $")
+#endif /* LIBC_SCCS and not lint */
-/* These defs must be consistent with ucontext_t. We really ought to employ
- * something like genassym here, but...
- */
-
-#define UC_SIGMASK 0x00 /* offsetof(ucontext_t, uc_sigmask) */
-#define UC_ONSTACK 0x10 /* offsetof(ucontext_t, uc_mcontext.mc_onstack) */
-#define UC_PC 0x14 /* offsetof(ucontext_t, uc_mcontext.mc_pc) */
-#define UC_REGS 0x18 /* offsetof(ucontext_t, uc_mcontext.mc_regs) */
-#define UC_FPUSED 0xa0 /* offsetof(ucontext_t, uc_mcontext.mc_fpused) */
-#define UC_FPREGS 0xa4 /* offsetof(ucontext_t, uc_mcontext.mc_fpregs) */
+#ifdef __ABICALLS__
+ .abicalls
+#endif
/*
* C library -- setjmp, longjmp
@@ -66,82 +55,105 @@
* and a struct sigcontext, see <signal.h>
*/
-#define SETJMP_FRAME_SIZE (STAND_FRAME_SIZE + 12)
+#define SETJMP_FRAME_SIZE (CALLFRAME_SIZ + SZREG)
+
-NON_LEAF(setjmp, SETJMP_FRAME_SIZE, ra)
- .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
+NESTED(setjmp, SETJMP_FRAME_SIZE, ra)
+ .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ)
+ .set noreorder
+#ifdef __ABICALLS__
+ .cpload t9
+#endif
subu sp, sp, SETJMP_FRAME_SIZE # allocate stack frame
-#ifdef ABICALLS
+#ifdef __ABICALLS__
.cprestore 16
#endif
- .set reorder
- sw ra, STAND_RA_OFFSET(sp) # save state
- sw a0, SETJMP_FRAME_SIZE(sp)
+ sw ra, CALLFRAME_RA(sp) # save RA
+ sw a0, CALLFRAME_SIZ(sp) # store env
- move a1, zero # Make new sigset_t NULL
- la a2, UC_SIGMASK(a0) # Get address of ucontext_t->uc_sigmask
- jal _C_LABEL(sigprocmask) # Save the old signal mask
+ /* Get the signal mask. */
+ addu a2, a0, _JB_SIGMASK * SZREG # &oenv
+ li a0, 1 # SIG_SETBLOCK
+ move a1, zero # &env == 0
+ la t9, _C_LABEL(sigprocmask) # get current signal mask
+ jal t9
+ nop
- move a0, zero
- addu a1, sp, STAND_FRAME_SIZE # pointer to struct sigaltstack
- jal _C_LABEL(sigaltstack)
+ lw a0, CALLFRAME_SIZ(sp) # restore env pointer
+ lw ra, CALLFRAME_RA(sp) # restore RA
+ addu sp, sp, SETJMP_FRAME_SIZE # pop stack frame
- lw a0, SETJMP_FRAME_SIZE(sp) # restore jmpbuf
- lw v1, STAND_FRAME_SIZE+8(sp) # struct sigaltstack->ss_flags
- and v1, v1, 1 # extract SS_ONSTACK
- sw v1, UC_ONSTACK(a0) # save it in ucontext_t->uc_mcontext.mc_onstack
+ li v0, _JB_MAGIC_SETJMP
+ sw v0, (_JB_MAGIC * SZREG)(a0)
+ sw ra, (_JB_REG_RA * SZREG)(a0)
+ sw s0, (_JB_REG_S0 * SZREG)(a0)
+ sw s1, (_JB_REG_S1 * SZREG)(a0)
+ sw s2, (_JB_REG_S2 * SZREG)(a0)
+ sw s3, (_JB_REG_S3 * SZREG)(a0)
+ sw s4, (_JB_REG_S4 * SZREG)(a0)
+ sw s5, (_JB_REG_S5 * SZREG)(a0)
+ sw s6, (_JB_REG_S6 * SZREG)(a0)
+ sw s7, (_JB_REG_S7 * SZREG)(a0)
+ sw sp, (_JB_REG_SP * SZREG)(a0)
+ sw s8, (_JB_REG_S8 * SZREG)(a0)
- lw ra, STAND_RA_OFFSET(sp) # Restore return address
- addu sp, sp, SETJMP_FRAME_SIZE # Restore old stack pointer (eeeew...)
-
- blt v0, zero, botch # check for sigstack() error
-
- sw ra, UC_PC(a0) # sc_pc = return address
- li v0, 0xACEDBADE # sigcontext magic number
- sw v0, (ZERO * 4) + UC_REGS (a0) # saved in sc_regs[0]
- sw s0, (S0 * 4) + UC_REGS (a0)
- sw s1, (S1 * 4) + UC_REGS (a0)
- sw s2, (S2 * 4) + UC_REGS (a0)
- sw s3, (S3 * 4) + UC_REGS (a0)
- sw s4, (S4 * 4) + UC_REGS (a0)
- sw s5, (S5 * 4) + UC_REGS (a0)
- sw s6, (S6 * 4) + UC_REGS (a0)
- sw s7, (S7 * 4) + UC_REGS (a0)
- sw gp, (GP * 4) + UC_REGS (a0)
- sw sp, (SP * 4) + UC_REGS (a0)
- sw s8, (S8 * 4) + UC_REGS (a0)
- li v0, 1 # be nice if we could tell
- sw v0, UC_FPUSED (a0) # sc_fpused = 1
-#ifndef SOFTFLOAT
- cfc1 v0, $31
- swc1 $f20, (F20_NUM * 4) + UC_FPREGS (a0)
- swc1 $f21, (F21_NUM * 4) + UC_FPREGS (a0)
- swc1 $f22, (F22_NUM * 4) + UC_FPREGS (a0)
- swc1 $f23, (F23_NUM * 4) + UC_FPREGS (a0)
- swc1 $f24, (F24_NUM * 4) + UC_FPREGS (a0)
- swc1 $f25, (F25_NUM * 4) + UC_FPREGS (a0)
- swc1 $f26, (F26_NUM * 4) + UC_FPREGS (a0)
- swc1 $f27, (F27_NUM * 4) + UC_FPREGS (a0)
- swc1 $f28, (F28_NUM * 4) + UC_FPREGS (a0)
- swc1 $f29, (F29_NUM * 4) + UC_FPREGS (a0)
- swc1 $f30, (F30_NUM * 4) + UC_FPREGS (a0)
- swc1 $f31, (F31_NUM * 4) + UC_FPREGS (a0)
- sw v0, (FSR_NUM * 4) + UC_FPREGS (a0)
-#endif /* SOFTFLOAT */
move v0, zero
j ra
END(setjmp)
-LEAF(longjmp)
-#ifdef ABICALLS
- subu sp, sp, 32
+#define LONGJMP_FRAME_SIZE CALLFRAME_RA + SZREG * 2
+
+NESTED(longjmp, LONGJMP_FRAME_SIZE, ra)
+ .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ)
+ .set noreorder
+#ifdef __ABICALLS__
+ .cpload t9
+#endif
+ subu sp, sp, LONGJMP_FRAME_SIZE # allocate stack frame
+#ifdef __ABICALLS__
.cprestore 16
#endif
- .set reorder
- sw a1, (V0 * 4) + UC_REGS (a0) # save return value in sc_regs[V0]
- li v0, SYS_sigreturn
- syscall
+ sw ra, CALLFRAME_RA(sp) # save RA
+ lw v0, (_JB_MAGIC * SZREG)(a0)
+ li t0, _JB_MAGIC_SETJMP
+ bne v0, t0, botch # jump if error
+ nop
+
+ sw a0, CALLFRAME_SIZ(sp) # save env
+ sw a1, (CALLFRAME_SIZ + SZREG)(sp) # save return value
+
+ # set sigmask
+ addu a1, a0, _JB_SIGMASK * SZREG # &set
+ move a2, zero # &oset == NULL
+ li a0, 3 # SIG_SETMASK
+ la t9,_C_LABEL(sigprocmask) # set current signal mask
+ jal t9
+ nop
+
+ lw a0, CALLFRAME_SIZ(sp) # restore env
+ lw a1, (CALLFRAME_SIZ + SZREG)(sp) # restore return value
+
+ lw ra, (_JB_REG_RA * SZREG)(a0)
+ lw s0, (_JB_REG_S0 * SZREG)(a0)
+ lw s1, (_JB_REG_S1 * SZREG)(a0)
+ lw s2, (_JB_REG_S2 * SZREG)(a0)
+ lw s3, (_JB_REG_S3 * SZREG)(a0)
+ lw s4, (_JB_REG_S4 * SZREG)(a0)
+ lw s5, (_JB_REG_S5 * SZREG)(a0)
+ lw s6, (_JB_REG_S6 * SZREG)(a0)
+ lw s7, (_JB_REG_S7 * SZREG)(a0)
+ lw sp, (_JB_REG_SP * SZREG)(a0)
+ lw s8, (_JB_REG_S8 * SZREG)(a0)
+ move v0, a1
+ j ra
+ nop
+
botch:
- jal _C_LABEL(longjmperror)
- jal _C_LABEL(abort)
+ la t9, _C_LABEL(longjmperror)
+ jal t9
+ nop
+
+ la t9, _C_LABEL(abort)
+ jal t9
+ nop
END(longjmp)
==== //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/sigsetjmp.S#3 (text+ko) ====
@@ -1,3 +1,5 @@
+/* $NetBSD: sigsetjmp.S,v 1.8 2005/09/17 11:49:39 tsutsui Exp $ */
+
/*-
* Copyright (c) 1991, 1993, 1995,
* The Regents of the University of California. All rights reserved.
@@ -13,7 +15,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
+ * 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@@ -30,15 +32,17 @@
* SUCH DAMAGE.
*/
-#include <sys/syscall.h>
#include <machine/regnum.h>
#include <machine/asm.h>
-#include <machine/setjmp.h>
+
+#if defined(LIBC_SCCS) && !defined(lint)
+ ASMSTR("from: @(#)setjmp.s 8.1 (Berkeley) 6/4/93")
+ ASMSTR("$NetBSD: sigsetjmp.S,v 1.8 2005/09/17 11:49:39 tsutsui Exp $")
+#endif /* LIBC_SCCS and not lint */
-#if defined(LIBC_SCCS)
- .text
- .asciz "$FreeBSD$"
-#endif /* LIBC_SCCS */
+#ifdef __ABICALLS__
+ .abicalls
+#endif
/*
* C library -- sigsetjmp, siglongjmp
@@ -53,20 +57,28 @@
*/
LEAF(sigsetjmp)
+#ifdef __ABICALLS__
+ .set noreorder
+ .cpload t9
.set reorder
- sw a1, (_JBLEN*4)(a0) # save "savemask"
+#endif
bne a1, 0x0, 1f # do saving of signal mask?
la t9, _setjmp
- jr t9
+ jr t9
1: la t9, setjmp
- jr t9
+ jr t9
END(sigsetjmp)
LEAF(siglongjmp)
+#ifdef __ABICALLS__
+ .set noreorder
+ .cpload t9
.set reorder
- lw t0, (_JBLEN * 4)(a0) # get "savemask"
- bne t0, 0x0, 1f # restore signal mask?
+#endif
+ lw t0, (_JB_MAGIC * SZREG)(a0)
+ li t1, _JB_MAGIC__SETJMP
+ bne t0, t1, 1f # setjmp or _setjmp magic?
la t9, _longjmp
jr t9
1: la t9, longjmp
More information about the p4-projects
mailing list