From owner-p4-projects@FreeBSD.ORG Sun Jan 6 20:39:43 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E913E16A418; Sun, 6 Jan 2008 20:39:42 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD10016A41B; Sun, 6 Jan 2008 20:39:42 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (bsdimp.com [199.45.160.85]) by mx1.freebsd.org (Postfix) with ESMTP id 0DBE313C447; Sun, 6 Jan 2008 20:39:41 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.14.1/8.14.1) with ESMTP id m06Kb0Ib070660; Sun, 6 Jan 2008 13:37:00 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sun, 06 Jan 2008 13:38:03 -0700 (MST) Message-Id: <20080106.133803.35183967.imp@bsdimp.com> To: gonzo@freebsd.org From: "M. Warner Losh" In-Reply-To: <200801061543.m06FhmW3087647@repoman.freebsd.org> References: <200801061543.m06FhmW3087647@repoman.freebsd.org> X-Mailer: Mew version 5.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: perforce@freebsd.org Subject: Re: PERFORCE change 132626 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jan 2008 20:39:43 -0000 In message: <200801061543.m06FhmW3087647@repoman.freebsd.org> Oleksandr Tymoshenko writes: : http://perforce.freebsd.org/chv.cgi?CH=132626 : : Change 132626 by gonzo@gonzo_jeeves on 2008/01/06 15:43:20 : : o Bring in assembler bits from juniper-mips branch What I've tried to do when I've done this stuff is to break it down into an integrate phase and then edit after that. These look like they are pure edits.... Warner : Affected files ... : : .. //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/_setjmp.S#2 edit : .. //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/fabs.S#2 edit : .. //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/ldexp.S#2 edit : .. //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/makecontext.c#2 edit : .. //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/modf.S#2 edit : .. //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/setjmp.S#2 edit : .. //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/sigsetjmp.S#2 edit : : Differences ... : : ==== //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/_setjmp.S#2 (text+ko) ==== : : @@ -1,5 +1,3 @@ : -/* $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. : @@ -15,7 +13,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. Neither the name of the University nor the names of its contributors : + * 4. 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. : * : @@ -35,14 +33,22 @@ : #include : #include : : -#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 */ : +#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 */ : + : +/* These defs must be consistent with ucontext_t. We really ought to employ : + * something like genassym here, but... : + */ : : -#ifdef __ABICALLS__ : - .abicalls : -#endif : +#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) */ : : /* : * C library -- _setjmp, _longjmp : @@ -55,55 +61,81 @@ : * The previous signal state is NOT restored. : */ : : - : LEAF(_setjmp) : -#ifdef __ABICALLS__ : .set noreorder : - .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) : - : + 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 */ : j ra : move v0, zero : END(_setjmp) : : LEAF(_longjmp) : -#ifdef __ABICALLS__ : - .set noreorder : - .cpload t9 : +#ifdef ABICALLS : + subu sp, sp, 32 : .cprestore 16 : -#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) : +#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 */ : : j ra : move v0, a1 : - : botch: : jal _C_LABEL(longjmperror) : nop : : ==== //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/fabs.S#2 (text+ko) ==== : : @@ -1,5 +1,3 @@ : -/* $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. : @@ -15,7 +13,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. Neither the name of the University nor the names of its contributors : + * 4. 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,17 +32,11 @@ : : #include : : -#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 */ : - : +#if defined(LIBC_SCCS) : + .text : + .asciz "$FreeBSD$" : +#endif /* LIBC_SCCS */ : : -#ifdef __ABICALLS__ : - .abicalls : -#endif : - .set noreorder : - : /* : * fabs(x) : * double x; : @@ -52,6 +44,7 @@ : * 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#2 (text+ko) ==== : : @@ -1,5 +1,3 @@ : -/* $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. : @@ -15,7 +13,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. Neither the name of the University nor the names of its contributors : + * 4. 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,22 +32,18 @@ : : #include : : -#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 */ : +#if defined(LIBC_SCCS) : + .text : + .asciz "$FreeBSD$" : +#endif /* LIBC_SCCS */ : : -#ifdef __ABICALLS__ : - .abicalls : -#endif : - : #define DEXP_INF 0x7ff : #define DEXP_BIAS 1023 : #define DEXP_MIN -1022 : #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 : @@ -63,6 +57,7 @@ : * 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 : @@ -93,28 +88,28 @@ : move v0, t3 : addu t9, 32 : 1: : - srl ta0, v0, 16 : - bne ta0, zero, 1f : + srl t4, v0, 16 : + bne t4, zero, 1f : addu t9, 16 : sll v0, 16 : 1: : - srl ta0, v0, 24 : - bne ta0, zero, 1f : + srl t4, v0, 24 : + bne t4, zero, 1f : addu t9, 8 : sll v0, 8 : 1: : - srl ta0, v0, 28 : - bne ta0, zero, 1f : + srl t4, v0, 28 : + bne t4, zero, 1f : addu t9, 4 : sll v0, 4 : 1: : - srl ta0, v0, 30 : - bne ta0, zero, 1f : + srl t4, v0, 30 : + bne t4, zero, 1f : addu t9, 2 : sll v0, 2 : 1: : - srl ta0, v0, 31 : - bne ta0, zero, 1f : + srl t4, v0, 31 : + bne t4, zero, 1f : addu t9, 1 : /* : * Now shift t2,t3 the correct number of bits. : @@ -133,8 +128,8 @@ : 1: : subu v0, v0, t9 # shift fraction left < 32 bits : sll t2, t2, t9 : - srl ta0, t3, v0 : - or t2, t2, ta0 : + srl t4, t3, v0 : + or t2, t2, t4 : sll t3, t3, t9 : 2: : bge t1, DEXP_INF, 8f # overflow? : @@ -157,17 +152,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 ta0, t2, t1 # shift right t2,t3 based on exponent : + sll t4, 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, ta0 : + or t3, t3, t4 : srl t2, t2, t1 : bge t8, zero, 1f # does result need to be rounded? : addu t3, t3, 1 # round result : - sltu ta0, t3, 1 : + sltu t4, t3, 1 : sll t8, t8, 1 : - addu t2, t2, ta0 : + addu t2, t2, t4 : bne t8, zero, 1f # round result to nearest : and t3, t3, ~1 : 1: : @@ -185,9 +180,9 @@ : srl t3, t2, t1 : bge t8, zero, 1f # does result need to be rounded? : addu t3, t3, 1 # round result : - sltu ta0, t3, 1 : + sltu t4, t3, 1 : sll t8, t8, 1 : - mtc1 ta0, $f1 # exponent and upper fraction : + mtc1 t4, $f1 # exponent and upper fraction : bne t8, zero, 1f # round result to nearest : and t3, t3, ~1 : 1: : @@ -205,7 +200,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/makecontext.c#2 (text+ko) ==== : : @@ -41,10 +41,8 @@ : __RCSID("$NetBSD: makecontext.c,v 1.3 2003/01/19 08:53:36 matt Exp $"); : #endif : : -#include : -#include : +#include : #include : - : #include : : void : : ==== //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/modf.S#2 (text+ko) ==== : : @@ -1,5 +1,3 @@ : -/* $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. : @@ -15,7 +13,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. Neither the name of the University nor the names of its contributors : + * 4. 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,14 +32,10 @@ : : #include : : -#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 : +#if defined(LIBC_SCCS) : + .text : + .asciz "$FreeBSD$" : +#endif /* LIBC_SCCS */ : : /* : * double modf(val, iptr) : @@ -49,11 +43,7 @@ : * 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 : : @@ -63,17 +53,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#2 (text+ko) ==== : : @@ -1,5 +1,3 @@ : -/* $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. : @@ -15,7 +13,11 @@ : * 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. Neither the name of the University nor the names of its contributors : + * 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 : * may be used to endorse or promote products derived from this software : * without specific prior written permission. : * : @@ -32,17 +34,26 @@ : * SUCH DAMAGE. : */ : : +#include : +#include : #include : -#include : + : +#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... : + */ : : -#ifdef __ABICALLS__ : - .abicalls : -#endif : +#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) */ : : /* : * C library -- setjmp, longjmp : @@ -55,105 +66,82 @@ : * and a struct sigcontext, see : */ : : -#define SETJMP_FRAME_SIZE (CALLFRAME_SIZ + SZREG) : +#define SETJMP_FRAME_SIZE (STAND_FRAME_SIZE + 12) : : - : -NESTED(setjmp, SETJMP_FRAME_SIZE, ra) : - .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ) : - .set noreorder : -#ifdef __ABICALLS__ : - .cpload t9 : -#endif : +NON_LEAF(setjmp, SETJMP_FRAME_SIZE, ra) : + .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE) : subu sp, sp, SETJMP_FRAME_SIZE # allocate stack frame : -#ifdef __ABICALLS__ : +#ifdef ABICALLS : .cprestore 16 : #endif : - sw ra, CALLFRAME_RA(sp) # save RA : - sw a0, CALLFRAME_SIZ(sp) # store env : + .set reorder : + sw ra, STAND_RA_OFFSET(sp) # save state : + sw a0, SETJMP_FRAME_SIZE(sp) : + : + 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 : + : + move a0, zero : + addu a1, sp, STAND_FRAME_SIZE # pointer to struct sigaltstack : + jal _C_LABEL(sigaltstack) : : - /* 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 : + 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 : : - 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 ra, STAND_RA_OFFSET(sp) # Restore return address : + addu sp, sp, SETJMP_FRAME_SIZE # Restore old stack pointer (eeeew...) : : - 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) : + 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) : : -#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__ : +LEAF(longjmp) : +#ifdef ABICALLS : + subu sp, sp, 32 : .cprestore 16 : #endif : - 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 : - : + .set reorder : + sw a1, (V0 * 4) + UC_REGS (a0) # save return value in sc_regs[V0] : + li v0, SYS_sigreturn : + syscall : botch: : - la t9, _C_LABEL(longjmperror) : - jal t9 : - nop : - : - la t9, _C_LABEL(abort) : - jal t9 : - nop : + jal _C_LABEL(longjmperror) : + jal _C_LABEL(abort) : END(longjmp) : : ==== //depot/projects/mips2-jnpr/src/lib/libc/mips/gen/sigsetjmp.S#2 (text+ko) ==== : : @@ -1,5 +1,3 @@ : -/* $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. : @@ -15,7 +13,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. Neither the name of the University nor the names of its contributors : + * 4. 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,17 +30,15 @@ : * SUCH DAMAGE. : */ : : +#include : #include : #include : +#include : : -#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 */ : - : -#ifdef __ABICALLS__ : - .abicalls : -#endif : +#if defined(LIBC_SCCS) : + .text : + .asciz "$FreeBSD$" : +#endif /* LIBC_SCCS */ : : /* : * C library -- sigsetjmp, siglongjmp : @@ -57,28 +53,20 @@ : */ : : LEAF(sigsetjmp) : -#ifdef __ABICALLS__ : - .set noreorder : - .cpload t9 : .set reorder : -#endif : + sw a1, (_JBLEN*4)(a0) # save "savemask" : 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 : -#endif : - lw t0, (_JB_MAGIC * SZREG)(a0) : - li t1, _JB_MAGIC__SETJMP : - bne t0, t1, 1f # setjmp or _setjmp magic? : + lw t0, (_JBLEN * 4)(a0) # get "savemask" : + bne t0, 0x0, 1f # restore signal mask? : la t9, _longjmp : jr t9 : 1: la t9, longjmp :