2005-04-21 16:53:53 +02:00
|
|
|
/* The system call implemented in this file:
|
|
|
|
* m_type: SYS_DEBUG
|
|
|
|
*
|
|
|
|
* The parameters for this system call are:
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "../kernel.h"
|
|
|
|
#include "../system.h"
|
2005-05-24 14:33:03 +02:00
|
|
|
#include "../proc.h"
|
2005-04-21 16:53:53 +02:00
|
|
|
|
|
|
|
#if ENABLE_K_DEBUGGING /* only include code if enabled */
|
|
|
|
|
2005-05-24 14:33:03 +02:00
|
|
|
#define PROCLIMIT 10000
|
|
|
|
|
|
|
|
PUBLIC void
|
|
|
|
check_runqueues(char *when)
|
|
|
|
{
|
|
|
|
int q, l = 0;
|
|
|
|
register struct proc *xp;
|
|
|
|
|
|
|
|
for (xp = BEG_PROC_ADDR; xp < END_PROC_ADDR; ++xp) {
|
|
|
|
xp->p_found = 0;
|
|
|
|
if(l++ > PROCLIMIT) { panic("check error", NO_NUM); }
|
|
|
|
}
|
|
|
|
|
|
|
|
for (q=0; q < NR_SCHED_QUEUES; q++) {
|
|
|
|
if(rdy_head[q] && !rdy_tail[q]) {
|
|
|
|
kprintf("head but no tail: %s", (karg_t) when);
|
|
|
|
panic("scheduling error", NO_NUM);
|
|
|
|
}
|
|
|
|
if(!rdy_head[q] && rdy_tail[q]) {
|
|
|
|
kprintf("tail but no head: %s", (karg_t) when);
|
|
|
|
panic("scheduling error", NO_NUM);
|
|
|
|
}
|
|
|
|
if(rdy_tail[q] && rdy_tail[q]->p_nextready != NIL_PROC) {
|
|
|
|
kprintf("tail and tail->next not null; %s", (karg_t) when);
|
|
|
|
panic("scheduling error", NO_NUM);
|
|
|
|
}
|
|
|
|
for(xp = rdy_head[q]; xp != NIL_PROC; xp = xp->p_nextready) {
|
|
|
|
if (!xp->p_ready) {
|
|
|
|
kprintf("scheduling error: unready on runq: %s\n", (karg_t) when);
|
|
|
|
|
|
|
|
panic("found unready process on run queue", NO_NUM);
|
|
|
|
}
|
|
|
|
if(xp->p_priority != q) {
|
|
|
|
kprintf("scheduling error: wrong priority: %s\n", (karg_t) when);
|
|
|
|
|
|
|
|
panic("wrong priority", NO_NUM);
|
|
|
|
}
|
|
|
|
if(xp->p_found) {
|
|
|
|
kprintf("scheduling error: double scheduling: %s\n", (karg_t) when);
|
|
|
|
panic("proc more than once on scheduling queue", NO_NUM);
|
|
|
|
}
|
|
|
|
xp->p_found = 1;
|
|
|
|
if(xp->p_nextready == NIL_PROC && rdy_tail[q] != xp) {
|
|
|
|
kprintf("scheduling error: last element not tail: %s\n", (karg_t) when);
|
|
|
|
panic("scheduling error", NO_NUM);
|
|
|
|
}
|
|
|
|
if(l++ > PROCLIMIT) panic("loop in schedule queue?", NO_NUM);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (xp = BEG_PROC_ADDR; xp < END_PROC_ADDR; ++xp) {
|
|
|
|
if(isalivep(xp) && xp->p_ready && !xp->p_found) {
|
|
|
|
kprintf("scheduling error: ready not on queue: %s\n", (karg_t) when);
|
|
|
|
panic("ready proc not on scheduling queue", NO_NUM);
|
|
|
|
if(l++ > PROCLIMIT) { panic("loop in proc.t?", NO_NUM); }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-21 16:53:53 +02:00
|
|
|
/*==========================================================================*
|
|
|
|
* do_debug *
|
|
|
|
*==========================================================================*/
|
|
|
|
|
|
|
|
#endif /* ENABLE_K_DEBUGGING */
|