PUBLIC void map_dmp() { register struct proc *rp; static struct proc *oldrp = cproc_addr(HARDWARE); int n = 0; vir_clicks base, limit; printf("\nPROC NAME- --TEXT--- --DATA--- --STACK-- SHADOW FLIP P BASE SIZE\n"); for (rp = oldrp; rp < END_PROC_ADDR; rp++) { if (rp->p_flags & P_SLOT_FREE) continue; if (++n > 20) break; base = rp->p_map[T].mem_phys; limit = rp->p_map[S].mem_phys + rp->p_map[S].mem_len; printf("%3d %-6.6s %4x %4x %4x %4x %4x %4x %4x %4d %d %4uK\n", proc_number(rp), rp->p_name, rp->p_map[T].mem_phys, rp->p_map[T].mem_len, rp->p_map[D].mem_phys, rp->p_map[D].mem_len, rp->p_map[S].mem_phys, rp->p_map[S].mem_len, rp->p_shadow, rp->p_nflips, rp->p_physio, click_to_round_k(base), click_to_round_k(limit)); } if (rp == END_PROC_ADDR) rp = cproc_addr(HARDWARE); else printf("--more--\r"); oldrp = rp; }
PUBLIC void map_dmp() { register struct proc *rp; static struct proc *oldrp = cproc_addr(HARDWARE); int n = 0; phys_clicks size; printf("\nPROC NAME- -----TEXT----- -----DATA----- ----STACK----- -SIZE-\n"); for (rp = oldrp; rp < END_PROC_ADDR; rp++) { if (rp->p_flags & P_SLOT_FREE) continue; if (++n > 20) break; size = rp->p_map[T].mem_len + ((rp->p_map[S].mem_phys + rp->p_map[S].mem_len) - rp->p_map[D].mem_phys); printf("%3d %-6.6s %4x %4x %4x %4x %4x %4x %4x %4x %4x %5uK\n", proc_number(rp), rp->p_name, rp->p_map[T].mem_vir, rp->p_map[T].mem_phys, rp->p_map[T].mem_len, rp->p_map[D].mem_vir, rp->p_map[D].mem_phys, rp->p_map[D].mem_len, rp->p_map[S].mem_vir, rp->p_map[S].mem_phys, rp->p_map[S].mem_len, click_to_round_k(size)); } if (rp == END_PROC_ADDR) rp = cproc_addr(HARDWARE); else printf("--more--\r"); oldrp = rp; }
/*===========================================================================* * dpeth_task * *===========================================================================*/ void dp8390_task() { message m; int i, irq, r; dpeth_t *dep; long v; dpeth_tasknr= proc_number(proc_ptr); for (i= 0, dep= de_table; i<DE_PORT_NR; i++, dep++) { strcpy(dep->de_name, "dp8390#0"); dep->de_name[7] += i; } v= 0; (void) env_parse("ETH_IGN_PROTO", "x", 0, &v, 0x0000L, 0xFFFFL); eth_ign_proto= htons((u16_t) v); while (TRUE) { if ((r= receive(ANY, &m)) != OK) panic("dp8390: receive failed", r); switch (m.m_type) { case DL_WRITE: do_vwrite(&m, FALSE, FALSE); break; case DL_WRITEV: do_vwrite(&m, FALSE, TRUE); break; case DL_READ: do_vread(&m, FALSE); break; case DL_READV: do_vread(&m, TRUE); break; case DL_INIT: do_init(&m); break; case DL_GETSTAT: do_getstat(&m); break; case DL_STOP: do_stop(&m); break; case HARD_INT: for (i= 0, dep= &de_table[0]; i<DE_PORT_NR; i++, dep++) { if (dep->de_mode != DEM_ENABLED) continue; assert(dep->de_flags & DEF_ENABLED); irq= dep->de_irq; assert(irq >= 0 && irq < NR_IRQ_VECTORS); if (dep->de_int_pending) { dep->de_int_pending= 0; dp_check_ints(dep); do_int(dep); enable_irq(&dep->de_hook); } } break; default: panic("dp8390: illegal message", m.m_type); } } }
/*===========================================================================* * do_clocktick * *===========================================================================*/ PRIVATE void do_clocktick() { /* Despite its name, this routine is not called on every clock tick. It * is called on those clock ticks when a lot of work needs to be done. */ register struct proc *rp; register int proc_nr; if (next_alarm <= realtime) { /* An alarm may have gone off, but proc may have exited, so check. */ next_alarm = LONG_MAX; /* start computing next alarm */ for (rp = BEG_PROC_ADDR; rp < END_PROC_ADDR; rp++) { if (rp->p_alarm != 0) { /* See if this alarm time has been reached. */ if (rp->p_alarm <= realtime) { /* A timer has gone off. If it is a user proc, * send it a signal. If it is a task, call the * function previously specified by the task. */ proc_nr = proc_number(rp); if (watch_dog[proc_nr+NR_TASKS]) { watchdog_proc= proc_nr; (*watch_dog[proc_nr+NR_TASKS])(); } else cause_sig(proc_nr, SIGALRM); rp->p_alarm = 0; } /* Work on determining which alarm is next. */ if (rp->p_alarm != 0 && rp->p_alarm < next_alarm) next_alarm = rp->p_alarm; } } } /* If a user process has been running too long, pick another one. */ if (--sched_ticks == 0) { if (bill_ptr == prev_ptr) lock_sched(); /* process has run too long */ sched_ticks = SCHED_RATE; /* reset quantum */ prev_ptr = bill_ptr; /* new previous process */ } #if (SHADOWING == 1) if (rdy_head[SHADOW_Q]) unshadow(rdy_head[SHADOW_Q]); #endif }
PUBLIC void p_dmp() { /* Proc table dump */ register struct proc *rp; static struct proc *oldrp = BEG_PROC_ADDR; int n = 0; phys_clicks text, data, size; int proc_nr; printf("\n--pid --pc- ---sp- flag -user --sys-- -text- -data- -size- -recv- command\n"); for (rp = oldrp; rp < END_PROC_ADDR; rp++) { proc_nr = proc_number(rp); if (rp->p_flags & P_SLOT_FREE) continue; if (++n > 20) break; text = rp->p_map[T].mem_phys; data = rp->p_map[D].mem_phys; size = rp->p_map[T].mem_len + ((rp->p_map[S].mem_phys + rp->p_map[S].mem_len) - data); printf("%5d %5lx %6lx %2x %7U %7U %5uK %5uK %5uK ", proc_nr < 0 ? proc_nr : rp->p_pid, (unsigned long) rp->p_reg.pc, (unsigned long) rp->p_reg.sp, rp->p_flags, rp->user_time, rp->sys_time, click_to_round_k(text), click_to_round_k(data), click_to_round_k(size)); if (rp->p_flags & RECEIVING) { printf("%-7.7s", proc_name(rp->p_getfrom)); } else if (rp->p_flags & SENDING) { printf("S:%-5.5s", proc_name(rp->p_sendto)); } else if (rp->p_flags == 0) { printf(" "); } printf("%s\n", rp->p_name); } if (rp == END_PROC_ADDR) rp = BEG_PROC_ADDR; else printf("--more--\r"); oldrp = rp; }
/*=========================================================================* * mcd_task * *=========================================================================*/ PUBLIC void mcd_task() { long v; static char var[] = "MCD"; static char fmt[] = "x:d"; #if __minix_vmd mcd_tasknr = proc_number(proc_ptr); #endif /* Configure I/O base and IRQ. */ v = MCD_IO_BASE_ADDRESS; (void) env_parse(var, fmt, 0, &v, 0x000L, 0x3FFL); mcd_io_base = v; v = MCD_IRQ; (void) env_parse(var, fmt, 0, &v, 0L, (long) NR_IRQ_VECTORS - 1); mcd_irq = v; driver_task(&mcd_dtab); /* Start driver task for cdrom */ }
/*===========================================================================* * p_dmp * *===========================================================================*/ PUBLIC void p_dmp() { /* Proc table dump */ register struct proc *rp; static struct proc *oldrp = BEG_PROC_ADDR; int n = 0; vir_clicks base, limit; printf( "\nproc pid pc sp splow flag user sys recv command\n"); for (rp = oldrp; rp < END_PROC_ADDR; rp++) { if (rp->p_flags & P_SLOT_FREE) continue; if (++n > 20) break; base = rp->p_map[T].mem_phys; limit = rp->p_map[S].mem_phys + rp->p_map[S].mem_len; printf("%4u %4u %6lx %6lx %6lx %4x %5U %6U ", proc_number(rp), rp->p_pid, (unsigned long) rp->p_reg.pc, (unsigned long) rp->p_reg.sp, (unsigned long) rp->p_splow, rp->p_flags, rp->user_time, rp->sys_time); if (rp->p_flags & RECEIVING) { printf("%-7.7s", proc_name(rp->p_getfrom)); } else if (rp->p_flags & SENDING) { printf("S:%-5.5s", proc_name(rp->p_sendto)); } else if (rp->p_flags == 0) { printf(" "); } printf("%s\n", rp->p_name); } if (rp == END_PROC_ADDR) rp = BEG_PROC_ADDR; else printf("--more--\r"); oldrp = rp; }