Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64 Fixup non-DEBUG kernels.



details:   https://anonhg.NetBSD.org/src/rev/12e9304bb05d
branches:  trunk
changeset: 472841:12e9304bb05d
user:      eeh <eeh%NetBSD.org@localhost>
date:      Sun May 09 19:24:19 1999 +0000

description:
Fixup non-DEBUG kernels.

diffstat:

 sys/arch/sparc64/Makefile         |    9 ++-
 sys/arch/sparc64/sparc64/locore.s |  110 ++++++++++++++++++++++++-------------
 sys/arch/sparc64/sparc64/pmap.c   |    4 +-
 sys/arch/sparc64/stand/newvers.sh |    4 +-
 4 files changed, 82 insertions(+), 45 deletions(-)

diffs (truncated from 402 to 300 lines):

diff -r bc4ac16745b8 -r 12e9304bb05d sys/arch/sparc64/Makefile
--- a/sys/arch/sparc64/Makefile Sun May 09 19:23:38 1999 +0000
+++ b/sys/arch/sparc64/Makefile Sun May 09 19:24:19 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.6 1998/10/08 02:31:39 eeh Exp $
+#      $NetBSD: Makefile,v 1.7 1999/05/09 19:24:19 eeh Exp $
 
 # Makefile for sparc64 tags file and boot blocks
 
@@ -6,11 +6,12 @@
 SSPARC64=      ../sparc64/dev/*.[ch] ../sparc64/fpu/*.[ch] \
        ../sparc64/include/*.[ch] ../sparc64/sparc64/*.[ch]
 ASPARC64=      ../sparc64/sparc64/*.s
-CSPARC64=      ../../compat/*/*.[ch]
+# CSPARC64=    ../../compat/*/*.[ch]
 
 # Directories in which to place tags links
 DSPARC64=      conf dev fpu include sparc64
 
+SYSDIR=                ../../
 .include "../../kern/Make.tags.inc"
 
 tags:
@@ -20,6 +21,10 @@
            >> tags
        sort -o ${TSPARC64} ${TSPARC64}
 
+.ifmake TAGS
+COMM!=  find ${SYSDIR} -name "arch" -prune -o -name "*.[ch]" -print 
+.endif
+
 TAGS:
        etags  ${SSPARC64} ${COMM} ${CSPARC64} "--regex=/ENTRY(.*)/" \
                "--regex=/FUNC(.*)/" "--regex=/SYSCALL(.*)/" ${ASPARC64}
diff -r bc4ac16745b8 -r 12e9304bb05d sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Sun May 09 19:23:38 1999 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Sun May 09 19:24:19 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.37 1999/04/29 16:40:41 christos Exp $     */
+/*     $NetBSD: locore.s,v 1.38 1999/05/09 19:24:20 eeh Exp $  */
 /*
  * Copyright (c) 1996, 1997, 1998 Eduardo Horvath
  * Copyright (c) 1996 Paul Kranenburg
@@ -56,7 +56,7 @@
 #undef TRAPS_USE_IG            /* Use Interrupt Globals for trap handling */
 #undef LOCKED_PCB              /* Lock current proc's PCB in MMU */
 #define HWREF                  /* Handle ref/mod tracking in trap handlers */
-#undef MMUDEBUG                /* Check use of MMU regs during MMU faults */
+#undef MMUDEBUG                        /* Check use of MMU regs during MMU faults */
 #define VECTORED_INTERRUPTS    /* Use interrupt vectors */
 #define PMAP_FPSTATE           /* Allow nesting of VIS pmap copy/zero */
 #undef PMAP_PHYS_PAGE          /* Don't use block ld/st for pmap copy/zero */
@@ -434,6 +434,22 @@
        set KERNBASE+0x28, %g1; rdpr %tt, %g2; b label; stx %g2, [%g1]; NOTREACHED; TA8
 #endif
 #else
+#ifdef TRAPTRACE
+#define TRACEME                sethi %hi(1f), %g1; ba,pt %icc,traceit; or %g1, %lo(1f), %g1; 1:
+#if 0
+#define TRACEWIN       sethi %hi(9f), %l6; ba,pt %icc,traceitwin; or %l6, %lo(9f), %l6; 9:
+#endif
+#ifdef TRAPS_USE_IG
+#define TRACEWIN       wrpr %g0, PSTATE_KERN|PSTATE_AG, %pstate; sethi %hi(9f), %g1; ba,pt %icc,traceit; or %g1, %lo(9f), %g1; 9:
+#else
+#define TRACEWIN       wrpr %g0, PSTATE_KERN|PSTATE_IG, %pstate; sethi %hi(9f), %g1; ba,pt %icc,traceit; or %g1, %lo(9f), %g1; 9:
+#endif 
+#define TRACERELOAD32  ba reload32; nop;
+#define TRACERELOAD64  ba reload64; nop;
+#define TRACEFLT       TRACEME
+#define        VTRAP(type, label) \
+       sethi %hi(label), %g1; ba,pt %icc,traceit; or %g1, %lo(label), %g1; NOTREACHED; TA8
+#else
 #define TRACEME
 #define TRACEWIN       TRACEME
 #define TRACERELOAD32
@@ -442,7 +458,7 @@
 #define        VTRAP(type, label) \
        ba,a,pt %icc,label; nop; NOTREACHED; TA8
 #endif
-
+#endif
        /* hardware interrupts (can be linked or made `fast') */
 #define        HARDINT4U(lev) \
        VTRAP(lev, _C_LABEL(sparc_interrupt))
@@ -1718,7 +1734,7 @@
        be,pn   %icc, 1f;                                       /* If we were in kernel mode start saving globals */ \
        /* came from user mode -- switch to kernel mode stack */ \
         rdpr   %otherwin, %g5;                                 /* Has this already been done? */ \
-       tst     %g5; tnz %xcc, 1; nop; /* DEBUG -- this should _NEVER_ happen */ \
+       /* tst  %g5; tnz %xcc, 1; nop; /* DEBUG -- this should _NEVER_ happen */ \
        brnz,pn %g5, 1f;                                        /* Don't set this twice */ \
         rdpr   %canrestore, %g5;                               /* Fixup register window state registers */ \
        wrpr    %g0, 0, %canrestore; \
@@ -1850,7 +1866,7 @@
        be,pn   %icc, 1f;                                       /* If we were in kernel mode start saving globals */ \
        /* came from user mode -- switch to kernel mode stack */ \
         rdpr   %otherwin, %g5;                                 /* Has this already been done? */ \
-       tst     %g5; tnz %xcc, 1; nop; /* DEBUG -- this should _NEVER_ happen */ \
+       /* tst  %g5; tnz %xcc, 1; nop; /* DEBUG -- this should _NEVER_ happen */ \
        brnz,pn %g5, 1f;                                        /* Don't set this twice */ \
         rdpr   %canrestore, %g5;                               /* Fixup register window state registers */ \
        wrpr    %g0, 0, %canrestore; \
@@ -1990,11 +2006,13 @@
        stx     %g4, [%g2+8]                            ! Update TSB entry data
 
 
+#ifdef DEBUG
        set     trapbase, %g6   ! debug
        stx     %g1, [%g6+0x40] ! debug
        set     0x88, %g5       ! debug
        stx     %g4, [%g6+0x48] ! debug -- what we tried to enter in TLB
        stb     %g5, [%g6+0x8]  ! debug
+#endif
 #ifdef TRAPSTATS
        sethi   %hi(_C_LABEL(protfix)), %g1
        lduw    [%g1+%lo(_C_LABEL(protfix))], %g2
@@ -2110,11 +2128,13 @@
        stxa    %g4, [%g6] ASI_PHYS_CACHED              !  and write it out
        stx     %g1, [%g2]                              ! Update TSB entry tag
        stx     %g4, [%g2+8]                            ! Update TSB entry data
+#ifdef DEBUG
        set     trapbase, %g6   ! debug
        stx     %g3, [%g6+8]    ! debug
        set     0xa, %g5        ! debug
        stx     %g4, [%g6]      ! debug -- what we tried to enter in TLB
        stb     %g5, [%g6+0x20] ! debug
+#endif
        
        sllx    %g3, (64-12), %g6                       ! Need to demap old entry first
        mov     0x010, %g1                              ! Secondary flush
@@ -2337,10 +2357,12 @@
        inc     %g5
        stw     %g5, [%g7]
 #endif
+#ifdef DEBUG
        set     0x12, %g5                               ! debug
        sethi   %hi(trapbase), %g7                      ! debug
        stb     %g5, [%g7 + 0x20]                       ! debug
        CHKPT(%g5,%g7,0x11)
+#endif
 
        /*
         * Traverse kernel map to find paddr of cpcb and only us ASI_PHYS_CACHED to
@@ -2583,13 +2605,15 @@
        brnz,pt %g7, 1f                                 ! User fault -- save windows to pcb
         set    (2*NBPG)-8, %g7
 
-       set     trapbase, %g7                           ! debug
        and     %g4, CWP, %g4                           ! %g4 = %cwp of trap
        wrpr    %g4, 0, %cwp                            ! Kernel fault -- restore %cwp and force and trap to debugger
+#ifdef DEBUG
+       set     trapbase, %g7                           ! debug
        set     0x11, %g6                               ! debug
        stb     %g6, [%g7 + 0x20]                       ! debug
        CHKPT(%g2,%g1,0x17)
        sir
+#endif
        ta      1; nop                                  ! Enter debugger
        NOTREACHED
 1:
@@ -2599,11 +2623,13 @@
        brnz,pt %g7, 1b
         dec    8, %g7
 #endif
-       
+
+#ifdef DEBUG   
        CHKPT(%g2,%g1,0x18)
        set     trapbase, %g7                           ! debug
        set     0x19, %g6                               ! debug
        stb     %g6, [%g7 + 0x20]                       ! debug
+#endif
 #ifdef NOTDEF_DEBUG
        set     panicstack-CC64FSZ, %g5
        save    %g5, 0, %sp
@@ -2721,11 +2747,13 @@
 #ifdef TRAPS_USE_IG
        wrpr    %g0, PSTATE_KERN|PSTATE_IG, %pstate     ! We need to save volatile stuff to AG regs
 #endif
+#ifdef DEBUG
        set     trapbase, %g7                           ! debug
        set     0x20, %g6                               ! debug
        stx     %g0, [%g7]                              ! debug
        stb     %g6, [%g7 + 0x20]                       ! debug
        CHKPT(%g4,%g7,0xf)
+#endif
        wr      %g0, ASI_DMMU, %asi                     ! We need to re-load trap info
        ldxa    [%g0 + TLB_TAG_ACCESS] %asi, %g1        ! Get fault address from tag access register
 !      nop; nop; nop           ! Linux sez we need this after reading TAG_ACCESS
@@ -2773,12 +2801,12 @@
        mov     %g2, %o7                                ! Make the fault address look like the return address
        stx     %g7, [%sp + CC64FSZ + STKB + TF_G + (7*8)]      ! sneak in g7
 
-#if 1
+#ifdef DEBUG
        set     trapbase, %g7                           ! debug
        set     0x21, %g6                               ! debug
        stb     %g6, [%g7 + 0x20]                       ! debug
-#endif
        sth     %o0, [%sp + CC64FSZ + STKB + TF_TT]! debug
+#endif
        stx     %g1, [%sp + CC64FSZ + STKB + TF_TSTATE]         ! set tf.tf_psr, tf.tf_pc
        stx     %g2, [%sp + CC64FSZ + STKB + TF_PC]             ! set tf.tf_npc
        stx     %g3, [%sp + CC64FSZ + STKB + TF_NPC]
@@ -2904,7 +2932,7 @@
        srlx    %g6, (64-13-3), %g6                     ! This is now the offset into ctxbusy
        ldx     [%g4+%g6], %g4                          ! Load up our page table.
 
-#if 1
+#ifdef DEBUG
        /* Make sure we don't try to replace a kernel translation */
        /* This should not be necessary */
        brnz,pt %g6, Lutext_miss                        ! If user context continue miss
@@ -2958,11 +2986,13 @@
        stxa    %g4, [%g6] ASI_PHYS_CACHED              !  and store it
        stx     %g1, [%g2]                              ! Update TSB entry tag
        stx     %g4, [%g2+8]                            ! Update TSB entry data
+#ifdef DEBUG
        set     trapbase, %g6   ! debug
        stx     %g3, [%g6+8]    ! debug
        set     0xaa, %g3       ! debug
        stx     %g4, [%g6]      ! debug -- what we tried to enter in TLB
        stb     %g3, [%g6+0x20] ! debug
+#endif
        
        sllx    %g3, (64-12), %g6                       ! Need to demap old entry first
        mov     0x010, %g1                              ! Secondary flush
@@ -3536,8 +3566,10 @@
 #endif
        TRAP_SETUP(-CC64FSZ-TF_SIZE)
 
+#ifdef DEBUG
        rdpr    %tt, %o0        ! debug
        sth     %o0, [%sp + CC64FSZ + STKB + TF_TT]! debug
+#endif
                
        wrpr    %g0, PSTATE_KERN, %pstate               ! Get back to normal globals
        stx     %g1, [%sp + CC64FSZ + STKB + TF_G + ( 1*8)]
@@ -3862,8 +3894,10 @@
        !! In the medium anywhere model %g4 points to the start of the data segment.
        !! In our case we need to clear it before calling any C-code
        clr     %g4
-                                       
+
+#ifdef DEBUG
        flushw                  ! DEBUG
+#endif
        rd      %y, %l6
        INCR(_C_LABEL(uvmexp)+V_INTR)           ! cnt.v_intr++; (clobbers %o0,%o1)
        rdpr    %tt, %l5                        ! Find out our current IPL
@@ -4336,11 +4370,13 @@
        /* Here we need to undo the damage caused by switching to a kernel stack */
        
        rdpr    %otherwin, %g7                  ! restore register window controls
+#ifdef DEBUG
        rdpr    %canrestore, %g5                ! DEBUG
        tst     %g5                             ! DEBUG
        tnz     %icc, 1; nop                    ! DEBUG
 !      mov     %g0, %g5                        ! There shoud be *NO* %canrestore
        add     %g7, %g5, %g7                   ! DEBUG
+#endif
        wrpr    %g0, %g7, %canrestore
        wrpr    %g0, 0, %otherwin
 
@@ -4365,11 +4401,11 @@
        dec     %g7                                     ! We can do this now or later.  Move to last entry
        sll     %g7, 7, %g5                             ! calculate ptr into rw64 array 8*16 == 128 or 7 bits
 
+#ifdef DEBUG
        rdpr    %canrestore, %g4                        ! DEBUG Make sure we've restored everything
        brnz,a,pn       %g4, 0f                         ! DEBUG
         sir                                            ! DEBUG we should NOT have any usable windows here
 0:                                                     ! DEBUG
-#ifdef DEBUG
        wrpr    %g0, 5, %tl
 #endif
        rdpr    %otherwin, %g4
@@ -4412,7 +4448,9 @@
        ldx     [%g5 + PCB_RW + (14*8)], %i6 
        ldx     [%g5 + PCB_RW + (15*8)], %i7
 
+#ifdef DEBUG
        stx     %g0, [%g5 + PCB_RW + (14*8)]            ! DEBUG mark that we've saved this one
+#endif
        
        cmp     %g5, %g6
        bgu,pt  %xcc, 3b                                ! Next one?
@@ -4581,7 +4619,7 @@
        .globl  _C_LABEL(endtrapcode)
 _C_LABEL(endtrapcode):
 
-#ifdef DEBUG
+#ifdef DDB
 !!!
 !!! Dump the DTLB to phys address in %o0 and print it
 !!!
@@ -4608,7 +4646,7 @@
 
        retl
         nop



Home | Main Index | Thread Index | Old Index