i386 support for kernel addition
authorWilliam Nesheim <william@ucbvax.Berkeley.EDU>
Sun, 1 Jul 1990 10:29:22 +0000 (02:29 -0800)
committerWilliam Nesheim <william@ucbvax.Berkeley.EDU>
Sun, 1 Jul 1990 10:29:22 +0000 (02:29 -0800)
SCCS-vsn: sys/kern/kern_physio.c 7.15
SCCS-vsn: sys/kern/kern_exec.c 7.30
SCCS-vsn: sys/kern/subr_prof.c 7.9
SCCS-vsn: sys/kern/kern_clock.c 7.10

usr/src/sys/kern/kern_clock.c
usr/src/sys/kern/kern_exec.c
usr/src/sys/kern/kern_physio.c
usr/src/sys/kern/subr_prof.c

index c1afd2d..64a393d 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)kern_clock.c        7.9 (Berkeley) %G%
+ *     @(#)kern_clock.c        7.10 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
 #if defined(hp300)
 #include "machine/mtpr.h"
 #endif
 #if defined(hp300)
 #include "machine/mtpr.h"
 #endif
+#ifdef i386
+#include "machine/frame.h"
+#include "machine/segments.h"
+#endif
 
 #ifdef GPROF
 #include "gprof.h"
 
 #ifdef GPROF
 #include "gprof.h"
@@ -76,9 +80,15 @@ int  adjtimedelta;
  * we run through the statistics gathering routine as well.
  */
 /*ARGSUSED*/
  * we run through the statistics gathering routine as well.
  */
 /*ARGSUSED*/
+#ifndef i386
 hardclock(pc, ps)
        caddr_t pc;
        int ps;
 hardclock(pc, ps)
        caddr_t pc;
        int ps;
+#else
+hardclock(frame)
+       struct intrframe frame;
+#define        pc      frame.if_eip
+#endif
 {
        register struct callout *p1;
        register struct proc *p = u.u_procp;
 {
        register struct callout *p1;
        register struct proc *p = u.u_procp;
@@ -109,7 +119,11 @@ hardclock(pc, ps)
         * assuming that the current state has been around at least
         * one tick.
         */
         * assuming that the current state has been around at least
         * one tick.
         */
+#ifdef i386
+       if (ISPL(frame.if_cs) == SEL_UPL) {
+#else
        if (USERMODE(ps)) {
        if (USERMODE(ps)) {
+#endif
                /*
                 * CPU was in user state.  Increment
                 * user time counter, and process process-virtual time
                /*
                 * CPU was in user state.  Increment
                 * user time counter, and process process-virtual time
@@ -191,7 +205,11 @@ hardclock(pc, ps)
         * we must gather the statistics.
         */
        if (phz == 0)
         * we must gather the statistics.
         */
        if (phz == 0)
+#ifdef i386
+               gatherstats(pc, ISPL(frame.if_cs), frame.if_ppl);
+#else
                gatherstats(pc, ps);
                gatherstats(pc, ps);
+#endif
 
        /*
         * Increment the time-of-day, and schedule
 
        /*
         * Increment the time-of-day, and schedule
@@ -240,7 +258,12 @@ int        dk_ndrive = DK_NDRIVE;
  * update statistics accordingly.
  */
 /*ARGSUSED*/
  * update statistics accordingly.
  */
 /*ARGSUSED*/
+#ifdef i386
+#undef pc
+gatherstats(pc, ps, ppl)
+#else
 gatherstats(pc, ps)
 gatherstats(pc, ps)
+#endif
        caddr_t pc;
        int ps;
 {
        caddr_t pc;
        int ps;
 {
@@ -249,7 +272,11 @@ gatherstats(pc, ps)
        /*
         * Determine what state the cpu is in.
         */
        /*
         * Determine what state the cpu is in.
         */
+#ifdef i386
+       if (ps == SEL_UPL) {
+#else
        if (USERMODE(ps)) {
        if (USERMODE(ps)) {
+#endif
                /*
                 * CPU was in user state.
                 */
                /*
                 * CPU was in user state.
                 */
@@ -270,7 +297,11 @@ gatherstats(pc, ps)
                 * timers makes doing anything else difficult.
                 */
                cpstate = CP_SYS;
                 * timers makes doing anything else difficult.
                 */
                cpstate = CP_SYS;
+#if defined(i386)
+               if (noproc && ps == 0)
+#else
                if (noproc && BASEPRI(ps))
                if (noproc && BASEPRI(ps))
+#endif
                        cpstate = CP_IDLE;
 #ifdef GPROF
                s = pc - s_lowpc;
                        cpstate = CP_IDLE;
 #ifdef GPROF
                s = pc - s_lowpc;
@@ -294,9 +325,15 @@ gatherstats(pc, ps)
  * Run periodic events from timeout queue.
  */
 /*ARGSUSED*/
  * Run periodic events from timeout queue.
  */
 /*ARGSUSED*/
+#ifdef i386
+softclock(frame)
+       struct  intrframe frame;
+#define        pc      frame.if_eip
+#else
 softclock(pc, ps)
        caddr_t pc;
        int ps;
 softclock(pc, ps)
        caddr_t pc;
        int ps;
+#endif
 {
 
        for (;;) {
 {
 
        for (;;) {
@@ -321,7 +358,11 @@ softclock(pc, ps)
         * If trapped user-mode and profiling, give it
         * a profiling tick.
         */
         * If trapped user-mode and profiling, give it
         * a profiling tick.
         */
+#ifdef i386
+       if (ISPL(frame.if_cs) == SEL_UPL) {
+#else
        if (USERMODE(ps)) {
        if (USERMODE(ps)) {
+#endif
                register struct proc *p = u.u_procp;
 
                if (u.u_prof.pr_scale) {
                register struct proc *p = u.u_procp;
 
                if (u.u_prof.pr_scale) {
index f25718a..175c7c5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kern_exec.c 7.29 (Berkeley) %G%
+ *     @(#)kern_exec.c 7.30 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -647,6 +647,9 @@ getxfile(p, vp, ep, flags, nargc, uid, gid)
 #ifdef hp300
        TBIAU();
 #endif
 #ifdef hp300
        TBIAU();
 #endif
+#if defined(i386)
+       tlbflush();
+#endif
 
        /*
         * set SUID/SGID protections, if no tracing
 
        /*
         * set SUID/SGID protections, if no tracing
index b12dde4..e4a1f44 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)kern_physio.c       7.14 (Berkeley) %G%
+ *     @(#)kern_physio.c       7.15 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -106,7 +106,7 @@ swap(p, dblkno, addr, nbytes, rdflg, flag, vp, pfcent)
 #ifdef TRACE
                trace(TR_SWAPIO, vp, bp->b_blkno);
 #endif
 #ifdef TRACE
                trace(TR_SWAPIO, vp, bp->b_blkno);
 #endif
-#if defined(hp300)
+#if defined(hp300) || defined(i386)
                vmapbuf(bp);
 #endif
                VOP_STRATEGY(bp);
                vmapbuf(bp);
 #endif
                VOP_STRATEGY(bp);
@@ -116,7 +116,7 @@ swap(p, dblkno, addr, nbytes, rdflg, flag, vp, pfcent)
                                panic("big push");
                        return (0);
                }
                                panic("big push");
                        return (0);
                }
-#if defined(hp300)
+#if defined(hp300) || defined(i386)
                vunmapbuf(bp);
 #endif
                bp->b_un.b_addr += c;
                vunmapbuf(bp);
 #endif
                bp->b_un.b_addr += c;
@@ -157,7 +157,7 @@ swdone(bp)
        bclnlist = bp;
        if (bswlist.b_flags & B_WANTED)
                wakeup((caddr_t)&proc[2]);
        bclnlist = bp;
        if (bswlist.b_flags & B_WANTED)
                wakeup((caddr_t)&proc[2]);
-#if defined(hp300)
+#if defined(hp300) || defined(i386)
        vunmapbuf(bp);
 #endif
        splx(s);
        vunmapbuf(bp);
 #endif
        splx(s);
index cf6b88c..460616f 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)subr_prof.c 7.8 (Berkeley) %G%
+ *     @(#)subr_prof.c 7.9 (Berkeley) %G%
  */
 
 #ifdef GPROF
  */
 
 #ifdef GPROF
@@ -20,15 +20,7 @@ int  profiling = 3;
 u_short        *froms;
 struct tostruct *tos = 0;
 long   tolimit = 0;
 u_short        *froms;
 struct tostruct *tos = 0;
 long   tolimit = 0;
-#if defined(vax)
-char   *s_lowpc = (char *)0x80000000;
-#endif
-#if defined(tahoe)
-char   *s_lowpc = (char *)0xc0000000;
-#endif
-#if defined(hp300)
-char   *s_lowpc = (char *)0x00000000;
-#endif
+char   *s_lowpc = (char *)KERNBASE;
 extern char etext;
 char   *s_highpc = &etext;
 u_long s_textsize = 0;
 extern char etext;
 char   *s_highpc = &etext;
 u_long s_textsize = 0;