Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 Jul 2001 16:12:34 -0700 (PDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        freebsd-ppc@FreeBSD.org
Subject:   PPC kernel patches..
Message-ID:  <XFMail.010731161234.jhb@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
I came up with some simple patches today to remove astpending and want_resched.
FreeBSD-current doesn't handle those the way NetBSD does.  The patches do
include some new XXX's as well. :)  Mostly in the assembly stuff where someone
with more ppc asm fu than me will need to finish the changes.

http://www.FreeBSD.org/~jhb/patches/ppc.patch

Index: include/cpu.h
===================================================================
RCS file: /usr/cvs/src/sys/powerpc/include/cpu.h,v
retrieving revision 1.3
diff -u -r1.3 cpu.h
--- include/cpu.h       2001/07/01 02:38:38     1.3
+++ include/cpu.h       2001/07/31 22:54:48
@@ -53,10 +53,7 @@
 extern void delay __P((unsigned));
 #define        DELAY(n)                delay(n)
 
-extern int want_resched;
-extern int astpending;
-
-#define        need_proftick(p)        ((p)->p_flag |= PS_OWEUPC, astpending =
1)
+#define        need_proftick(p)        ((p)->p_sflag |= PS_OWEUPC)
 
 extern char bootpath[];
 
Index: include/globaldata.h
===================================================================
RCS file: /usr/cvs/src/sys/powerpc/include/globaldata.h,v
retrieving revision 1.11
diff -u -r1.11 globaldata.h
--- include/globaldata.h        2001/06/16 07:14:04     1.11
+++ include/globaldata.h        2001/07/31 22:54:17
@@ -56,7 +56,6 @@
        u_int32_t       gd_current_asngen;      /* ASN rollover check */
        u_int32_t       gd_intr_nesting_level;  /* interrupt recursion */
 
-       u_int           gd_astpending;
        SLIST_ENTRY(globaldata) gd_allcpu;
        struct lock_list_entry *gd_spinlocks;
 #ifdef KTR_PERCPU
Index: powerpc/extintr.c
===================================================================
RCS file: /usr/cvs/src/sys/powerpc/powerpc/extintr.c,v
retrieving revision 1.3
diff -u -r1.3 extintr.c
--- powerpc/extintr.c   2001/07/01 02:45:15     1.3
+++ powerpc/extintr.c   2001/07/31 22:53:40
@@ -90,7 +90,6 @@
 
 unsigned int   imen = 0xffffffff;
 u_int          cpl, ipending, tickspending;
-int            astpending;
 int            imask[NIPL];
 
 int            intrtype[NIRQ], intrmask[NIRQ], intrlevel[NIRQ];
Index: powerpc/genassym.c
===================================================================
RCS file: /usr/cvs/src/sys/powerpc/powerpc/genassym.c,v
retrieving revision 1.31
diff -u -r1.31 genassym.c
--- powerpc/genassym.c  2001/06/16 07:14:07     1.31
+++ powerpc/genassym.c  2001/07/31 22:54:07
@@ -67,7 +67,6 @@
 ASSYM(GD_CURPROC, offsetof(struct globaldata, gd_curproc));
 ASSYM(GD_CURPCB, offsetof(struct globaldata, gd_curpcb));
 ASSYM(GD_SWITCHTIME, offsetof(struct globaldata, gd_switchtime));
-ASSYM(GD_ASTPENDING, offsetof(struct globaldata, gd_astpending));
 
 ASSYM(MTX_LOCK, offsetof(struct mtx, mtx_lock));
 ASSYM(MTX_RECURSECNT, offsetof(struct mtx, mtx_recurse));
Index: powerpc/locore.s
===================================================================
RCS file: /usr/cvs/src/sys/powerpc/powerpc/locore.s,v
retrieving revision 1.3
diff -u -r1.3 locore.s
--- powerpc/locore.s    2001/06/27 12:23:40     1.3
+++ powerpc/locore.s    2001/07/31 22:57:31
@@ -943,15 +943,11 @@
        lwz     5,FRAME_SRR1+8(1)
        mtcr    5
        bc      4,17,1f                 /* branch if PSL_PR is false */
-       lis     3,astpending@ha
-       lwz     4,astpending@l(3)
-       andi.   4,4,1
-       beq     1f
 #if 0 /* XXX */
        li      6,EXC_AST
 #endif
        stw     6,FRAME_EXC+8(1)
-       b       trapagain
+       b       trapagain               /* XXX: should call ast(void) */
 1:
 #if 0
        FRAME_LEAVE(tempsave)
@@ -1129,10 +1125,6 @@
        lwz     3,GD_CURPCB(3)          /* get curpcb from globaldata */
        lwz     3,PCB_PMR(3)            /* get pmap real address from curpcb */
        mtsr    KERNEL_SR,3
-       lis     3,astpending@ha         /* Test AST pending */
-       lwz     4,astpending@l(3)
-       andi.   4,4,1
-       beq     1f
 /* Setup for entry to realtrap: */
        lwz     3,0(1)                  /* get saved SP */
        mtsprg  1,3
@@ -1152,7 +1144,7 @@
        lwz     31,intr_depth@l(30)
        addi    31,31,-1
        stw     31,intr_depth@l(30)
-       b       realtrap
+       b       realtrap                /* XXX: should call ast(void) */
 1:
 /* Here is the normal exit of extintr: */
        lwz     5,36(1)
Index: powerpc/swtch.s
===================================================================
RCS file: /usr/cvs/src/sys/powerpc/powerpc/swtch.s,v
retrieving revision 1.1
diff -u -r1.1 swtch.s
--- powerpc/swtch.s     2001/06/10 02:39:37     1.1
+++ powerpc/swtch.s     2001/07/31 22:52:47
@@ -157,11 +157,6 @@
        bl      chooseproc
 
 1:
-       /* just did this resched thing */
-       xor     3,3,3
-       lis     4,want_resched@ha
-       stw     3,want_resched@l(4)
-
        /* record new process */
        mfsprg  4,0
        stw     3,GD_CURPROC(4)
Index: powerpc/trap.c
===================================================================
RCS file: /usr/cvs/src/sys/powerpc/powerpc/trap.c,v
retrieving revision 1.2
diff -u -r1.2 trap.c
--- powerpc/trap.c      2001/06/29 19:51:36     1.2
+++ powerpc/trap.c      2001/07/31 22:51:21
@@ -63,9 +63,6 @@
 #define        NARGREG         8               /* 8 args are in registers */
 #define        MOREARGS(sp)    ((caddr_t)((int)(sp) + 8)) /* more args go here
*/
 
-volatile int   astpending;
-volatile int   want_resched;
-
 #if 0 /* XXX: not used yet */
 static int fix_unaligned __P((struct proc *p, struct trapframe *frame));
 #endif
@@ -80,6 +77,7 @@
 
        p = curproc;
        type = frame->exc;
+       mtx_lock(&Giant);
 
        if (frame->srr1 & PSL_PR) {
                type |= EXC_USER;
@@ -315,45 +313,14 @@
 #endif
                panic("trap");
        }
-
-       astpending = 0;         /* we are about to do it */
 
-       uvmexp.softs++;
-
-       if (p->p_flag & P_OWEUPC) {
-               p->p_flag &= ~P_OWEUPC;
-               ADDUPROF(p);
-       }
-
-       /* take pending signals */
-       {
-               int sig;
-
-               while (sig = CURSIG(p))
-                       postsig(sig);
-       }
-
-       p->p_priority = p->p_usrpri;
-       if (want_resched) {
-               int sig;
-               /*
-                * We are being preempted.
-                */
-               preempt(NULL);
-               while (sig = CURSIG(p))
-                       postsig(sig);
-       }
-
-       /*
-        * If profiling, charge recent system time to the trapped pc.
-        */
-       if (p->p_flag & P_PROFIL) {
-               extern int psratio;
-
-               addupc_task(p, frame->srr0,
-                           (int)(p->p_sticks - sticks) * psratio);
-       }
+       if (XXX_returning_to_user_mode)
+               userret(p, frame, sticks);
+       if (mtx_owned(&Giant))
+               mtx_unlock(&Giant);
        /*
+        * XXX: this needs to be handled somewhere else
+        *
         * If someone stole the fpu while we were away, disable it
         */
        if (p != fpuproc)


-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ppc" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.010731161234.jhb>