From c2cd510adf1b2a1132e01bc495a117178a276284 Mon Sep 17 00:00:00 2001 From: Jorrit Herder Date: Tue, 7 Jun 2005 14:43:35 +0000 Subject: [PATCH] Removed debug dumps from the PM and FS servers. The dumps are now done by the IS servers, which obtains a copy of the data through the getsysinfo() system call. CTRL-F1 now is a special TTY key to shows function key mappings. --- drivers/tty/keyboard.c | 2 +- include/unistd.h | 1 + kernel/protect.c | 3 - servers/fs/Makefile | 8 +- servers/fs/const.h | 2 + servers/fs/device.c | 2 +- servers/fs/dmap.c | 25 +- servers/fs/glo.h | 1 - servers/fs/misc.c | 12 +- servers/is/Makefile | 19 +- servers/is/diag.c | 27 ++ servers/is/dmp.c | 535 +----------------------------- servers/{fs/dmp.c => is/dmp_fs.c} | 60 ++-- servers/is/dmp_kernel.c | 484 +++++++++++++++++++++++++++ servers/{pm/dmp.c => is/dmp_pm.c} | 49 +-- servers/is/is.h | 4 +- servers/is/main.c | 5 +- servers/is/proto.h | 24 +- servers/pm/Makefile | 4 +- servers/pm/misc.c | 4 + 20 files changed, 616 insertions(+), 655 deletions(-) rename servers/{fs/dmp.c => is/dmp_fs.c} (66%) create mode 100644 servers/is/dmp_kernel.c rename servers/{pm/dmp.c => is/dmp_pm.c} (54%) diff --git a/drivers/tty/keyboard.c b/drivers/tty/keyboard.c index 3ec03b2d3..932e5915b 100644 --- a/drivers/tty/keyboard.c +++ b/drivers/tty/keyboard.c @@ -490,7 +490,7 @@ int scode; /* scan code for a function key */ if (F1 <= fkey && fkey <= F12) { /* F1-F12 */ observers = &fkey_obs[0]; index = fkey - F1; - } else if (SF2 <= fkey && fkey <= SF12) { /* Shift F2-F12 */ + } else if (SF1 <= fkey && fkey <= SF12) { /* Shift F2-F12 */ observers = &sfkey_obs[0]; index = fkey - SF1; } diff --git a/include/unistd.h b/include/unistd.h index ac57c7fbf..0a7c06b9e 100755 --- a/include/unistd.h +++ b/include/unistd.h @@ -39,6 +39,7 @@ #define SI_KINFO 0 /* get kernel info via PM */ #define SI_PROC_ADDR 1 /* address of process table */ #define SI_PROC_TAB 2 /* copy of entire process table */ +#define SI_DMAP_TAB 3 /* get device <-> driver mappings */ /* NULL must be defined in according to POSIX Sec. 2.7.1. */ #define NULL ((void *)0) diff --git a/kernel/protect.c b/kernel/protect.c index c6e327980..5be6f1615 100755 --- a/kernel/protect.c +++ b/kernel/protect.c @@ -199,7 +199,6 @@ vir_bytes size; int privilege; { /* Build descriptor for a code segment. */ - sdesc(segdp, base, size); segdp->access = (privilege << DPL_SHIFT) | (PRESENT | SEGMENT | EXECUTABLE | READABLE); @@ -231,7 +230,6 @@ phys_bytes base; vir_bytes size; { /* Fill in the size fields (base, limit and granularity) of a descriptor. */ - segdp->base_low = base; segdp->base_middle = base >> BASE_MIDDLE_SHIFT; segdp->base_high = base >> BASE_HIGH_SHIFT; @@ -313,7 +311,6 @@ vir_bytes offset; unsigned dpl_type; { /* Build descriptor for an interrupt gate. */ - register struct gatedesc_s *idp; idp = &idt[vec_nr]; diff --git a/servers/fs/Makefile b/servers/fs/Makefile index c62f9040f..305a0b215 100644 --- a/servers/fs/Makefile +++ b/servers/fs/Makefile @@ -13,7 +13,7 @@ CFLAGS = -I$i LDFLAGS = -i LIBS = -lsys -lutils -OBJ = main.o open.o read.o write.o pipe.o dmap.o dmp.o \ +OBJ = main.o open.o read.o write.o pipe.o dmap.o \ device.o path.o mount.o link.o super.o inode.o \ cache.o cache2.o filedes.o stadir.o protect.o time.o \ cmostime.o lock.o misc.o utility.o select.o table.o @@ -65,12 +65,6 @@ dmap.o: $h/com.h dmap.o: $h/utils.h dmap.o: dmap.h -dmp.o: $a -dmp.o: dmap.h -dmp.o: $h/callnr.h -dmp.o: $h/com.h -dmp.o: $h/keymap.h - filedes.o: $a filedes.o: file.h filedes.o: fproc.h diff --git a/servers/fs/const.h b/servers/fs/const.h index a21ae1131..e8e9141a9 100644 --- a/servers/fs/const.h +++ b/servers/fs/const.h @@ -9,6 +9,8 @@ #define NR_SUPERS 8 /* # slots in super block table */ #define NR_LOCKS 8 /* # slots in the file locking table */ +#define NR_DEVICES 16 /* # slots in the device <-> driver table */ + /* The type of sizeof may be (unsigned) long. Use the following macro for * taking the sizes of small objects so that there are no surprises like * (small) long constants being passed to routines expecting an int. diff --git a/servers/fs/device.c b/servers/fs/device.c index c83425e7e..d6f100304 100644 --- a/servers/fs/device.c +++ b/servers/fs/device.c @@ -42,7 +42,7 @@ int flags; /* mode bits and flags */ * device number for being in range. All others can trust this check.) */ major = (dev >> MAJOR) & BYTE; - if (major >= max_major) major = 0; + if (major >= NR_DEVICES) major = 0; dp = &dmap[major]; r = (*dp->dmap_opcl)(DEV_OPEN, dev, proc, flags); if (r == SUSPEND) panic(__FILE__,"suspend on open from", dp->dmap_driver); diff --git a/servers/fs/dmap.c b/servers/fs/dmap.c index 4cc69232a..3c4e3f7c5 100644 --- a/servers/fs/dmap.c +++ b/servers/fs/dmap.c @@ -28,7 +28,7 @@ Driver enabled Open/Cls I/O Driver # Flags Device File -------------- -------- ------ ----------- ----- ------ ---- */ -struct dmap dmap[] = { +struct dmap dmap[NR_DEVICES] = { DT(1, no_dev, 0, 0, 0) /* 0 = not used */ DT(1, gen_opcl, gen_io, MEMORY, 0) /* 1 = /dev/mem */ DT(ENABLE_FLOPPY, gen_opcl, gen_io, FLOPPY, 0) /* 2 = /dev/fd0 */ @@ -54,11 +54,6 @@ struct dmap dmap[] = { #endif /* IBM_PC */ }; -/* This is the maximum major number at compile time. This may change when - * devices are dynamically added or removed. - */ -int max_major = sizeof(dmap)/sizeof(struct dmap); - /*===========================================================================* * map_driver * @@ -77,19 +72,15 @@ int dev_style; /* style of the device */ struct dmap *dp; /* Get pointer to device entry in the dmap table. */ - if (major >= max_major) /* verify bounds */ - return(ENODEV); + if (major >= NR_DEVICES) return(ENODEV); dp = &dmap[major]; /* See if updating the entry is allowed. */ - if (! (dp->dmap_flags & DMAP_MUTABLE)) - return(EPERM); - if (dp->dmap_flags & DMAP_BUSY) - return(EBUSY); + if (! (dp->dmap_flags & DMAP_MUTABLE)) return(EPERM); + if (dp->dmap_flags & DMAP_BUSY) return(EBUSY); /* Check process number of new driver. */ - if (! isokprocnr(proc_nr)) - return(EINVAL); + if (! isokprocnr(proc_nr)) return(EINVAL); /* Try to update the entry. */ switch (dev_style) { @@ -143,12 +134,8 @@ PUBLIC void map_controllers() for (dp = drivertab; dp < drivertab + sizeof(drivertab)/sizeof(drivertab[0]); dp++) { if (strcmp(ctrlr_type, dp->wini_type) == 0) { /* found driver name */ -#if DEAD_CODE - if ((s=sys_getprocnr(&proc_nr, /* lookup proc nr */ - dp->proc_name, strlen(dp->proc_name)+1)) == OK) { -#endif if ((s=findproc(dp->proc_name, &proc_nr)) == OK) { - for (i=0; i< max_major; i++) { /* find mapping */ + for (i=0; i< NR_DEVICES; i++) { /* find mapping */ if (dmap[i].dmap_driver == CTRLR(c)) { if (map_driver(i, proc_nr, STYLE_DEV) == OK) { printf("FS: controller %s (%s) mapped to %s driver (proc. nr %d)\n", diff --git a/servers/fs/glo.h b/servers/fs/glo.h index de49bab1f..36fb64112 100644 --- a/servers/fs/glo.h +++ b/servers/fs/glo.h @@ -28,6 +28,5 @@ EXTERN int rdwt_err; /* status of last disk i/o request */ /* Data initialized elsewhere. */ extern _PROTOTYPE (int (*call_vec[]), (void) ); /* sys call table */ -extern int max_major; /* maximum major device (+ 1) */ extern char dot1[2]; /* dot1 (&dot1[0]) and dot2 (&dot2[0]) have a special */ extern char dot2[3]; /* meaning to search_dir: no access permission check. */ diff --git a/servers/fs/misc.c b/servers/fs/misc.c index 661c18618..773a89ebb 100644 --- a/servers/fs/misc.c +++ b/servers/fs/misc.c @@ -46,6 +46,14 @@ PUBLIC int do_getsysinfo() src_addr = (vir_bytes) &proc_addr; len = sizeof(struct fproc *); break; + case SI_PROC_TAB: + src_addr = (vir_bytes) fproc; + len = sizeof(struct fproc) * NR_PROCS; + break; + case SI_DMAP_TAB: + src_addr = (vir_bytes) dmap; + len = sizeof(struct dmap) * NR_DEVICES; + break; default: return(EINVAL); } @@ -421,10 +429,6 @@ PUBLIC int do_svrctl() major = (device.dev >> MAJOR) & BYTE; r=map_driver(major, who, device.style); return(r); -#if DEAD_CODE - if ((r=map_driver(major, who, device.style)) == OK) - fp->fp_pid = PID_SERVER; -#endif } default: return(EINVAL); diff --git a/servers/is/Makefile b/servers/is/Makefile index b49ecebb5..c33bee82c 100644 --- a/servers/is/Makefile +++ b/servers/is/Makefile @@ -8,6 +8,8 @@ s = $i/sys m = $i/minix b = $i/ibm k = $u/src/kernel +p = $u/src/servers/pm +f = $u/src/servers/fs # programs, flags, etc. CC = exec cc @@ -15,7 +17,7 @@ CFLAGS = -I$i LDFLAGS = -i LIBS = -lsys -lutils -OBJ = main.o dmp.o diag.o kputc.o +OBJ = main.o dmp.o dmp_kernel.o dmp_pm.o dmp_fs.o diag.o kputc.o # build local binary all build: $(SERVER) @@ -41,12 +43,21 @@ a = is.h proto.h glo.h \ main.o: $a +dmp.o: $a + diag.o: $a diag.o: $k/type.h -dmp.o: $a -dmp.o: $i/timers.h $i/string.h $b/interrupt.h -dmp.o: $k/proc.h $k/sendmask.h $k/type.h $k/const.h +dmp_kernel.o: $a +dmp_kernel.o: $i/timers.h $i/string.h $b/interrupt.h +dmp_kernel.o: $k/proc.h $k/sendmask.h $k/type.h $k/const.h + +dmp_pm.o: $a +dmp_pm.o: $p/mproc.h + +dmp_fs.o: $a +dmp_fs.o: $f/fproc.h +dmp_fs.o: $f/dmap.h kputc.o: $a diff --git a/servers/is/diag.c b/servers/is/diag.c index cf685100a..96d34d938 100644 --- a/servers/is/diag.c +++ b/servers/is/diag.c @@ -105,3 +105,30 @@ int c; /* char to be added to diag buffer */ diag_size += 1; } + +/*===========================================================================* + * diagnostics_dmp * + *===========================================================================*/ +PUBLIC void diagnostics_dmp() +{ + char print_buf[DIAG_BUF_SIZE+1]; /* buffer used to print */ + int start; /* calculate start of messages */ + int size, r; + + /* Reprint all diagnostic messages. First determine start and copy the + * buffer into a print-buffer. This is done because the messages in the + * copy may wrap (the buffer is circular). + */ + start = ((diag_next + DIAG_BUF_SIZE) - diag_size) % DIAG_BUF_SIZE; + r = 0; + size = diag_size; + while (size > 0) { + print_buf[r] = diag_buf[(start+r) % DIAG_BUF_SIZE]; + r ++; + size --; + } + print_buf[r] = 0; /* make sure it terminates */ + printf("Dump of diagnostics from device drivers and servers.\n\n"); + printf(print_buf); /* print the messages */ +} + diff --git a/servers/is/dmp.c b/servers/is/dmp.c index 0f5ee81f2..42026c333 100644 --- a/servers/is/dmp.c +++ b/servers/is/dmp.c @@ -7,47 +7,7 @@ * handle_fkey: handle a function key pressed notification */ - -/* Several header files from the kernel are included here so that we can use - * the constants, macros, and types needed to make the debugging dumps. - */ #include "is.h" -#include -#include -#include -#include -#include "../../kernel/const.h" -#include "../../kernel/type.h" -#include "../../kernel/proc.h" -#include "../../kernel/sendmask.h" - -#define click_to_round_k(n) \ - ((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024)) - - -/* Declare some local dump procedures. */ -FORWARD _PROTOTYPE( char *proc_name, (int proc_nr) ); -FORWARD _PROTOTYPE( void proctab_dmp, (void) ); -FORWARD _PROTOTYPE( void memmap_dmp, (void) ); -FORWARD _PROTOTYPE( void sendmask_dmp, (void) ); -FORWARD _PROTOTYPE( void image_dmp, (void) ); -FORWARD _PROTOTYPE( void irqtab_dmp, (void) ); -FORWARD _PROTOTYPE( void kmessages_dmp, (void) ); -FORWARD _PROTOTYPE( void diagnostics_dmp, (void) ); -FORWARD _PROTOTYPE( void sched_dmp, (void) ); -FORWARD _PROTOTYPE( void monparams_dmp, (void) ); -FORWARD _PROTOTYPE( void kenv_dmp, (void) ); -FORWARD _PROTOTYPE( void memchunks_dmp, (void) ); -#if ENABLE_LOCK_TIMING -FORWARD _PROTOTYPE( void timing_dmp, (void) ); -#endif - -/* Some global data that is shared among several dumping procedures. - * Note that the process table copy has the same name as in the kernel - * so that most macros and definitions from proc.h also apply here. - */ -struct proc proc[NR_TASKS + NR_PROCS]; -struct system_image image[IMAGE_SIZE]; /*===========================================================================* @@ -64,10 +24,8 @@ PUBLIC int do_fkey_pressed(message *m) case F5: monparams_dmp(); break; case F6: irqtab_dmp(); break; case F7: kmessages_dmp(); break; -#if ENABLE_LOCK_TIMING case F8: timing_dmp(); break; -#endif - case F9: diagnostics_dmp(); break; + case F10: kenv_dmp(); break; case F11: memchunks_dmp(); break; case F12: sched_dmp(); break; @@ -76,8 +34,16 @@ PUBLIC int do_fkey_pressed(message *m) m->NOTIFY_FLAGS, m->NOTIFY_ARG); } } + if (SF1 <= m->NOTIFY_ARG && m->NOTIFY_ARG <= SF12) { switch(m->NOTIFY_ARG) { + + case SF1: mproc_dmp(); break; + + case SF3: fproc_dmp(); break; + case SF4: dtab_dmp(); break; + + case SF6: diagnostics_dmp(); break; default: printf("IS: unhandled notify for Shift-F%d (code %d)\n", m->NOTIFY_FLAGS, m->NOTIFY_ARG); @@ -86,486 +52,3 @@ PUBLIC int do_fkey_pressed(message *m) return(EDONTREPLY); } - -/*===========================================================================* - * diagnostics_dmp * - *===========================================================================*/ -PRIVATE void diagnostics_dmp() -{ - char print_buf[DIAG_BUF_SIZE+1]; /* buffer used to print */ - int start; /* calculate start of messages */ - int size, r; - - /* Try to print the kernel messages. First determine start and copy the - * buffer into a print-buffer. This is done because the messages in the - * copy may wrap (the kernel buffer is circular). - */ - start = ((diag_next + DIAG_BUF_SIZE) - diag_size) % DIAG_BUF_SIZE; - r = 0; - size = diag_size; - while (size > 0) { - print_buf[r] = diag_buf[(start+r) % DIAG_BUF_SIZE]; - r ++; - size --; - } - print_buf[r] = 0; /* make sure it terminates */ - printf("Dump of diagnostics from device drivers and servers.\n\n"); - printf(print_buf); /* print the messages */ -} - -#if ENABLE_LOCK_TIMING -/*===========================================================================* - * timing_dmp * - *===========================================================================*/ -PRIVATE void timing_dmp() -{ - static struct lock_timedata timingdata[TIMING_CATEGORIES]; - int r, c, f, skipped = 0, printed = 0, maxlines = 23, x = 0; - static int offsetlines = 0; - - if ((r = sys_getlocktimings(timingdata)) != OK) { - report("warning: couldn't get copy of lock timings", r); - return; - } - - for(c = 0; c < TIMING_CATEGORIES; c++) { - int b; - if(!timingdata[c].lock_timings_range[0] || !timingdata[c].binsize) - continue; - x = printf("%-*s: misses %lu, resets %lu, measurements %lu: ", - TIMING_NAME, timingdata[c].names, - timingdata[c].misses, - timingdata[c].resets, - timingdata[c].measurements); - for(b = 0; b < TIMING_POINTS; b++) { - int w; - if(!timingdata[c].lock_timings[b]) - continue; - x += (w = printf(" %5d: %5d", timingdata[c].lock_timings_range[0] + - b*timingdata[c].binsize, - timingdata[c].lock_timings[b])); - if(x + w >= 80) { printf("\n"); x = 0; } - } - if(x > 0) printf("\n"); - } -} -#endif - -/*===========================================================================* - * kmessages_dmp * - *===========================================================================*/ -PRIVATE void kmessages_dmp() -{ - struct kmessages kmess; /* get copy of kernel messages */ - char print_buf[KMESS_BUF_SIZE+1]; /* this one is used to print */ - int next, size; /* vars returned by sys_kmess() */ - int start; /* calculate start of messages */ - int r; - - /* Try to get a copy of the kernel messages. */ - if ((r = sys_getkmessages(&kmess)) != OK) { - report("IS","warning: couldn't get copy of kmessages", r); - return; - } - - /* Try to print the kernel messages. First determine start and copy the - * buffer into a print-buffer. This is done because the messages in the - * copy may wrap (the kernel buffer is circular). - */ - start = ((kmess.km_next + KMESS_BUF_SIZE) - kmess.km_size) % KMESS_BUF_SIZE; - r = 0; - while (kmess.km_size > 0) { - print_buf[r] = kmess.km_buf[(start+r) % KMESS_BUF_SIZE]; - r ++; - kmess.km_size --; - } - print_buf[r] = 0; /* make sure it terminates */ - printf("Dump of all messages generated by the kernel.\n\n"); - printf("%s", print_buf); /* print the messages */ -} - - -/*===========================================================================* - * monparams_dmp * - *===========================================================================*/ -PRIVATE void monparams_dmp() -{ - char val[1024]; - char *e; - int r; - - /* Try to get a copy of the boot monitor parameters. */ - if ((r = sys_getmonparams(val, sizeof(val))) != OK) { - report("IS","warning: couldn't get copy of monitor params", r); - return; - } - - /* Append new lines to the result. */ - e = val; - do { - e += strlen(e); - *e++ = '\n'; - } while (*e != 0); - - /* Finally, print the result. */ - printf("Dump of kernel environment strings set by boot monitor.\n"); - printf("\n%s\n", val); -} - - -/*===========================================================================* - * irqtab_dmp * - *===========================================================================*/ -PRIVATE void irqtab_dmp() -{ - int i,j,r; - struct irq_hook irq_hooks[NR_IRQ_HOOKS]; - struct irq_hook *e; /* irq tab entry */ - char *irq[] = { - "clock", /* 00 */ - "keyboard", /* 01 */ - "cascade", /* 02 */ - "eth/rs232", /* 03 */ - "rs232", /* 04 */ - "xt_wini", /* 05 */ - "floppy", /* 06 */ - "printer", /* 07 */ - "", /* 08 */ - "", /* 09 */ - "", /* 10 */ - "", /* 11 */ - "", /* 12 */ - "", /* 13 */ - "at_wini_0", /* 14 */ - "at_wini_1", /* 15 */ - }; - - if ((r = sys_getirqhooks(irq_hooks)) != OK) { - report("IS","warning: couldn't get copy of irq hooks", r); - return; - } - - printf("IRQ policies dump shows use of kernel's IRQ hooks.\n"); - printf("-h.id- -proc.nr- -IRQ vector (nr.)- -policy- \n"); - for (i=0; iproc_nr==NONE) { - printf(" \n"); - continue; - } - printf("%10d ", e->proc_nr); - printf(" %9.9s (%02d) ", irq[e->irq], e->irq); - printf(" %s\n", (e->policy & IRQ_REENABLE) ? "reenable" : "-"); - } - printf("\n"); -} - - -/*===========================================================================* - * image_dmp * - *===========================================================================*/ -PRIVATE void image_dmp() -{ - int i,j,r; - struct system_image *ip; - char maskstr[NR_TASKS + NR_PROCS] = "mask"; - char* types[] = {"task", "system","driver", "server", "user", "idle"}; - char* priorities[] = {"task", "higher","high", "normal", "low", "lower", "user","idle"}; - - if ((r = sys_getimage(image)) != OK) { - report("IS","warning: couldn't get copy of image table", r); - return; - } - printf("Image table dump showing all processes included in system image.\n"); - printf("---name-- -nr- --type- -priority- ----pc- -stack- ------sendmask-------\n"); - for (i=0; isendmask, j)) ? '1' : '0'; - maskstr[j+NR_TASKS] = '\0'; - printf("%8s %4d %7s %10s %7lu %7lu %s\n", - ip->proc_name, ip->proc_nr, types[ip->type], priorities[ip->priority], - (long)ip->initial_pc, ip->stksize, maskstr); - } - printf("\n"); -} - -/*===========================================================================* - * sched_dmp * - *===========================================================================*/ -PRIVATE void sched_dmp() -{ - struct proc *rdy_head[NR_SCHED_QUEUES]; - char *types[] = {"task","higher","high","normal","low","lower","user","idle"}; - struct kinfo kinfo; - register struct proc *rp; - vir_bytes ptr_diff; - int r; - - /* First obtain a scheduling information. */ - if ((r = sys_getschedinfo(proc, rdy_head)) != OK) { - report("IS","warning: couldn't get copy of process table", r); - return; - } - /* Then obtain kernel addresses to correct pointer information. */ - if ((r = sys_getkinfo(&kinfo)) != OK) { - report("IS","warning: couldn't get kernel addresses", r); - return; - } - - /* Update all pointers. Nasty pointer algorithmic ... */ - ptr_diff = (vir_bytes) proc - (vir_bytes) kinfo.proc_addr; - for (r=0;rp_nextready != NIL_PROC) - rp->p_nextready = - (struct proc *)((vir_bytes) rp->p_nextready + ptr_diff); - - /* Now show scheduling queues. */ - printf("Dumping scheduling queues.\n"); - - for (r=0;rp_nr); - rp = rp->p_nextready; - } - printf("NIL\n"); - } - printf("\n"); -} - -/*===========================================================================* - * kenv_dmp * - *===========================================================================*/ -PRIVATE void kenv_dmp() -{ - struct kinfo kinfo; - struct machine machine; - int r; - if ((r = sys_getkinfo(&kinfo)) != OK) { - report("IS","warning: couldn't get copy of kernel info struct", r); - return; - } - if ((r = sys_getmachine(&machine)) != OK) { - report("IS","warning: couldn't get copy of kernel machine struct", r); - return; - } - - printf("Dump of kinfo and machine structures.\n\n"); - printf("Machine structure:\n"); - printf("- pc_at: %3d\n", machine.pc_at); - printf("- ps_mca: %3d\n", machine.ps_mca); - printf("- processor: %3d\n", machine.processor); - printf("- protected: %3d\n", machine.protected); - printf("- vdu_ega: %3d\n", machine.vdu_ega); - printf("- vdu_vga: %3d\n\n", machine.vdu_vga); - printf("Kernel info structure:\n"); - printf("- code_base: %5u\n", kinfo.code_base); - printf("- code_size: %5u\n", kinfo.code_size); - printf("- data_base: %5u\n", kinfo.data_base); - printf("- data_size: %5u\n", kinfo.data_size); - printf("- proc_addr: %5u\n", kinfo.proc_addr); - printf("- kmem_base: %5u\n", kinfo.kmem_base); - printf("- kmem_size: %5u\n", kinfo.kmem_size); - printf("- bootdev_base: %5u\n", kinfo.bootdev_base); - printf("- bootdev_size: %5u\n", kinfo.bootdev_size); - printf("- params_base: %5u\n", kinfo.params_base); - printf("- params_size: %5u\n", kinfo.params_size); - printf("- nr_procs: %3u\n", kinfo.nr_procs); - printf("- nr_tasks: %3u\n", kinfo.nr_tasks); - printf("- version: %.6s\n", kinfo.version); - printf("\n"); -} - -/*===========================================================================* - * memchunks_dmp * - *===========================================================================*/ -PRIVATE void memchunks_dmp() -{ - int i,r; - struct memory mem[NR_MEMS]; - if ((r = sys_getmemchunks(mem)) != OK) { - report("IS","warning: couldn't get copy of mem chunks", r); - return; - } - - printf("Memory chunks:\n"); - for (i=0; i 20) break; - - printf("%8s ", rp->p_name); - j = proc_nr(rp); - switch(rp->p_type) { - case P_IDLE: printf("/%2d/ ", proc_nr(rp)); break; - case P_TASK: printf("[%2d] ", proc_nr(rp)); break; - case P_SYSTEM: printf("<%2d> ", proc_nr(rp)); break; - case P_DRIVER: printf("{%2d} ", proc_nr(rp)); break; - case P_SERVER: printf("(%2d) ", proc_nr(rp)); break; - default: printf(" %2d ", proc_nr(rp)); - } - - for (j=proc_nr(BEG_PROC_ADDR); jp_sendmask, j)) printf(" 1 "); - else printf(" 0 "); - } - printf("\n"); - } - if (rp == END_PROC_ADDR) { printf("\n"); rp = BEG_PROC_ADDR; } - else printf("--more--\r"); - oldrp = rp; -} - - - -/*===========================================================================* - * proctab_dmp * - *===========================================================================*/ -#if (CHIP == INTEL) -PRIVATE void proctab_dmp() -{ -/* Proc table dump */ - - register struct proc *rp; - static struct proc *oldrp = BEG_PROC_ADDR; - int r, n = 0; - phys_clicks text, data, size; - - /* First obtain a fresh copy of the current process table. */ - if ((r = sys_getproctab(proc)) != OK) { - report("IS","warning: couldn't get copy of process table", r); - return; - } - - printf("\n--nr/name--- -q- -sc- -user- -sys- -text- -data- -size- -flags- -command-\n"); - - for (rp = oldrp; rp < END_PROC_ADDR; rp++) { - if (isemptyp(rp)) continue; - if (++n > 23) break; - text = rp->p_memmap[T].mem_phys; - data = rp->p_memmap[D].mem_phys; - size = rp->p_memmap[T].mem_len - + ((rp->p_memmap[S].mem_phys + rp->p_memmap[S].mem_len) - data); - switch(rp->p_type) { - case P_IDLE: printf("/%2d/ ", proc_nr(rp)); break; - case P_TASK: printf("[%2d] ", proc_nr(rp)); break; - case P_SYSTEM: printf("<%2d> ", proc_nr(rp)); break; - case P_DRIVER: printf("{%2d} ", proc_nr(rp)); break; - case P_SERVER: printf("(%2d) ", proc_nr(rp)); break; - default: printf(" %2d ", proc_nr(rp)); - } - printf("%-7.7s %2u %02.2x %6lu%6lu%6uK%6uK%6uK %3x", - rp->p_name, - rp->p_priority, - (char) rp->p_call_mask, - rp->p_user_time, rp->p_sys_time, - click_to_round_k(text), click_to_round_k(data), - click_to_round_k(size), - rp->p_flags); - 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("\n"); - } - if (rp == END_PROC_ADDR) rp = BEG_PROC_ADDR; else printf("--more--\r"); - oldrp = rp; -} -#endif /* (CHIP == INTEL) */ - -/*===========================================================================* - * memmap_dmp * - *===========================================================================*/ -PRIVATE void memmap_dmp() -{ - register struct proc *rp; - static struct proc *oldrp = proc; - int r, n = 0; - phys_clicks size; - - /* First obtain a fresh copy of the current process table. */ - if ((r = sys_getproctab(proc)) != OK) { - report("IS","warning: couldn't get copy of process table", r); - return; - } - - printf("\n-nr/name--- --pc-- --sp-- -----text----- -----data----- ----stack----- --size-\n"); - for (rp = oldrp; rp < END_PROC_ADDR; rp++) { - if (isemptyp(rp)) continue; - if (++n > 23) break; - size = rp->p_memmap[T].mem_len - + ((rp->p_memmap[S].mem_phys + rp->p_memmap[S].mem_len) - - rp->p_memmap[D].mem_phys); - printf("%3d %-7.7s%7lx%7lx %4x %4x %4x %4x %4x %4x %4x %4x %4x %5uK\n", - proc_nr(rp), - rp->p_name, - (unsigned long) rp->p_reg.pc, - (unsigned long) rp->p_reg.sp, - rp->p_memmap[T].mem_vir, rp->p_memmap[T].mem_phys, rp->p_memmap[T].mem_len, - rp->p_memmap[D].mem_vir, rp->p_memmap[D].mem_phys, rp->p_memmap[D].mem_len, - rp->p_memmap[S].mem_vir, rp->p_memmap[S].mem_phys, rp->p_memmap[S].mem_len, - click_to_round_k(size)); - } - if (rp == END_PROC_ADDR) rp = proc; - else printf("--more--\r"); - oldrp = rp; -} - -/*===========================================================================* - * proc_name * - *===========================================================================*/ -PRIVATE char *proc_name(proc_nr) -int proc_nr; -{ - if (proc_nr == ANY) return "ANY"; - return cproc_addr(proc_nr)->p_name; -} - - diff --git a/servers/fs/dmp.c b/servers/is/dmp_fs.c similarity index 66% rename from servers/fs/dmp.c rename to servers/is/dmp_fs.c index f0a799151..51cab0261 100644 --- a/servers/fs/dmp.c +++ b/servers/is/dmp_fs.c @@ -1,61 +1,34 @@ /* This file contains procedures to dump to FS' data structures. * * The entry points into this file are - * do_fkey_pressed: a function key was pressed - * dtab_dump: display device<->driver table + * dtab_dump: display device <-> driver mappings * fproc_dump: display FS process table * * Created: * Oct 01, 2004: by Jorrit N. Herder */ -#include "fs.h" -#include -#include -#include -#include "dmap.h" -#include "fproc.h" +#include "is.h" +#include "../fs/dmap.h" +#include "../fs/const.h" +#include "../fs/fproc.h" -FORWARD _PROTOTYPE( void dtab_dmp, (void)); -FORWARD _PROTOTYPE( void fproc_dmp, (void)); - - -/*===========================================================================* - * do_fkey_pressed * - *===========================================================================*/ -PUBLIC int do_fkey_pressed(void) -{ - printf("Debug dump of FS data structure: "); -#if DEAD_CODE - switch (m_in.FKEY_CODE) { -#else - switch (m_in.NOTIFY_FLAGS) { -#endif - case SF5: fproc_dmp(); break; - case SF6: dtab_dmp(); break; - - default: -#if DEAD_CODE - printf("FS: unhandled notification for Shift+F%d key.\n", - m_in.FKEY_NUM); -#else - printf("FS: unhandled notification for Shift+F%d key.\n", - m_in.NOTIFY_FLAGS); -#endif - } -} +PUBLIC struct fproc fproc[NR_PROCS]; +PUBLIC struct dmap dmap[NR_DEVICES]; /*===========================================================================* * fproc_dmp * *===========================================================================*/ -PRIVATE void fproc_dmp() +PUBLIC void fproc_dmp() { struct fproc *fp; int i, n=0; static int prev_i; - printf("PROCESS TABLE (beta)\n"); + getsysinfo(FS_PROC_NR, SI_PROC_TAB, fproc); + + printf("File System (FS) process table dump\n"); printf("-nr- -pid- -tty- -umask- --uid-- --gid-- -ldr- -sus-rev-proc- -cloexec-\n"); for (i=prev_i; i driver mappings\n"); printf("Dev File Open/Cls I/O Proc\n"); printf("--- ---------- -------- ------ ----\n"); - for (i=0; i +#include +#include "../../kernel/const.h" +#include "../../kernel/type.h" +#include "../../kernel/proc.h" +#include "../../kernel/sendmask.h" + +#define click_to_round_k(n) \ + ((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024)) + +/* Declare some local dump procedures. */ +FORWARD _PROTOTYPE( char *proc_name, (int proc_nr) ); + + +/* Some global data that is shared among several dumping procedures. + * Note that the process table copy has the same name as in the kernel + * so that most macros and definitions from proc.h also apply here. + */ +PUBLIC struct proc proc[NR_TASKS + NR_PROCS]; +PUBLIC struct system_image image[IMAGE_SIZE]; + + + +/*===========================================================================* + * timing_dmp * + *===========================================================================*/ +PUBLIC void timing_dmp() +{ +#if ! ENABLE_LOCK_TIMING + printf("Enable the ENABLE_LOCK_TIMING definition in \n"); +#else + static struct lock_timedata timingdata[TIMING_CATEGORIES]; + int r, c, f, skipped = 0, printed = 0, maxlines = 23, x = 0; + static int offsetlines = 0; + + if ((r = sys_getlocktimings(timingdata)) != OK) { + report("warning: couldn't get copy of lock timings", r); + return; + } + + for(c = 0; c < TIMING_CATEGORIES; c++) { + int b; + if(!timingdata[c].lock_timings_range[0] || !timingdata[c].binsize) + continue; + x = printf("%-*s: misses %lu, resets %lu, measurements %lu: ", + TIMING_NAME, timingdata[c].names, + timingdata[c].misses, + timingdata[c].resets, + timingdata[c].measurements); + for(b = 0; b < TIMING_POINTS; b++) { + int w; + if(!timingdata[c].lock_timings[b]) + continue; + x += (w = printf(" %5d: %5d", timingdata[c].lock_timings_range[0] + + b*timingdata[c].binsize, + timingdata[c].lock_timings[b])); + if(x + w >= 80) { printf("\n"); x = 0; } + } + if(x > 0) printf("\n"); + } +#endif +} + +/*===========================================================================* + * kmessages_dmp * + *===========================================================================*/ +PUBLIC void kmessages_dmp() +{ + struct kmessages kmess; /* get copy of kernel messages */ + char print_buf[KMESS_BUF_SIZE+1]; /* this one is used to print */ + int next, size; /* vars returned by sys_kmess() */ + int start; /* calculate start of messages */ + int r; + + /* Try to get a copy of the kernel messages. */ + if ((r = sys_getkmessages(&kmess)) != OK) { + report("IS","warning: couldn't get copy of kmessages", r); + return; + } + + /* Try to print the kernel messages. First determine start and copy the + * buffer into a print-buffer. This is done because the messages in the + * copy may wrap (the kernel buffer is circular). + */ + start = ((kmess.km_next + KMESS_BUF_SIZE) - kmess.km_size) % KMESS_BUF_SIZE; + r = 0; + while (kmess.km_size > 0) { + print_buf[r] = kmess.km_buf[(start+r) % KMESS_BUF_SIZE]; + r ++; + kmess.km_size --; + } + print_buf[r] = 0; /* make sure it terminates */ + printf("Dump of all messages generated by the kernel.\n\n"); + printf("%s", print_buf); /* print the messages */ +} + + +/*===========================================================================* + * monparams_dmp * + *===========================================================================*/ +PUBLIC void monparams_dmp() +{ + char val[1024]; + char *e; + int r; + + /* Try to get a copy of the boot monitor parameters. */ + if ((r = sys_getmonparams(val, sizeof(val))) != OK) { + report("IS","warning: couldn't get copy of monitor params", r); + return; + } + + /* Append new lines to the result. */ + e = val; + do { + e += strlen(e); + *e++ = '\n'; + } while (*e != 0); + + /* Finally, print the result. */ + printf("Dump of kernel environment strings set by boot monitor.\n"); + printf("\n%s\n", val); +} + + +/*===========================================================================* + * irqtab_dmp * + *===========================================================================*/ +PUBLIC void irqtab_dmp() +{ + int i,j,r; + struct irq_hook irq_hooks[NR_IRQ_HOOKS]; + struct irq_hook *e; /* irq tab entry */ + char *irq[] = { + "clock", /* 00 */ + "keyboard", /* 01 */ + "cascade", /* 02 */ + "eth/rs232", /* 03 */ + "rs232", /* 04 */ + "xt_wini", /* 05 */ + "floppy", /* 06 */ + "printer", /* 07 */ + "", /* 08 */ + "", /* 09 */ + "", /* 10 */ + "", /* 11 */ + "", /* 12 */ + "", /* 13 */ + "at_wini_0", /* 14 */ + "at_wini_1", /* 15 */ + }; + + if ((r = sys_getirqhooks(irq_hooks)) != OK) { + report("IS","warning: couldn't get copy of irq hooks", r); + return; + } + + printf("IRQ policies dump shows use of kernel's IRQ hooks.\n"); + printf("-h.id- -proc.nr- -IRQ vector (nr.)- -policy- \n"); + for (i=0; iproc_nr==NONE) { + printf(" \n"); + continue; + } + printf("%10d ", e->proc_nr); + printf(" %9.9s (%02d) ", irq[e->irq], e->irq); + printf(" %s\n", (e->policy & IRQ_REENABLE) ? "reenable" : "-"); + } + printf("\n"); +} + + +/*===========================================================================* + * image_dmp * + *===========================================================================*/ +PUBLIC void image_dmp() +{ + int i,j,r; + struct system_image *ip; + char maskstr[NR_TASKS + NR_PROCS] = "mask"; + char* types[] = {"task", "system","driver", "server", "user", "idle"}; + char* priorities[] = {"task", "higher","high", "normal", "low", "lower", "user","idle"}; + + if ((r = sys_getimage(image)) != OK) { + report("IS","warning: couldn't get copy of image table", r); + return; + } + printf("Image table dump showing all processes included in system image.\n"); + printf("---name-- -nr- --type- -priority- ----pc- -stack- ------sendmask-------\n"); + for (i=0; isendmask, j)) ? '1' : '0'; + maskstr[j+NR_TASKS] = '\0'; + printf("%8s %4d %7s %10s %7lu %7lu %s\n", + ip->proc_name, ip->proc_nr, types[ip->type], priorities[ip->priority], + (long)ip->initial_pc, ip->stksize, maskstr); + } + printf("\n"); +} + +/*===========================================================================* + * sched_dmp * + *===========================================================================*/ +PUBLIC void sched_dmp() +{ + struct proc *rdy_head[NR_SCHED_QUEUES]; + char *types[] = {"task","higher","high","normal","low","lower","user","idle"}; + struct kinfo kinfo; + register struct proc *rp; + vir_bytes ptr_diff; + int r; + + /* First obtain a scheduling information. */ + if ((r = sys_getschedinfo(proc, rdy_head)) != OK) { + report("IS","warning: couldn't get copy of process table", r); + return; + } + /* Then obtain kernel addresses to correct pointer information. */ + if ((r = sys_getkinfo(&kinfo)) != OK) { + report("IS","warning: couldn't get kernel addresses", r); + return; + } + + /* Update all pointers. Nasty pointer algorithmic ... */ + ptr_diff = (vir_bytes) proc - (vir_bytes) kinfo.proc_addr; + for (r=0;rp_nextready != NIL_PROC) + rp->p_nextready = + (struct proc *)((vir_bytes) rp->p_nextready + ptr_diff); + + /* Now show scheduling queues. */ + printf("Dumping scheduling queues.\n"); + + for (r=0;rp_nr); + rp = rp->p_nextready; + } + printf("NIL\n"); + } + printf("\n"); +} + +/*===========================================================================* + * kenv_dmp * + *===========================================================================*/ +PUBLIC void kenv_dmp() +{ + struct kinfo kinfo; + struct machine machine; + int r; + if ((r = sys_getkinfo(&kinfo)) != OK) { + report("IS","warning: couldn't get copy of kernel info struct", r); + return; + } + if ((r = sys_getmachine(&machine)) != OK) { + report("IS","warning: couldn't get copy of kernel machine struct", r); + return; + } + + printf("Dump of kinfo and machine structures.\n\n"); + printf("Machine structure:\n"); + printf("- pc_at: %3d\n", machine.pc_at); + printf("- ps_mca: %3d\n", machine.ps_mca); + printf("- processor: %3d\n", machine.processor); + printf("- protected: %3d\n", machine.protected); + printf("- vdu_ega: %3d\n", machine.vdu_ega); + printf("- vdu_vga: %3d\n\n", machine.vdu_vga); + printf("Kernel info structure:\n"); + printf("- code_base: %5u\n", kinfo.code_base); + printf("- code_size: %5u\n", kinfo.code_size); + printf("- data_base: %5u\n", kinfo.data_base); + printf("- data_size: %5u\n", kinfo.data_size); + printf("- proc_addr: %5u\n", kinfo.proc_addr); + printf("- kmem_base: %5u\n", kinfo.kmem_base); + printf("- kmem_size: %5u\n", kinfo.kmem_size); + printf("- bootdev_base: %5u\n", kinfo.bootdev_base); + printf("- bootdev_size: %5u\n", kinfo.bootdev_size); + printf("- params_base: %5u\n", kinfo.params_base); + printf("- params_size: %5u\n", kinfo.params_size); + printf("- nr_procs: %3u\n", kinfo.nr_procs); + printf("- nr_tasks: %3u\n", kinfo.nr_tasks); + printf("- version: %.6s\n", kinfo.version); + printf("\n"); +} + +/*===========================================================================* + * memchunks_dmp * + *===========================================================================*/ +PUBLIC void memchunks_dmp() +{ + int i,r; + struct memory mem[NR_MEMS]; + if ((r = sys_getmemchunks(mem)) != OK) { + report("IS","warning: couldn't get copy of mem chunks", r); + return; + } + + printf("Memory chunks:\n"); + for (i=0; i 20) break; + + printf("%8s ", rp->p_name); + j = proc_nr(rp); + switch(rp->p_type) { + case P_IDLE: printf("/%2d/ ", proc_nr(rp)); break; + case P_TASK: printf("[%2d] ", proc_nr(rp)); break; + case P_SYSTEM: printf("<%2d> ", proc_nr(rp)); break; + case P_DRIVER: printf("{%2d} ", proc_nr(rp)); break; + case P_SERVER: printf("(%2d) ", proc_nr(rp)); break; + default: printf(" %2d ", proc_nr(rp)); + } + + for (j=proc_nr(BEG_PROC_ADDR); jp_sendmask, j)) printf(" 1 "); + else printf(" 0 "); + } + printf("\n"); + } + if (rp == END_PROC_ADDR) { printf("\n"); rp = BEG_PROC_ADDR; } + else printf("--more--\r"); + oldrp = rp; +} + + + +/*===========================================================================* + * proctab_dmp * + *===========================================================================*/ +#if (CHIP == INTEL) +PUBLIC void proctab_dmp() +{ +/* Proc table dump */ + + register struct proc *rp; + static struct proc *oldrp = BEG_PROC_ADDR; + int r, n = 0; + phys_clicks text, data, size; + + /* First obtain a fresh copy of the current process table. */ + if ((r = sys_getproctab(proc)) != OK) { + report("IS","warning: couldn't get copy of process table", r); + return; + } + + printf("\n--nr/name--- -q- -sc- -user- -sys- -text- -data- -size- -flags- -command-\n"); + + for (rp = oldrp; rp < END_PROC_ADDR; rp++) { + if (isemptyp(rp)) continue; + if (++n > 23) break; + text = rp->p_memmap[T].mem_phys; + data = rp->p_memmap[D].mem_phys; + size = rp->p_memmap[T].mem_len + + ((rp->p_memmap[S].mem_phys + rp->p_memmap[S].mem_len) - data); + switch(rp->p_type) { + case P_IDLE: printf("/%2d/ ", proc_nr(rp)); break; + case P_TASK: printf("[%2d] ", proc_nr(rp)); break; + case P_SYSTEM: printf("<%2d> ", proc_nr(rp)); break; + case P_DRIVER: printf("{%2d} ", proc_nr(rp)); break; + case P_SERVER: printf("(%2d) ", proc_nr(rp)); break; + default: printf(" %2d ", proc_nr(rp)); + } + printf("%-7.7s %2u %02.2x %6lu%6lu%6uK%6uK%6uK %3x", + rp->p_name, + rp->p_priority, + (char) rp->p_call_mask, + rp->p_user_time, rp->p_sys_time, + click_to_round_k(text), click_to_round_k(data), + click_to_round_k(size), + rp->p_flags); + 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("\n"); + } + if (rp == END_PROC_ADDR) rp = BEG_PROC_ADDR; else printf("--more--\r"); + oldrp = rp; +} +#endif /* (CHIP == INTEL) */ + +/*===========================================================================* + * memmap_dmp * + *===========================================================================*/ +PUBLIC void memmap_dmp() +{ + register struct proc *rp; + static struct proc *oldrp = proc; + int r, n = 0; + phys_clicks size; + + /* First obtain a fresh copy of the current process table. */ + if ((r = sys_getproctab(proc)) != OK) { + report("IS","warning: couldn't get copy of process table", r); + return; + } + + printf("\n-nr/name--- --pc-- --sp-- -----text----- -----data----- ----stack----- --size-\n"); + for (rp = oldrp; rp < END_PROC_ADDR; rp++) { + if (isemptyp(rp)) continue; + if (++n > 23) break; + size = rp->p_memmap[T].mem_len + + ((rp->p_memmap[S].mem_phys + rp->p_memmap[S].mem_len) + - rp->p_memmap[D].mem_phys); + printf("%3d %-7.7s%7lx%7lx %4x %4x %4x %4x %4x %4x %4x %4x %4x %5uK\n", + proc_nr(rp), + rp->p_name, + (unsigned long) rp->p_reg.pc, + (unsigned long) rp->p_reg.sp, + rp->p_memmap[T].mem_vir, rp->p_memmap[T].mem_phys, rp->p_memmap[T].mem_len, + rp->p_memmap[D].mem_vir, rp->p_memmap[D].mem_phys, rp->p_memmap[D].mem_len, + rp->p_memmap[S].mem_vir, rp->p_memmap[S].mem_phys, rp->p_memmap[S].mem_len, + click_to_round_k(size)); + } + if (rp == END_PROC_ADDR) rp = proc; + else printf("--more--\r"); + oldrp = rp; +} + +/*===========================================================================* + * proc_name * + *===========================================================================*/ +PRIVATE char *proc_name(proc_nr) +int proc_nr; +{ + if (proc_nr == ANY) return "ANY"; + return cproc_addr(proc_nr)->p_name; +} + + diff --git a/servers/pm/dmp.c b/servers/is/dmp_pm.c similarity index 54% rename from servers/pm/dmp.c rename to servers/is/dmp_pm.c index 433bc1820..82c7d2999 100644 --- a/servers/pm/dmp.c +++ b/servers/is/dmp_pm.c @@ -1,57 +1,30 @@ /* This file contains procedures to dump to PM' data structures. * * The entry points into this file are - * do_fkey_pressed: a function key was pressed - * mproc_dump: display PM process table + * mproc_dmp: display PM process table * * Created: * May 11, 2005: by Jorrit N. Herder */ -#include "pm.h" -#include -#include -#include -#include -#include "mproc.h" +#include "is.h" +#include "../pm/mproc.h" -FORWARD _PROTOTYPE( void mproc_dmp, (void)); - - -/*===========================================================================* - * do_fkey_pressed * - *===========================================================================*/ -PUBLIC int do_fkey_pressed(void) -{ - printf("Process Manager debug dump: "); -#if DEAD_CODE - switch (m_in.FKEY_NUM) { -#else - switch (m_in.NOTIFY_FLAGS) { -#endif - case SF7: mproc_dmp(); break; - - default: -#if DEAD_CODE - printf("PM: unhandled notification for Shift+F%d key.\n", - m_in.FKEY_NUM); -#else - printf("PM: unhandled notification for Shift+F%d key.\n", - m_in.NOTIFY_FLAGS); -#endif - } -} +PUBLIC struct mproc mproc[NR_PROCS]; /*===========================================================================* * mproc_dmp * *===========================================================================*/ -PRIVATE void mproc_dmp() +PUBLIC void mproc_dmp() { struct mproc *mp; int i, n=0; - static int prev_i; - printf("Process Table\n"); + static int prev_i = 0; + + printf("Process manager (PM) process table dump\n"); + + getsysinfo(PM_PROC_NR, SI_PROC_TAB, mproc); printf("-process- -nr-prnt- -pid/grp- --uid---gid-- -flags- --ignore--catch--block--\n"); for (i=prev_i; imp_realuid, mp->mp_effuid, mp->mp_realgid, mp->mp_effgid); printf("0x%04x ", mp->mp_flags); - printf("0x%04x 0x%04x 0x%04x", + printf("0x%05x 0x%05x 0x%05x", mp->mp_ignore, mp->mp_catch, mp->mp_sigmask); printf("\n"); } diff --git a/servers/is/is.h b/servers/is/is.h index 06b3411d8..b7101c3e3 100644 --- a/servers/is/is.h +++ b/servers/is/is.h @@ -21,9 +21,11 @@ #include #include -#include #include #include +#include +#include +#include #include "proto.h" #include "glo.h" diff --git a/servers/is/main.c b/servers/is/main.c index d5b6e8db1..1003634dc 100644 --- a/servers/is/main.c +++ b/servers/is/main.c @@ -41,7 +41,6 @@ PUBLIC void main(void) * sending the reply. The loop never terminates, unless a panic occurs. */ int result; - static long count; /* Initialize the server, then go to work. */ init_server(); @@ -67,8 +66,8 @@ PUBLIC void main(void) /* never reached */ continue; default: - printf("Warning %u, IS got unexpected request %d from %d\n", - ++count, m_in.m_type, m_in.m_source); + printf("Warning, IS got unexpected request %d from %d\n", + m_in.m_type, m_in.m_source); result = EINVAL; } diff --git a/servers/is/proto.h b/servers/is/proto.h index 3c7ca6384..ccd8d028a 100644 --- a/servers/is/proto.h +++ b/servers/is/proto.h @@ -1,7 +1,5 @@ /* Function prototypes. */ -/* Structs used in prototypes must be declared as such first. */ - /* main.c */ _PROTOTYPE( void main, (void) ); @@ -12,8 +10,28 @@ _PROTOTYPE( void kputc, (int c) ); _PROTOTYPE( int do_new_kmess, (message *m) ); _PROTOTYPE( int do_diagnostics, (message *m) ); _PROTOTYPE( void diag_putc, (int c) ); +_PROTOTYPE( void diagnostics_dmp, (void) ); /* dmp.c */ -_PROTOTYPE( int do_fkey_pressed, (message *m) ); +_PROTOTYPE( int do_fkey_pressed, (message *m) ); + +/* dmp_kernel.c */ +_PROTOTYPE( void proctab_dmp, (void) ); +_PROTOTYPE( void memmap_dmp, (void) ); +_PROTOTYPE( void sendmask_dmp, (void) ); +_PROTOTYPE( void image_dmp, (void) ); +_PROTOTYPE( void irqtab_dmp, (void) ); +_PROTOTYPE( void kmessages_dmp, (void) ); +_PROTOTYPE( void sched_dmp, (void) ); +_PROTOTYPE( void monparams_dmp, (void) ); +_PROTOTYPE( void kenv_dmp, (void) ); +_PROTOTYPE( void memchunks_dmp, (void) ); +_PROTOTYPE( void timing_dmp, (void) ); + +/* dmp_pm.c */ +_PROTOTYPE( void mproc_dmp, (void) ); +/* dmp_fs.c */ +_PROTOTYPE( void dtab_dmp, (void) ); +_PROTOTYPE( void fproc_dmp, (void) ); diff --git a/servers/pm/Makefile b/servers/pm/Makefile index e19f3855e..4f7134a82 100644 --- a/servers/pm/Makefile +++ b/servers/pm/Makefile @@ -13,7 +13,7 @@ CC = exec cc CFLAGS = -I$i LDFLAGS = -i -OBJ = main.o forkexit.o break.o exec.o dmp.o time.o \ +OBJ = main.o forkexit.o break.o exec.o time.o \ signal.o alloc.o utility.o table.o trace.o getset.o misc.o # build local binary @@ -94,8 +94,6 @@ misc.o: $s/svrctl.h misc.o: mproc.h misc.o: param.h -dmp.o: $a - signal.o: $a signal.o: $s/stat.h signal.o: $h/callnr.h diff --git a/servers/pm/misc.c b/servers/pm/misc.c index bebaeb707..9e6492e0c 100644 --- a/servers/pm/misc.c +++ b/servers/pm/misc.c @@ -75,6 +75,10 @@ PUBLIC int do_getsysinfo() src_addr = (vir_bytes) &proc_addr; len = sizeof(struct mproc *); break; + case SI_PROC_TAB: /* copy entire process table */ + src_addr = (vir_bytes) mproc; + len = sizeof(struct mproc) * NR_PROCS; + break; default: return(EINVAL); } -- 2.44.0