Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64 move the memcpy/memset implementations out ...



details:   https://anonhg.NetBSD.org/src/rev/43c3d62ed384
branches:  trunk
changeset: 752786:43c3d62ed384
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Mar 06 23:26:10 2010 +0000

description:
move the memcpy/memset implementations out into their own file, with the
block copy versions as well.  move some of the definitions in locore.s
into a new locore.h.

locore.s is almost 2000 lines shorter with this change.

diffstat:

 sys/arch/sparc64/conf/files.sparc64  |     3 +-
 sys/arch/sparc64/include/locore.h    |    90 +
 sys/arch/sparc64/sparc64/locore.s    |  1939 +---------------------------------
 sys/arch/sparc64/sparc64/memcpyset.s |  1897 +++++++++++++++++++++++++++++++++
 4 files changed, 1991 insertions(+), 1938 deletions(-)

diffs (truncated from 4011 to 300 lines):

diff -r fa9535b09bf7 -r 43c3d62ed384 sys/arch/sparc64/conf/files.sparc64
--- a/sys/arch/sparc64/conf/files.sparc64       Sat Mar 06 22:02:31 2010 +0000
+++ b/sys/arch/sparc64/conf/files.sparc64       Sat Mar 06 23:26:10 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.sparc64,v 1.126 2010/03/02 12:18:35 nakayama Exp $
+#      $NetBSD: files.sparc64,v 1.127 2010/03/06 23:26:10 mrg Exp $
 
 # @(#)files.sparc64    8.1 (Berkeley) 7/19/93
 # sparc64-specific configuration info
@@ -209,6 +209,7 @@
 # sparc64/sparc64/locore.s is handled specially in the makefile,
 # because it must come first in the "ld" command line.
 file   arch/sparc64/sparc64/machdep.c
+file   arch/sparc64/sparc64/memcpyset.s
 file   arch/sparc64/sparc64/process_machdep.c
 file   arch/sparc64/sparc64/procfs_machdep.c   procfs
 file   arch/sparc64/sparc64/mem.c
diff -r fa9535b09bf7 -r 43c3d62ed384 sys/arch/sparc64/include/locore.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/sparc64/include/locore.h Sat Mar 06 23:26:10 2010 +0000
@@ -0,0 +1,90 @@
+/*     $NetBSD: locore.h,v 1.1 2010/03/06 23:26:10 mrg Exp $   */
+
+/*
+ * Copyright (c) 1996-2002 Eduardo Horvath
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR  ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR  BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ */
+
+#undef CURLWP
+#undef CPCB
+#undef FPLWP
+
+#define        CURLWP  (CPUINFO_VA + CI_CURLWP)
+#define        CPCB    (CPUINFO_VA + CI_CPCB)
+#define        FPLWP   (CPUINFO_VA + CI_FPLWP)
+
+/*
+ * Here are some defines to try to maintain consistency but still
+ * support 32-and 64-bit compilers.
+ */
+#ifdef _LP64
+/* reg that points to base of data/text segment */
+#define        BASEREG %g4
+/* first constants for storage allocation */
+#define LNGSZ          8
+#define LNGSHFT                3
+#define PTRSZ          8
+#define PTRSHFT                3
+#define POINTER                .xword
+#define ULONG          .xword
+/* Now instructions to load/store pointers & long ints */
+#define LDLNG          ldx
+#define LDULNG         ldx
+#define STLNG          stx
+#define STULNG         stx
+#define LDPTR          ldx
+#define LDPTRA         ldxa
+#define STPTR          stx
+#define STPTRA         stxa
+#define        CASPTR          casxa
+/* Now something to calculate the stack bias */
+#define STKB           BIAS
+#define        CCCR            %xcc
+#else
+#define        BASEREG         %g0
+#define LNGSZ          4
+#define LNGSHFT                2
+#define PTRSZ          4
+#define PTRSHFT                2
+#define POINTER                .word
+#define ULONG          .word
+/* Instructions to load/store pointers & long ints */
+#define LDLNG          ldsw
+#define LDULNG         lduw
+#define STLNG          stw
+#define STULNG         stw
+#define LDPTR          lduw
+#define LDPTRA         lduwa
+#define STPTR          stw
+#define STPTRA         stwa
+#define        CASPTR          casa
+#define STKB           0
+#define        CCCR            %icc
+#endif
+
+#define        EMPTY   .empty
+
+/* Give this real authority: reset the machine */
+#define NOTREACHED     sir
+
+/* if < 32, copy by bytes, memcpy, kcopy, ... */
+#define        BCOPY_SMALL     32
diff -r fa9535b09bf7 -r 43c3d62ed384 sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Sat Mar 06 22:02:31 2010 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Sat Mar 06 23:26:10 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.322 2010/03/04 08:01:35 mrg Exp $ */
+/*     $NetBSD: locore.s,v 1.323 2010/03/06 23:26:10 mrg Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath
@@ -62,7 +62,6 @@
 #define        HWREF                   /* Track ref/mod bits in trap handlers */
 #undef DCACHE_BUG              /* Flush D$ around ASI_PHYS accesses */
 #undef NO_TSB                  /* Don't use TSB */
-#define        USE_BLOCK_STORE_LOAD    /* enable block load/store ops */
 #define        BB_ERRATA_1             /* writes to TICK_CMPR may fail */
 #undef TLB_FLUSH_LOWVA         /* also flush 32-bit entries from the MMU */
 
@@ -86,6 +85,7 @@
 #include <machine/pmap.h>
 #include <machine/intr.h>
 #include <machine/asm.h>
+#include <machine/locore.h>
 #include <sys/syscall.h>
 
 #include "ksyms.h"
@@ -96,14 +96,6 @@
 #define        TF_L    TF_LOCAL
 #define        TF_I    TF_IN
 
-#undef CURLWP
-#undef CPCB
-#undef FPLWP
-
-#define        CURLWP  (CPUINFO_VA + CI_CURLWP)
-#define        CPCB    (CPUINFO_VA + CI_CPCB)
-#define        FPLWP   (CPUINFO_VA + CI_FPLWP)
-
 /* Let us use same syntax as C code */
 #define Debugger()     ta      1; nop
 
@@ -125,74 +117,10 @@
        .register       %g2,#scratch
        .register       %g3,#scratch
 
-/*
- * Here are some defines to try to maintain consistency but still
- * support 32-and 64-bit compilers.
- */
-#ifdef _LP64
-/* reg that points to base of data/text segment */
-#define        BASEREG %g4
-/* first constants for storage allocation */
-#define LNGSZ          8
-#define LNGSHFT                3
-#define PTRSZ          8
-#define PTRSHFT                3
-#define POINTER                .xword
-#define ULONG          .xword
-/* Now instructions to load/store pointers & long ints */
-#define LDLNG          ldx
-#define LDULNG         ldx
-#define STLNG          stx
-#define STULNG         stx
-#define LDPTR          ldx
-#define LDPTRA         ldxa
-#define STPTR          stx
-#define STPTRA         stxa
-#define        CASPTR          casxa
-/* Now something to calculate the stack bias */
-#define STKB           BIAS
-#define        CCCR            %xcc
-#else
-#define        BASEREG         %g0
-#define LNGSZ          4
-#define LNGSHFT                2
-#define PTRSZ          4
-#define PTRSHFT                2
-#define POINTER                .word
-#define ULONG          .word
-/* Instructions to load/store pointers & long ints */
-#define LDLNG          ldsw
-#define LDULNG         lduw
-#define STLNG          stw
-#define STULNG         stw
-#define LDPTR          lduw
-#define LDPTRA         lduwa
-#define STPTR          stw
-#define STPTRA         stwa
-#define        CASPTR          casa
-#define STKB           0
-#define        CCCR            %icc
-#endif
-
-/*
- * GNU assembler does not understand `.empty' directive; Sun assembler
- * gripes about labels without it.  To allow cross-compilation using
- * the Sun assembler, and because .empty directives are useful
- * documentation, we use this trick.
- */
-#ifdef SUN_AS
-#define        EMPTY   .empty
-#else
-#define        EMPTY   /* .empty */
-#endif
-
 /* use as needed to align things on longword boundaries */
 #define        _ALIGN  .align 8
 #define ICACHE_ALIGN   .align  32
 
-/* Give this real authority: reset the machine */
-#define NOTREACHED     sir
-
 /*
  * This macro will clear out a cache line before an explicit
  * access to that location.  It's mostly used to make certain
@@ -307,77 +235,6 @@
 #define        STACKFRAME(size)        TO_STACK32(size)
 #endif
 
-#ifdef USE_BLOCK_STORE_LOAD
-/*
- * The following routines allow fpu use in the kernel.
- *
- * They allocate a stack frame and use all local regs.  Extra
- * local storage can be requested by setting the siz parameter,
- * and can be accessed at %sp+CC64FSZ.
- */
-
-#define ENABLE_FPU(siz)                                                                             \
-       save    %sp, -(CC64FSZ), %sp;           /* Allocate a stack frame */                 \
-       sethi   %hi(FPLWP), %l1;                                                             \
-       add     %fp, STKB-FS_SIZE, %l0;         /* Allocate a fpstate */                     \
-       LDPTR   [%l1 + %lo(FPLWP)], %l2;        /* Load fplwp */                             \
-       andn    %l0, BLOCK_ALIGN, %l0;          /* Align it */                               \
-       clr     %l3;                            /* NULL fpstate */                           \
-       brz,pt  %l2, 1f;                        /* fplwp == NULL? */                         \
-        add    %l0, -STKB-CC64FSZ-(siz), %sp;  /* Set proper %sp */                         \
-       LDPTR   [%l2 + L_FPSTATE], %l3;                                                      \
-       brz,pn  %l3, 1f;                        /* Make sure we have an fpstate */           \
-        mov    %l3, %o0;                                                                    \
-       call    _C_LABEL(savefpstate);          /* Save the old fpstate */                   \
-1:                                                                                          \
-        set    EINTSTACK-STKB, %l4;            /* Are we on intr stack? */                  \
-       cmp     %sp, %l4;                                                                    \
-       bgu,pt  %xcc, 1f;                                                                    \
-        set    INTSTACK-STKB, %l4;                                                          \
-       cmp     %sp, %l4;                                                                    \
-       blu     %xcc, 1f;                                                                    \
-0:                                                                                          \
-        sethi  %hi(_C_LABEL(lwp0)), %l4;       /* Yes, use lpw0 */                          \
-       ba,pt   %xcc, 2f;                       /* XXXX needs to change to CPUs idle proc */ \
-        or     %l4, %lo(_C_LABEL(lwp0)), %l5;                                               \
-1:                                                                                          \
-       sethi   %hi(CURLWP), %l4;               /* Use curlwp */                             \
-       LDPTR   [%l4 + %lo(CURLWP)], %l5;                                                    \
-       brz,pn  %l5, 0b; nop;                   /* If curlwp is NULL need to use lwp0 */     \
-2:                                                                                          \
-       LDPTR   [%l5 + L_FPSTATE], %l6;         /* Save old fpstate */                       \
-       STPTR   %l0, [%l5 + L_FPSTATE];         /* Insert new fpstate */                     \
-       STPTR   %l5, [%l1 + %lo(FPLWP)];        /* Set new fplwp */                          \
-       wr      %g0, FPRS_FEF, %fprs            /* Enable FPU */
-
-/*
- * Weve saved our possible fpstate, now disable the fpu
- * and continue with life.
- */
-#ifdef DEBUG
-#define __CHECK_FPU                            \
-       LDPTR   [%l5 + L_FPSTATE], %l7;         \
-       cmp     %l7, %l0;                       \
-       tnz     1;
-#else
-#define        __CHECK_FPU
-#endif
-       
-#define RESTORE_FPU                                                         \
-       __CHECK_FPU                                                          \
-       STPTR   %l2, [%l1 + %lo(FPLWP)];        /* Restore old fproc */      \
-       wr      %g0, 0, %fprs;                  /* Disable fpu */            \
-       brz,pt  %l3, 1f;                        /* Skip if no fpstate */     \
-        STPTR  %l6, [%l5 + L_FPSTATE];         /* Restore old fpstate */    \
-                                                                            \
-       mov     %l3, %o0;                                                    \
-       call    _C_LABEL(loadfpstate);          /* Re-load orig fpstate */   \
-1: \
-        membar #Sync;                          /* Finish all FP ops */
-
-#endif /* USE_BLOCK_STORE_LOAD */
-       



Home | Main Index | Thread Index | Old Index