Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64 Use per-cpu pcb, curlwp and fplwp rather th...



details:   https://anonhg.NetBSD.org/src/rev/7f8418c097e0
branches:  trunk
changeset: 555684:7f8418c097e0
user:      cdi <cdi%NetBSD.org@localhost>
date:      Tue Nov 25 05:14:58 2003 +0000

description:
Use per-cpu pcb, curlwp and fplwp rather than global ones. This brings
GENERIC.MP configuration to a usable state.

Approved by petrov@.

diffstat:

 sys/arch/sparc64/include/cpu.h          |  18 ++++-----------
 sys/arch/sparc64/include/pcb.h          |   6 +---
 sys/arch/sparc64/sparc64/db_interface.c |   7 ++---
 sys/arch/sparc64/sparc64/kgdb_stub.c    |   5 +--
 sys/arch/sparc64/sparc64/locore.s       |  12 +++-------
 sys/arch/sparc64/sparc64/machdep.c      |   6 ++--
 sys/arch/sparc64/sparc64/pmap.c         |   9 ++++---
 sys/arch/sparc64/sparc64/trap.c         |  36 ++++++++++++++------------------
 8 files changed, 40 insertions(+), 59 deletions(-)

diffs (truncated from 364 to 300 lines):

diff -r f21a4f5349f2 -r 7f8418c097e0 sys/arch/sparc64/include/cpu.h
--- a/sys/arch/sparc64/include/cpu.h    Tue Nov 25 04:57:05 2003 +0000
+++ b/sys/arch/sparc64/include/cpu.h    Tue Nov 25 05:14:58 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.39 2003/11/20 08:04:04 petrov Exp $ */
+/*     $NetBSD: cpu.h,v 1.40 2003/11/25 05:14:58 cdi Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -123,13 +123,12 @@
 };
 
 extern struct cpu_info *cpus;
-extern struct cpu_info cpu_info_store;
 
-#if defined(MULTIPROCESSOR)
 #define        curcpu()        ((struct cpu_info *)CPUINFO_VA)
-#else
-#define        curcpu()        (&cpu_info_store)
-#endif
+
+#define curlwp         curcpu()->ci_curlwp
+#define fplwp          curcpu()->ci_fplwp
+#define curpcb         curcpu()->ci_cpcb
 
 /*
  * definitions of cpu-dependent requirements
@@ -253,13 +252,6 @@
 #define        signotify(p)            (want_ast = 1)
 
 /*
- * Only one process may own the FPU state.
- *
- * XXX this must be per-cpu (eventually)
- */
-struct lwp *fplwp;             /* FPU owner */
-
-/*
  * Interrupt handler chains.  Interrupt handlers should return 0 for
  * ``not me'' or 1 (``I took care of it'').  intr_establish() inserts a
  * handler into the list.  The handler is called with its (single)
diff -r f21a4f5349f2 -r 7f8418c097e0 sys/arch/sparc64/include/pcb.h
--- a/sys/arch/sparc64/include/pcb.h    Tue Nov 25 04:57:05 2003 +0000
+++ b/sys/arch/sparc64/include/pcb.h    Tue Nov 25 05:14:58 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pcb.h,v 1.10 2003/08/07 16:29:49 agc Exp $ */
+/*     $NetBSD: pcb.h,v 1.11 2003/11/25 05:14:58 cdi Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -195,9 +195,7 @@
        struct  fpstate64 md_fpstate;
 };
 
-#ifdef _KERNEL
-extern struct pcb *cpcb;
-#else
+#ifndef _KERNEL
 /* Let gdb compile.  We need fancier macros to make these make sense. */
 #define pcb_psr        pcb_pstate
 #define pcb_wim        pcb_cwp
diff -r f21a4f5349f2 -r 7f8418c097e0 sys/arch/sparc64/sparc64/db_interface.c
--- a/sys/arch/sparc64/sparc64/db_interface.c   Tue Nov 25 04:57:05 2003 +0000
+++ b/sys/arch/sparc64/sparc64/db_interface.c   Tue Nov 25 05:14:58 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.c,v 1.72 2003/10/10 15:19:09 chs Exp $ */
+/*     $NetBSD: db_interface.c,v 1.73 2003/11/25 05:14:58 cdi Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.72 2003/10/10 15:19:09 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.73 2003/11/25 05:14:58 cdi Exp $");
 
 #include "opt_ddb.h"
 
@@ -883,11 +883,10 @@
        db_expr_t count;
        char *modif;
 {
-       extern struct pcb *cpcb;
        struct pcb *pcb;
        int i;
 
-       pcb = cpcb;
+       pcb = curpcb;
        if (have_addr) 
                pcb = (struct pcb*) addr;
 
diff -r f21a4f5349f2 -r 7f8418c097e0 sys/arch/sparc64/sparc64/kgdb_stub.c
--- a/sys/arch/sparc64/sparc64/kgdb_stub.c      Tue Nov 25 04:57:05 2003 +0000
+++ b/sys/arch/sparc64/sparc64/kgdb_stub.c      Tue Nov 25 05:14:58 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kgdb_stub.c,v 1.13 2003/08/07 16:29:51 agc Exp $ */
+/*     $NetBSD: kgdb_stub.c,v 1.14 2003/11/25 05:14:58 cdi Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -93,7 +93,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kgdb_stub.c,v 1.13 2003/08/07 16:29:51 agc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kgdb_stub.c,v 1.14 2003/11/25 05:14:58 cdi Exp $");
 
 #include "opt_kgdb.h"
 
@@ -646,7 +646,6 @@
 }
 
 extern char *kernel_map;                       /* XXX! */
-extern char *curlwp;                           /* XXX! */
 
 /*
  * XXX do kernacc and useracc calls if safe, otherwise use PTE protections.
diff -r f21a4f5349f2 -r 7f8418c097e0 sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Tue Nov 25 04:57:05 2003 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Tue Nov 25 05:14:58 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.183 2003/11/24 20:41:15 cdi Exp $ */
+/*     $NetBSD: locore.s,v 1.184 2003/11/25 05:14:58 cdi Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath
@@ -104,19 +104,13 @@
 #define        TF_L    TF_LOCAL
 #define        TF_I    TF_IN
 
-       
 #undef CURLWP
 #undef CPCB
 #undef FPLWP
-#ifndef MULTIPROCESSOR
-#define        CURLWP  _C_LABEL(curlwp)
-#define CPCB   _C_LABEL(cpcb)
-#define        FPLWP   _C_LABEL(fplwp)
-#else
+
 #define        CURLWP  (CPUINFO_VA+CI_CURLWP)
 #define CPCB   (CPUINFO_VA+CI_CPCB)
 #define        FPLWP   (CPUINFO_VA+CI_FPLWP)
-#endif
 
 /* Let us use same syntax as C code */
 #define Debugger()     ta      1; nop
@@ -7487,6 +7481,7 @@
 #if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
        call    _C_LABEL(sched_lock_idle)       ! Acquire sched_lock
 #endif
+
         wrpr   %g0, PIL_SCHED, %pil            ! Set splsched()
 
        /*
@@ -7541,6 +7536,7 @@
        stxa    %g0, [%o0] ASI_DMMU             ! Clear out our context
        membar  #Sync
        /* FALLTHROUGH */
+
 /*
  * When no processes are on the runq, switch
  * idles here waiting for something to come ready.
diff -r f21a4f5349f2 -r 7f8418c097e0 sys/arch/sparc64/sparc64/machdep.c
--- a/sys/arch/sparc64/sparc64/machdep.c        Tue Nov 25 04:57:05 2003 +0000
+++ b/sys/arch/sparc64/sparc64/machdep.c        Tue Nov 25 05:14:58 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.157 2003/11/13 03:09:29 chs Exp $ */
+/*     $NetBSD: machdep.c,v 1.158 2003/11/25 05:14:58 cdi Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.157 2003/11/13 03:09:29 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.158 2003/11/25 05:14:58 cdi Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -803,7 +803,7 @@
        extern struct mem_region *mem;
 
        /* copy registers to memory */
-       snapshot(cpcb);
+       snapshot(curpcb);
        stackdump();
 
        if (dumpdev == NODEV)
diff -r f21a4f5349f2 -r 7f8418c097e0 sys/arch/sparc64/sparc64/pmap.c
--- a/sys/arch/sparc64/sparc64/pmap.c   Tue Nov 25 04:57:05 2003 +0000
+++ b/sys/arch/sparc64/sparc64/pmap.c   Tue Nov 25 05:14:58 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.149 2003/11/09 16:41:53 martin Exp $        */
+/*     $NetBSD: pmap.c,v 1.150 2003/11/25 05:14:58 cdi Exp $   */
 /*
  * 
  * Copyright (C) 1996-1999 Eduardo Horvath.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.149 2003/11/09 16:41:53 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.150 2003/11/25 05:14:58 cdi Exp $");
 
 #undef NO_VCACHE /* Don't forget the locked TLB in dostart */
 #define        HWREF
@@ -1266,8 +1266,7 @@
                paddr_t pa;
 
                /* Initialize all the pointers to u0 */
-               cpcb = (struct pcb *)vmmap;
-               proc0paddr = cpcb;
+               proc0paddr = (struct pcb *)vmmap;
                u0[0] = vmmap;
                /* Allocate some VAs for u0 */
                u0[1] = vmmap + 2*USPACE;
@@ -1344,10 +1343,12 @@
                cpus->ci_cpcb = (struct pcb *)u0[0]; /* Need better source */
                cpus->ci_upaid = CPU_UPAID;
                cpus->ci_number = cpus->ci_upaid; /* How do we figure this out? */
+               cpus->ci_cpuid = cpus->ci_upaid;
                cpus->ci_fplwp = NULL;
                cpus->ci_spinup = main; /* Call main when we're running. */
                cpus->ci_initstack = (void *)u0[1];
                cpus->ci_paddr = cpu0paddr;
+
                /* The rest will be done at CPU attach time. */
                BDPRINTF(PDB_BOOT1, 
                         ("Done inserting cpu_info into pmap_kernel()\r\n"));
diff -r f21a4f5349f2 -r 7f8418c097e0 sys/arch/sparc64/sparc64/trap.c
--- a/sys/arch/sparc64/sparc64/trap.c   Tue Nov 25 04:57:05 2003 +0000
+++ b/sys/arch/sparc64/sparc64/trap.c   Tue Nov 25 05:14:58 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.102 2003/11/24 20:41:16 cdi Exp $ */
+/*     $NetBSD: trap.c,v 1.103 2003/11/25 05:14:58 cdi Exp $ */
 
 /*
  * Copyright (c) 1996-2002 Eduardo Horvath.  All rights reserved.
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.102 2003/11/24 20:41:16 cdi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.103 2003/11/25 05:14:58 cdi Exp $");
 
 #define NEW_FPSTATE
 
@@ -535,7 +535,7 @@
                    (void *)(u_long)tf->tf_pc, (void *)(u_long)tf->tf_npc);
                Debugger();
        }
-       if ((trapdebug & TDB_NSAVED && cpcb->pcb_nsaved) ||
+       if ((trapdebug & TDB_NSAVED && curpcb->pcb_nsaved) ||
            trapdebug & (TDB_FOLLOW | TDB_TRAP)) {
                char sbuf[sizeof(PSTATE_BITS) + 64];
 
@@ -1101,7 +1101,6 @@
        ksiginfo_t ksi;
 #ifdef DEBUG
        static int lastdouble;
-       extern struct pcb* cpcb;
 #endif
 
 #ifdef DEBUG
@@ -1111,15 +1110,15 @@
                Debugger();
        }
        write_user_windows();
-       if ((cpcb->pcb_nsaved > 8) ||
-           (trapdebug & TDB_NSAVED && cpcb->pcb_nsaved) ||
+       if ((curpcb->pcb_nsaved > 8) ||
+           (trapdebug & TDB_NSAVED && curpcb->pcb_nsaved) ||
            (trapdebug & (TDB_ADDFLT | TDB_FOLLOW))) {
                printf("%ld: data_access_fault(%p, %x, %p, %p, %lx, %lx) "
                        "nsaved=%d\n",
                        (long)(curproc?curproc->p_pid:-1), tf, type,
                        (void *)addr, (void *)pc,
-                       sfva, sfsr, (int)cpcb->pcb_nsaved);
-               if ((trapdebug & TDB_NSAVED && cpcb->pcb_nsaved))
+                       sfva, sfsr, (int)curpcb->pcb_nsaved);
+               if ((trapdebug & TDB_NSAVED && curpcb->pcb_nsaved))
                        Debugger();
        }
        if (trapdebug & TDB_FRAME) {
@@ -1130,7 +1129,7 @@
                        "nsaved=%d\n",
                        (long)(curproc?curproc->p_pid:-1), tf, type,
                        (void*)addr, (void*)pc,
-                       sfva, sfsr, (int)cpcb->pcb_nsaved);
+                       sfva, sfsr, (int)curpcb->pcb_nsaved);
                Debugger();
        }
        if (trapdebug & TDB_STOPCALL) {
@@ -1293,7 +1292,7 @@
                               "%lx, %lx) nsaved=%d\n",
                                (long)(curproc ? curproc->p_pid : -1), tf, type,
                                (void *)addr, (void *)pc,



Home | Main Index | Thread Index | Old Index