Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc Merge from matt-nb5-mips64.



details:   https://anonhg.NetBSD.org/src/rev/6e8d49da7ff5
branches:  trunk
changeset: 749995:6e8d49da7ff5
user:      matt <matt%NetBSD.org@localhost>
date:      Mon Dec 14 01:07:41 2009 +0000

description:
Merge from matt-nb5-mips64.

diffstat:

 lib/libc/arch/mips/Makefile.inc                    |   10 +-
 lib/libc/arch/mips/SYS.h                           |   28 +-
 lib/libc/arch/mips/gen/Makefile.inc                |    4 +-
 lib/libc/arch/mips/gen/_resumecontext.S            |   31 +-
 lib/libc/arch/mips/gen/_setjmp.S                   |  197 +++++++-----
 lib/libc/arch/mips/gen/fabs.S                      |   12 +-
 lib/libc/arch/mips/gen/ldexp.S                     |   13 +-
 lib/libc/arch/mips/gen/makecontext.c               |   43 +-
 lib/libc/arch/mips/gen/modf.S                      |   18 +-
 lib/libc/arch/mips/gen/setjmp.S                    |  147 +++++----
 lib/libc/arch/mips/gen/sigsetjmp.S                 |   45 +-
 lib/libc/arch/mips/gen/swapcontext.S               |   40 +-
 lib/libc/arch/mips/genassym.cf                     |   86 +++++
 lib/libc/arch/mips/softfloat/milieu.h              |   48 +++
 lib/libc/arch/mips/softfloat/mips-gcc.h            |   95 ++++++
 lib/libc/arch/mips/softfloat/softfloat.h           |  320 +++++++++++++++++++++
 lib/libc/arch/mips/string/Makefile.inc             |    7 +-
 lib/libc/arch/mips/string/bcmp.S                   |  123 ++++----
 lib/libc/arch/mips/string/bzero.S                  |   71 ++-
 lib/libc/arch/mips/sys/__clone.S                   |   58 +-
 lib/libc/arch/mips/sys/__sigtramp2.S               |   20 +-
 lib/libc/arch/mips/sys/__vfork14.S                 |   20 +-
 lib/libc/arch/mips/sys/brk.S                       |   37 +-
 lib/libc/arch/mips/sys/cerror.S                    |   50 +-
 lib/libc/arch/mips/sys/exect.S                     |   20 +-
 lib/libc/arch/mips/sys/fork.S                      |   24 +-
 lib/libc/arch/mips/sys/getcontext.S                |   16 +-
 lib/libc/arch/mips/sys/pipe.S                      |   29 +-
 lib/libc/arch/mips/sys/ptrace.S                    |   26 +-
 lib/libc/arch/mips/sys/sbrk.S                      |   36 +-
 lib/libc/arch/mips/sys/syscall.S                   |    9 +-
 lib/libc/compat/arch/mips/sys/compat___semctl.S    |    6 +-
 lib/libc/compat/arch/mips/sys/compat___sigtramp1.S |    6 +-
 lib/libc/compat/arch/mips/sys/compat_msgctl.S      |    6 +-
 lib/libc/compat/arch/mips/sys/compat_shmctl.S      |    6 +-
 lib/libc/compat/arch/mips/sys/compat_sigaction.S   |    6 +-
 lib/libc/softfloat/softfloat-for-gcc.h             |  121 +++++++-
 37 files changed, 1306 insertions(+), 528 deletions(-)

diffs (truncated from 2618 to 300 lines):

diff -r fe6716b739d3 -r 6e8d49da7ff5 lib/libc/arch/mips/Makefile.inc
--- a/lib/libc/arch/mips/Makefile.inc   Mon Dec 14 01:04:46 2009 +0000
+++ b/lib/libc/arch/mips/Makefile.inc   Mon Dec 14 01:07:41 2009 +0000
@@ -1,3 +1,11 @@
-#      $NetBSD: Makefile.inc,v 1.8 2006/06/17 18:04:23 uwe Exp $
+#      $NetBSD: Makefile.inc,v 1.9 2009/12/14 01:07:41 matt Exp $
 
 SRCS+= __sigaction14_sigtramp.c __sigtramp2.S
+
+CPPFLAGS+= -I.
+CPPFLAGS.assym.h+=-D__LIBC12_SOURCE__
+
+.if ${MKSOFTFLOAT} != "no"
+.include <softfloat/Makefile.inc>
+CPPFLAGS+= -DSOFTFLOAT_NEED_FIXUNS
+.endif
diff -r fe6716b739d3 -r 6e8d49da7ff5 lib/libc/arch/mips/SYS.h
--- a/lib/libc/arch/mips/SYS.h  Mon Dec 14 01:04:46 2009 +0000
+++ b/lib/libc/arch/mips/SYS.h  Mon Dec 14 01:07:41 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: SYS.h,v 1.18 2003/10/29 12:28:33 pooka Exp $ */
+/*     $NetBSD: SYS.h,v 1.19 2009/12/14 01:07:41 matt Exp $ */
 
 /*-
  * Copyright (c) 1996 Jonathan Stone
@@ -78,12 +78,20 @@
  */
 #ifdef __ABICALLS__
        .abicalls
-# define PIC_PROLOGUE(x,sr)    .set noreorder; .cpload sr; .set reorder
-# define PIC_CALL(l,sr)                la sr, _C_LABEL(l); jr sr
+# if defined(__mips_o32) || defined(__mips_o64)
+#  define PIC_PROLOGUE(x)      SETUP_GP
+#  define PIC_TAILCALL(l)      PTR_LA t9, _C_LABEL(l); jr t9
+#  define PIC_RETURN()         j ra
+# else
+#  define PIC_PROLOGUE(x)      SETUP_GP64(t3, x)
+#  define PIC_TAILCALL(l)      PTR_LA t9, _C_LABEL(l); RESTORE_GP64; jr t9
+#  define PIC_RETURN()         RESTORE_GP64; j ra
+# endif
 #else
-# define PIC_PROLOGUE(x,sr)
-# define PIC_CALL(l,sr)                j  _C_LABEL(l)
-#endif
+# define PIC_PROLOGUE(x)
+# define PIC_TAILCALL(l)       j  _C_LABEL(l)
+# define PIC_RETURN()
+#endif /* __ABICALLS__ */
 
 
 #ifdef __STDC__
@@ -124,10 +132,10 @@
 
 #define PSEUDO(x,y)                                                    \
 LEAF(x);                                                               \
-       PIC_PROLOGUE(x,t9);                                             \
+       PIC_PROLOGUE(x);                                                \
        SYSTRAP(y);                                                     \
        bne a3,zero,err;                                                \
-       j ra;                                                           \
+       PIC_RETURN();                                                   \
 err:                                                                   \
-       PIC_CALL(__cerror,t9);                                          \
-       END(x)
+       PIC_TAILCALL(__cerror);                                         \
+END(x)
diff -r fe6716b739d3 -r 6e8d49da7ff5 lib/libc/arch/mips/gen/Makefile.inc
--- a/lib/libc/arch/mips/gen/Makefile.inc       Mon Dec 14 01:04:46 2009 +0000
+++ b/lib/libc/arch/mips/gen/Makefile.inc       Mon Dec 14 01:07:41 2009 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.29 2009/12/06 07:12:17 uebayasi Exp $
+#      $NetBSD: Makefile.inc,v 1.30 2009/12/14 01:07:42 matt Exp $
 
 SRCS+= fabs.S ldexp.S modf.S
 
@@ -18,7 +18,7 @@
 SRCS+= setjmp.S longjmp.c
 SRCS+= _setjmp.S
 SRCS+= sigsetjmp.S
-SRCS+= byte_swap_2.S byte_swap_4.S bswap64.c
+SRCS+= byte_swap_2.S byte_swap_4.S byte_swap_8.S
 
 SRCS+= makecontext.c resumecontext.c _resumecontext.S swapcontext.S _lwp.c
 
diff -r fe6716b739d3 -r 6e8d49da7ff5 lib/libc/arch/mips/gen/_resumecontext.S
--- a/lib/libc/arch/mips/gen/_resumecontext.S   Mon Dec 14 01:04:46 2009 +0000
+++ b/lib/libc/arch/mips/gen/_resumecontext.S   Mon Dec 14 01:07:41 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: _resumecontext.S,v 1.5 2008/04/28 20:22:56 martin Exp $        */
+/*     $NetBSD: _resumecontext.S,v 1.6 2009/12/14 01:07:42 matt Exp $  */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -29,19 +29,34 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <machine/asm.h>
+
 #include "SYS.h"
-#include <machine/mcontext.h>
+#include "assym.h"
 
 #if defined(SYSLIBC_SCCS) && !defined(lint)
-       ASMSTR("$NetBSD: _resumecontext.S,v 1.5 2008/04/28 20:22:56 martin Exp $")
+       RCSID("$NetBSD: _resumecontext.S,v 1.6 2009/12/14 01:07:42 matt Exp $")
 #endif /* SYSLIBC_SCCS && !lint */
 
        .set    reorder
+       .hidden _C_LABEL(__resumecontext)
        
 LEAF_NOPROFILE(__resumecontext)
-       PIC_PROLOGUE(_resumecontext, ra)
-       
-       la      t9, _C_LABEL(_resumecontext)
-       jr      t9
-        nop
+       /*
+        * We get here not by a call through $t9 but thru $ra after the
+        * function passed to makecontext returns.
+        */
+       PTR_SUBU        sp, sp, UCONTEXT_SIZE           # get space for ucontext
+       move            a0, sp                          # arg0 for getcontext
+       PTR_S           zero, _OFFSETOF_UC_LINK(a0)     # make sure uc_link is 0
+       SYSTRAP(getcontext)                             # get context
+       PTR_L           a0, _OFFSETOF_UC_LINK(a0)       # linked context?
+       beq             a0, zero, 1f                    #   nope, exit process
+       nop
+       SYSTRAP(setcontext)                             #   yes, become it.
+       /* NOTREACHED (in theory) */
+       li              a0, -1                          # failure, 
+1:
+       SYSTRAP(exit)                                   # all hope is lost.
+       /* NOTREACHED */
 END(__resumecontext)
diff -r fe6716b739d3 -r 6e8d49da7ff5 lib/libc/arch/mips/gen/_setjmp.S
--- a/lib/libc/arch/mips/gen/_setjmp.S  Mon Dec 14 01:04:46 2009 +0000
+++ b/lib/libc/arch/mips/gen/_setjmp.S  Mon Dec 14 01:07:41 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: _setjmp.S,v 1.20 2005/10/07 17:16:40 tsutsui Exp $     */
+/*     $NetBSD: _setjmp.S,v 1.21 2009/12/14 01:07:42 matt Exp $        */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -38,15 +38,18 @@
 #include <machine/setjmp.h>
 #include <machine/signal.h>            /* XXX */
 
+#include "assym.h"
+
+#include "SYS.h"
+
 #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 $")
+#if 0
+       RCSID("from: @(#)_setjmp.s      8.1 (Berkeley) 6/4/93")
+#else
+       RCSID("$NetBSD: _setjmp.S,v 1.21 2009/12/14 01:07:42 matt Exp $")
+#endif
 #endif /* LIBC_SCCS and not lint */
 
-#ifdef __ABICALLS__
-       .abicalls
-#endif
-
 /*
  * C library -- _setjmp, _longjmp
  *
@@ -61,91 +64,125 @@
        .set    noreorder
 
 LEAF(_setjmp)
-#ifdef __ABICALLS__ 
-       #.set noreorder
-       .cpload t9
-       #.set reorder
-#endif
-
        REG_PROLOGUE
        REG_LI  v0, 0xACEDBADE                  # sigcontext magic number
-       REG_S   ra, (2 * 4)(a0)                 # sc_pc = return address
-       REG_S   v0, (_OFFSETOF_SC_REGS)(a0)     #   saved in sc_regs[0]
-       REG_S   s0, (_R_S0 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_S   s1, (_R_S1 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_S   s2, (_R_S2 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_S   s3, (_R_S3 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_S   s4, (_R_S4 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_S   s5, (_R_S5 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_S   s6, (_R_S6 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_S   s7, (_R_S7 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_S   sp, (_R_SP * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_S   s8, (_R_S8 * SZREG + _OFFSETOF_SC_REGS)(a0)
+       REG_S   ra, _OFFSETOF_SC_PC(a0)         # sc_pc = return address
+       REG_S   v0, _OFFSETOF_SC_REGS(a0)       #   saved in sc_regs[0]
+       REG_S   a1, _OFFSETOF_SC_REGS_V0(a0)    # save return value
+       REG_S   s0, _OFFSETOF_SC_REGS_S0(a0)
+       REG_S   s1, _OFFSETOF_SC_REGS_S1(a0)
+       REG_S   s2, _OFFSETOF_SC_REGS_S2(a0)
+       REG_S   s3, _OFFSETOF_SC_REGS_S3(a0)
+       REG_S   s4, _OFFSETOF_SC_REGS_S4(a0)
+       REG_S   s5, _OFFSETOF_SC_REGS_S5(a0)
+       REG_S   s6, _OFFSETOF_SC_REGS_S6(a0)
+       REG_S   s7, _OFFSETOF_SC_REGS_S7(a0)
+       REG_S   sp, _OFFSETOF_SC_REGS_SP(a0)
+       REG_S   s8, _OFFSETOF_SC_REGS_S8(a0)
+#if defined(__mips_n32) || defined(__mips_n64)
+       REG_S   gp, _OFFSETOF_SC_REGS_GP(a0)    # newabi gp is callee-saved
+#endif
        cfc1    v0, $31                         # too bad cant check if FP used
-       swc1    $f20, (20 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       swc1    $f21, (21 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       swc1    $f22, (22 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       swc1    $f23, (23 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       swc1    $f24, (24 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       swc1    $f25, (25 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       swc1    $f26, (26 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       swc1    $f27, (27 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       swc1    $f28, (28 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       swc1    $f29, (29 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       swc1    $f30, (30 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       swc1    $f31, (31 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       sw      v0, (32 * 4 + _OFFSETOF_SC_FPREGS)(a0)
+       /*
+        * In N32, FP registers F20, F22, F24, F26, F28, F30 are callee-saved.
+        * In N64, FP registers F23 .. F31 are callee-saved.
+        * In O32, FP registers F20 .. F23 are callee-saved.
+        */
+#ifndef SOFTFLOAT_FOR_GCC
+#if defined(__mips_n64) || defined(__mips_n32)
+       FP_S    $f30, _OFFSETOF_SC_FPREGS_F30(a0)
+       FP_S    $f28, _OFFSETOF_SC_FPREGS_F28(a0)
+       FP_S    $f26, _OFFSETOF_SC_FPREGS_F26(a0)
+       FP_S    $f24, _OFFSETOF_SC_FPREGS_F24(a0)
+#endif
+#if defined(__mips_n32) || defined(__mips_o32) || defined(__mips_o64)
+       FP_S    $f22, _OFFSETOF_SC_FPREGS_F22(a0)
+       FP_S    $f20, _OFFSETOF_SC_FPREGS_F20(a0)
+#endif
+#if defined(__mips_o32) || defined(__mips_o64)
+       FP_S    $f21, _OFFSETOF_SC_FPREGS_F21(a0)
+       FP_S    $f23, _OFFSETOF_SC_FPREGS_F23(a0)
+#endif
+#if defined(__mips_n64)
+       FP_S    $f25, _OFFSETOF_SC_FPREGS_F25(a0)
+       FP_S    $f27, _OFFSETOF_SC_FPREGS_F27(a0)
+       FP_S    $f29, _OFFSETOF_SC_FPREGS_F29(a0)
+       FP_S    $f31, _OFFSETOF_SC_FPREGS_F31(a0)
+#endif
+#endif /* SOFTFLOAT_FOR_GCC */
+       INT_S   v0, _OFFSETOF_SC_FPREGS_FCSR(a0)
        REG_EPILOGUE
+
        j       ra
        move    v0, zero
 END(_setjmp)
 
 LEAF(_longjmp)
-#ifdef __ABICALLS__ 
-       .set    noreorder
-       .cpload t9
-       .set    reorder
-       subu    sp, sp, 32
-       .cprestore 16
-       .set    noreorder
-#endif  
+       PIC_PROLOGUE(_longjmp)
+       PTR_SUBU        sp, sp, CALLFRAME_SIZ
+       SAVE_GP(CALLFRAME_GP)
+
        REG_PROLOGUE
-       REG_L   v0, (_OFFSETOF_SC_REGS)(a0)     # get magic number
-       REG_L   ra, (2 * 4)(a0)
-       REG_LI  t0, 0xACEDBADE
-       bne     v0, t0, botch           # jump if error
-       addu    sp, sp, 32                      # does not matter, sanity
-       REG_L   s0, (_R_S0 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_L   s1, (_R_S1 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_L   s2, (_R_S2 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_L   s3, (_R_S3 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_L   s4, (_R_S4 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_L   s5, (_R_S5 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_L   s6, (_R_S6 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_L   s7, (_R_S7 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       lw      v0, (32 * 4 + _OFFSETOF_SC_FPREGS)(a0)  # get fpu status
-       REG_L   sp, (_R_SP * SZREG + _OFFSETOF_SC_REGS)(a0)
-       REG_L   s8, (_R_S8 * SZREG + _OFFSETOF_SC_REGS)(a0)
-       ctc1    v0, $31
-       lwc1    $f20, (20 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       lwc1    $f21, (21 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       lwc1    $f22, (22 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       lwc1    $f23, (23 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       lwc1    $f24, (24 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       lwc1    $f25, (25 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       lwc1    $f26, (26 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       lwc1    $f27, (27 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       lwc1    $f28, (28 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       lwc1    $f29, (29 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       lwc1    $f30, (30 * 4 + _OFFSETOF_SC_FPREGS)(a0)
-       lwc1    $f31, (31 * 4 + _OFFSETOF_SC_FPREGS)(a0)



Home | Main Index | Thread Index | Old Index