Source-Changes-HG archive

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

[src/nathanw_sa]: src/sys/arch/sparc64/sparc64 more bits to SA



details:   https://anonhg.NetBSD.org/src/rev/f87232b8020b
branches:  nathanw_sa
changeset: 505513:f87232b8020b
user:      petrov <petrov%NetBSD.org@localhost>
date:      Fri Jan 04 09:26:46 2002 +0000

description:
more bits to SA

diffstat:

 sys/arch/sparc64/sparc64/locore.s     |  34 ++++++++++++++++--------------
 sys/arch/sparc64/sparc64/locore2.c    |  38 ++++------------------------------
 sys/arch/sparc64/sparc64/machdep.c    |   4 ++-
 sys/arch/sparc64/sparc64/trap.c       |  12 ++++++++--
 sys/arch/sparc64/sparc64/vm_machdep.c |   5 ++-
 5 files changed, 38 insertions(+), 55 deletions(-)

diffs (268 lines):

diff -r 738a5a68a1ec -r f87232b8020b sys/arch/sparc64/sparc64/locore.s
--- a/sys/arch/sparc64/sparc64/locore.s Fri Jan 04 06:19:32 2002 +0000
+++ b/sys/arch/sparc64/sparc64/locore.s Fri Jan 04 09:26:46 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.139.4.3 2002/01/03 10:03:55 petrov Exp $  */
+/*     $NetBSD: locore.s,v 1.139.4.4 2002/01/04 09:26:46 petrov Exp $  */
 
 /*
  * Copyright (c) 1996-2001 Eduardo Horvath
@@ -332,13 +332,13 @@
        cmp     %sp, %l4;                                                                    \
        blu     %xcc, 1f;                                                                    \
 0:                                                                                          \
-        sethi  %hi(_C_LABEL(proc0)), %l4;      /* Yes, use proc0 */                         \
+        sethi  %hi(_C_LABEL(lwp0)), %l4;       /* Yes, use proc0 */                         \
        ba,pt   %xcc, 2f;                       /* XXXX needs to change to CPUs idle proc */ \
-        or     %l4, %lo(_C_LABEL(proc0)), %l5;                                              \
+        or     %l4, %lo(_C_LABEL(lwp0)), %l5;                                               \
 1:                                                                                          \
        sethi   %hi(CURPROC), %l4;              /* Use curproc */                            \
        LDPTR   [%l4 + %lo(CURPROC)], %l5;                                                   \
-       brz,pn  %l5, 0b; nop;                   /* If curproc is NULL need to use proc0 */   \
+       brz,pn  %l5, 0b; nop;                   /* If curproc is NULL need to use lwp0 */   \
 2:                                                                                          \
        LDPTR   [%l5 + L_MD_FPSTATE], %l6;      /* Save old fpstate */                       \
        STPTR   %l0, [%l5 + L_MD_FPSTATE];      /* Insert new fpstate */                     \
@@ -7353,12 +7353,13 @@
         or     %lo(2f), %o0, %o0
 Lsw_panic_srun:
        sethi   %hi(3f), %o0
+       mov     %l3, %o1
        call    _C_LABEL(panic)
         or     %lo(3f), %o0, %o0
        .data
 1:     .asciz  "switch rq"
 2:     .asciz  "switch wchan"
-3:     .asciz  "switch LSRUN"
+3:     .asciz  "switch LSRUN %p %x"
 idlemsg:       .asciz  "idle %x %x %x %x"
 idlemsg1:      .asciz  " %x %x %x\r\n"
        _ALIGN
@@ -7536,8 +7537,8 @@
        LDPTR   [%l3 + L_WCHAN], %o0    ! if (l->l_wchan)
        brnz,pn %o0, Lsw_panic_wchan    !       panic("switch wchan");
         EMPTY
-       ldsb    [%l3 + L_STAT], %o0     ! if (l->l_stat != LSRUN)
-       cmp     %o0, LSRUN
+       ld      [%l3 + L_STAT], %o2     ! if (l->l_stat != LSRUN)
+       cmp     %o2, LSRUN
        bne     Lsw_panic_srun          !       panic("switch LSRUN");
         EMPTY
 
@@ -7552,7 +7553,7 @@
         */
 #endif
        mov     LSONPROC, %o0                   ! l->l_stat = SONPROC
-       stb     %o0, [%l3 + L_STAT]
+       st      %o0, [%l3 + L_STAT]
        sethi   %hi(_C_LABEL(want_resched)), %o0
        st      %g0, [%o0 + %lo(_C_LABEL(want_resched))]        ! want_resched = 0;
        LDPTR   [%l3 + L_ADDR], %l1             ! newpcb = p->p_addr;
@@ -8401,9 +8402,9 @@
        cmp     %sp, %l4
        blu     %xcc, 1f
 0:
-        sethi  %hi(_C_LABEL(proc0)), %l4               ! Yes, use proc0
+        sethi  %hi(_C_LABEL(lwp0)), %l4                ! Yes, use proc0
        ba,pt   %xcc, 2f
-        or     %l4, %lo(_C_LABEL(proc0)), %l5
+        or     %l4, %lo(_C_LABEL(lwp0)), %l5
 1:
        sethi   %hi(CURPROC), %l4                       ! Use curproc
        LDPTR   [%l4 + %lo(CURPROC)], %l5
@@ -8690,9 +8691,9 @@
        cmp     %sp, %l4
        blu     %xcc, 1f
 0:
-        sethi  %hi(_C_LABEL(proc0)), %l4               ! Yes, use proc0
+        sethi  %hi(_C_LABEL(lwp0)), %l4                ! Yes, use proc0
        ba,pt   %xcc, 2f
-        or     %l4, %lo(_C_LABEL(proc0)), %l5
+        or     %l4, %lo(_C_LABEL(lwp0)), %l5
 1:
        sethi   %hi(CURPROC), %l4                       ! No, use curproc
        LDPTR   [%l4 + %lo(CURPROC)], %l5
@@ -9811,9 +9812,9 @@
        cmp     %sp, %l4
        blu     %xcc, 1f
 0:
-        sethi  %hi(_C_LABEL(proc0)), %l4               ! Yes, use proc0
+        sethi  %hi(_C_LABEL(lwp0)), %l4                ! Yes, use proc0
        ba,pt   %xcc, 2f                                ! XXXX needs to change to CPUs idle proc
-        or     %l4, %lo(_C_LABEL(proc0)), %l5
+        or     %l4, %lo(_C_LABEL(lwp0)), %l5
 1:
        sethi   %hi(CURPROC), %l4                       ! Use curproc
        LDPTR   [%l4 + %lo(CURPROC)], %l5
@@ -11084,9 +11085,9 @@
        cmp     %sp, %l4
        blu     %xcc, 1f
 0:
-        sethi  %hi(_C_LABEL(proc0)), %l4               ! Yes, use proc0
+        sethi  %hi(_C_LABEL(lwp0)), %l4                ! Yes, use proc0
        ba,pt   %xcc, 2f                                ! XXXX needs to change to CPU's idle proc
-        or     %l4, %lo(_C_LABEL(proc0)), %l5
+        or     %l4, %lo(_C_LABEL(lwp0)), %l5
 1:
        sethi   %hi(CURPROC), %l4                       ! Use curproc
        LDPTR   [%l4 + %lo(CURPROC)], %l5
@@ -12396,6 +12397,7 @@
 _C_LABEL(ssym):
        POINTER 0
 #endif
+       ! XXX should it called lwp0paddr
        .globl  _C_LABEL(proc0paddr)
 _C_LABEL(proc0paddr):
        POINTER _C_LABEL(u0)            ! KVA of proc0 uarea
diff -r 738a5a68a1ec -r f87232b8020b sys/arch/sparc64/sparc64/locore2.c
--- a/sys/arch/sparc64/sparc64/locore2.c        Fri Jan 04 06:19:32 2002 +0000
+++ b/sys/arch/sparc64/sparc64/locore2.c        Fri Jan 04 09:26:46 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore2.c,v 1.2.12.1 2002/01/03 06:42:36 petrov Exp $ */
+/*     $NetBSD: locore2.c,v 1.2.12.2 2002/01/04 09:26:48 petrov Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -59,9 +59,8 @@
 #include <machine/cpu.h>
 
 /*
- * XXX comments
- * Put process p on the run queue indicated by its priority.
- * Calls should be made at splstatclock(), and p->p_stat should be SRUN.
+ * Put lwp l on the run queue indicated by its priority.
+ * Calls should be made at splstatclock(), and l->l_stat should be LSRUN.
  */
 void
 setrunqueue(l)
@@ -79,51 +78,24 @@
        l->l_back = sched_qs[bit].ph_rlink;
        l->l_back->l_forw = l;
        sched_qs[bit].ph_rlink = l;
-#if 0
-       register struct prochd *q;
-       register struct proc *oldlast;
-       register int which = l->l_priority >> 2;
-
-       if (p->p_back != NULL)
-               panic("setrunqueue");
-       q = &sched_qs[which];
-       sched_whichqs |= 1 << which;
-       p->p_forw = (struct proc *)q;
-       p->p_back = oldlast = q->ph_rlink;
-       q->ph_rlink = p;
-       oldlast->p_forw = p;
-#endif
 }
 
 /*
- * Remove process p from its run queue, which should be the one
+ * Remove lwp l from its run queue, which should be the one
  * indicated by its priority.  Calls should be made at splstatclock().
  */
 void
 remrunqueue(l)
        register struct lwp *l;
 {
-#if 0
-       register int which = p->p_priority >> 2;
-       register struct prochd *q;
-
-       if ((sched_whichqs & (1 << which)) == 0)
-               panic("remrq");
-       p->p_forw->p_back = p->p_back;
-       p->p_back->p_forw = p->p_forw;
-       p->p_back = NULL;
-       q = &sched_qs[which];
-       if (q->ph_link == (struct proc *)q)
-               sched_whichqs &= ~(1 << which);
-#endif
        int bit;
 
        bit = l->l_priority >> 2;
        if ((sched_whichqs & (1 << bit)) == 0)
                panic("remrunqueue");
 
+       l->l_forw->l_back = l->l_back;
        l->l_back->l_forw = l->l_forw;
-       l->l_forw->l_back = l->l_back;
        l->l_back = NULL;       /* for firewall checking. */
 
        if ((struct lwp *)&sched_qs[bit] == sched_qs[bit].ph_link)
diff -r 738a5a68a1ec -r f87232b8020b sys/arch/sparc64/sparc64/machdep.c
--- a/sys/arch/sparc64/sparc64/machdep.c        Fri Jan 04 06:19:32 2002 +0000
+++ b/sys/arch/sparc64/sparc64/machdep.c        Fri Jan 04 09:26:46 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.112.4.4 2002/01/03 10:03:56 petrov Exp $ */
+/*     $NetBSD: machdep.c,v 1.112.4.5 2002/01/04 09:26:48 petrov Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -2193,5 +2193,7 @@
        tf->tf_regs[FRAME_A4] = (u_int64_t)ap;
        tf->tf_regs[FRAME_T12] = (u_int64_t)upcall;  /* t12 is pv */
        alpha_pal_wrusp((unsigned long)sp);
+#else
+       panic("cpu_upcall");
 #endif
 }
diff -r 738a5a68a1ec -r f87232b8020b sys/arch/sparc64/sparc64/trap.c
--- a/sys/arch/sparc64/sparc64/trap.c   Fri Jan 04 06:19:32 2002 +0000
+++ b/sys/arch/sparc64/sparc64/trap.c   Fri Jan 04 09:26:46 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.74.4.3 2002/01/03 10:03:57 petrov Exp $ */
+/*     $NetBSD: trap.c,v 1.74.4.4 2002/01/04 09:26:49 petrov Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -435,7 +435,12 @@
        /* take pending signals */
        while ((sig = CURSIG(l)) != 0)
                postsig(sig);
-       l->l_priority = l->l_usrpri;
+
+       /* XXX copied from alpha port */
+       /* Invoke per-process kernel-exit handling, if any */
+       if (p->p_userret)
+               (p->p_userret)(l, p->p_userret_arg);
+
        if (want_ast) {
                want_ast = 0;
                if (p->p_flag & P_OWEUPC) {
@@ -462,7 +467,8 @@
        if (l->l_flag & L_SA_UPCALL)
                sa_upcall_userret(l);
 
-       curcpu()->ci_schedstate.spc_curpriority = l->l_priority;
+       curcpu()->ci_schedstate.spc_curpriority = l->l_priority = l->l_usrpri;
+;
 }
 
 /*
diff -r 738a5a68a1ec -r f87232b8020b sys/arch/sparc64/sparc64/vm_machdep.c
--- a/sys/arch/sparc64/sparc64/vm_machdep.c     Fri Jan 04 06:19:32 2002 +0000
+++ b/sys/arch/sparc64/sparc64/vm_machdep.c     Fri Jan 04 09:26:46 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm_machdep.c,v 1.41.4.3 2002/01/03 06:42:37 petrov Exp $ */
+/*     $NetBSD: vm_machdep.c,v 1.41.4.4 2002/01/04 09:26:49 petrov Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -246,7 +246,7 @@
         * the FPU user, we must save the FPU state first.
         */
 
-#ifdef NOTDEF_DEBUG
+#ifdef DEBUG
        printf("cpu_lwp_fork()\n");
 #endif
        if (l1 == curproc) {
@@ -361,6 +361,7 @@
            (u_int64_t)proc_trampoline;         /* ra: assembly magic */
        up->u_pcb.pcb_context[8] = ALPHA_PSL_IPL_0; /* ps: IPL */
 #endif
+       panic("cpu_setfunc");
 }      
 
 /*



Home | Main Index | Thread Index | Old Index