Use the MI setrunqueue()/remrunqueue().
This commit is contained in:
parent
422f1b7f01
commit
21c24b2090
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: Locore.c,v 1.5 2002/10/07 02:48:38 thorpej Exp $ */
|
||||
/* $NetBSD: Locore.c,v 1.6 2003/01/08 00:00:03 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Ben Harris.
|
||||
@ -41,7 +41,7 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
__RCSID("$NetBSD: Locore.c,v 1.5 2002/10/07 02:48:38 thorpej Exp $");
|
||||
__RCSID("$NetBSD: Locore.c,v 1.6 2003/01/08 00:00:03 thorpej Exp $");
|
||||
|
||||
#include <sys/proc.h>
|
||||
#include <sys/sched.h>
|
||||
@ -58,52 +58,6 @@ void idle(void);
|
||||
|
||||
struct pcb *curpcb;
|
||||
|
||||
/*
|
||||
* Put process p on the run queue indicated by its priority.
|
||||
* Calls should be made at splstatclock(), and p->p_stat should be SRUN.
|
||||
*/
|
||||
void
|
||||
setrunqueue(struct proc *p)
|
||||
{
|
||||
struct prochd *q;
|
||||
struct proc *oldlast;
|
||||
int which = p->p_priority >> 2;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (p->p_back)
|
||||
panic("setrunqueue");
|
||||
#endif
|
||||
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;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove process p from its run queue, which should be the one
|
||||
* indicated by its priority.
|
||||
* Calls should be made at splstatclock().
|
||||
*/
|
||||
void
|
||||
remrunqueue(struct proc *p)
|
||||
{
|
||||
int which = p->p_priority >> 2;
|
||||
struct prochd *q;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (!(sched_whichqs & (1 << which)))
|
||||
panic("remrunqueue");
|
||||
#endif
|
||||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
* Idle
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: types.h,v 1.3 2002/09/22 08:30:56 simonb Exp $ */
|
||||
/* $NetBSD: types.h,v 1.4 2003/01/08 00:00:05 thorpej Exp $ */
|
||||
|
||||
#ifndef _ACORN26_TYPES_H_
|
||||
#define _ACORN26_TYPES_H_
|
||||
@ -6,6 +6,5 @@
|
||||
#include <arm/arm26/types.h>
|
||||
|
||||
#define __HAVE_GENERIC_SOFT_INTERRUPTS
|
||||
#define __HAVE_MD_RUNQUEUE
|
||||
|
||||
#endif /* _ACORN26_TYPES_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: machdep.c,v 1.259 2002/09/25 22:21:01 thorpej Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.260 2003/01/08 00:02:25 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
|
||||
@ -75,7 +75,7 @@
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.259 2002/09/25 22:21:01 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.260 2003/01/08 00:02:25 thorpej Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -1920,62 +1920,6 @@ fpusave_proc(struct proc *p, int save)
|
||||
#endif /* MULTIPROCESSOR */
|
||||
}
|
||||
|
||||
/*
|
||||
* The following primitives manipulate the run queues. _whichqs tells which
|
||||
* of the 32 queues _qs have processes in them. Setrunqueue puts processes
|
||||
* into queues, Remrunqueue removes them from queues. The running process is
|
||||
* on no queue, other processes are on a queue related to p->p_priority,
|
||||
* divided by 4 actually to shrink the 0-127 range of priorities into the 32
|
||||
* available queues.
|
||||
*/
|
||||
/*
|
||||
* setrunqueue(p)
|
||||
* proc *p;
|
||||
*
|
||||
* Call should be made at splclock(), and p->p_stat should be SRUN.
|
||||
*/
|
||||
|
||||
void
|
||||
setrunqueue(p)
|
||||
struct proc *p;
|
||||
{
|
||||
int bit;
|
||||
|
||||
/* firewall: p->p_back must be NULL */
|
||||
if (p->p_back != NULL)
|
||||
panic("setrunqueue");
|
||||
|
||||
bit = p->p_priority >> 2;
|
||||
sched_whichqs |= (1 << bit);
|
||||
p->p_forw = (struct proc *)&sched_qs[bit];
|
||||
p->p_back = sched_qs[bit].ph_rlink;
|
||||
p->p_back->p_forw = p;
|
||||
sched_qs[bit].ph_rlink = p;
|
||||
}
|
||||
|
||||
/*
|
||||
* remrunqueue(p)
|
||||
*
|
||||
* Call should be made at splclock().
|
||||
*/
|
||||
void
|
||||
remrunqueue(p)
|
||||
struct proc *p;
|
||||
{
|
||||
int bit;
|
||||
|
||||
bit = p->p_priority >> 2;
|
||||
if ((sched_whichqs & (1 << bit)) == 0)
|
||||
panic("remrunqueue");
|
||||
|
||||
p->p_back->p_forw = p->p_forw;
|
||||
p->p_forw->p_back = p->p_back;
|
||||
p->p_back = NULL; /* for firewall checking. */
|
||||
|
||||
if ((struct proc *)&sched_qs[bit] == sched_qs[bit].ph_link)
|
||||
sched_whichqs &= ~(1 << bit);
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait "n" microseconds.
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: types.h,v 1.27 2002/09/22 08:30:57 simonb Exp $ */
|
||||
/* $NetBSD: types.h,v 1.28 2003/01/08 00:02:29 thorpej Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@ -66,6 +66,5 @@ typedef long int register_t;
|
||||
#define __HAVE_MINIMAL_EMUL
|
||||
#define __HAVE_AST_PERPROC
|
||||
#define __HAVE_RAS
|
||||
#define __HAVE_MD_RUNQUEUE
|
||||
|
||||
#endif /* _MACHTYPES_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user