1433d6423SLionel Sambuc /* Debugging dump procedures for the kernel. */
2433d6423SLionel Sambuc
3433d6423SLionel Sambuc #include "inc.h"
4594df55eSDavid van Moolenbroek #include <lib.h>
5433d6423SLionel Sambuc #include <minix/timers.h>
6433d6423SLionel Sambuc #include <assert.h>
7433d6423SLionel Sambuc #include <machine/interrupt.h>
8433d6423SLionel Sambuc #include <minix/endpoint.h>
9433d6423SLionel Sambuc #include <minix/sysutil.h>
10433d6423SLionel Sambuc #include <minix/sys_config.h>
11433d6423SLionel Sambuc #include "kernel/const.h"
12433d6423SLionel Sambuc #include "kernel/config.h"
13433d6423SLionel Sambuc #include "kernel/debug.h"
14433d6423SLionel Sambuc #include "kernel/type.h"
15433d6423SLionel Sambuc #include "kernel/proc.h"
16433d6423SLionel Sambuc #include "kernel/ipc.h"
17433d6423SLionel Sambuc
18433d6423SLionel Sambuc #define LINES 22
19433d6423SLionel Sambuc
20433d6423SLionel Sambuc #define PRINTRTS(rp) { \
21433d6423SLionel Sambuc char *procname = ""; \
22433d6423SLionel Sambuc printf(" %s", p_rts_flags_str(rp->p_rts_flags)); \
23433d6423SLionel Sambuc if (rp->p_rts_flags & RTS_SENDING) \
24433d6423SLionel Sambuc procname = proc_name(_ENDPOINT_P(rp->p_sendto_e)); \
25433d6423SLionel Sambuc else if (rp->p_rts_flags & RTS_RECEIVING) \
26433d6423SLionel Sambuc procname = proc_name(_ENDPOINT_P(rp->p_getfrom_e)); \
27433d6423SLionel Sambuc printf(" %-7.7s", procname); \
28433d6423SLionel Sambuc }
29433d6423SLionel Sambuc
30433d6423SLionel Sambuc static int pagelines;
31433d6423SLionel Sambuc
32433d6423SLionel Sambuc #define PROCLOOP(rp, oldrp) \
33433d6423SLionel Sambuc pagelines = 0; \
34433d6423SLionel Sambuc for (rp = oldrp; rp < END_PROC_ADDR; rp++) { \
35433d6423SLionel Sambuc oldrp = BEG_PROC_ADDR; \
36433d6423SLionel Sambuc if (isemptyp(rp)) continue; \
37433d6423SLionel Sambuc if (++pagelines >= LINES) { oldrp = rp; printf("--more--\n"); break; }\
38433d6423SLionel Sambuc if (proc_nr(rp) == IDLE) printf("(%2d) ", proc_nr(rp)); \
39433d6423SLionel Sambuc else if (proc_nr(rp) < 0) printf("[%2d] ", proc_nr(rp)); \
40433d6423SLionel Sambuc else printf(" %2d ", proc_nr(rp));
41433d6423SLionel Sambuc
42433d6423SLionel Sambuc #define click_to_round_k(n) \
43433d6423SLionel Sambuc ((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024))
44433d6423SLionel Sambuc
45433d6423SLionel Sambuc /* Declare some local dump procedures. */
46433d6423SLionel Sambuc static char *proc_name(int proc_nr);
47433d6423SLionel Sambuc static char *s_traps_str(int flags);
48433d6423SLionel Sambuc static char *s_flags_str(int flags);
49433d6423SLionel Sambuc static char *p_rts_flags_str(int flags);
50433d6423SLionel Sambuc
51433d6423SLionel Sambuc /* Some global data that is shared among several dumping procedures.
52433d6423SLionel Sambuc * Note that the process table copy has the same name as in the kernel
53433d6423SLionel Sambuc * so that most macros and definitions from proc.h also apply here.
54433d6423SLionel Sambuc */
55433d6423SLionel Sambuc struct proc proc[NR_TASKS + NR_PROCS];
56433d6423SLionel Sambuc struct priv priv[NR_SYS_PROCS];
57433d6423SLionel Sambuc struct boot_image image[NR_BOOT_PROCS];
58433d6423SLionel Sambuc
59433d6423SLionel Sambuc /*===========================================================================*
60433d6423SLionel Sambuc * kmessages_dmp *
61433d6423SLionel Sambuc *===========================================================================*/
62*4aa48abaSRichard Sailer void
kmessages_dmp(void)63*4aa48abaSRichard Sailer kmessages_dmp(void)
64433d6423SLionel Sambuc {
65433d6423SLionel Sambuc struct kmessages *kmess; /* get copy of kernel messages */
66433d6423SLionel Sambuc static char print_buf[_KMESS_BUF_SIZE+1]; /* this one is used to print */
67433d6423SLionel Sambuc int start; /* calculate start of messages */
68433d6423SLionel Sambuc int r;
69433d6423SLionel Sambuc int size;
70433d6423SLionel Sambuc
71594df55eSDavid van Moolenbroek kmess = get_minix_kerninfo()->kmessages;
72433d6423SLionel Sambuc
73433d6423SLionel Sambuc /* Try to print the kernel messages. First determine start and copy the
74433d6423SLionel Sambuc * buffer into a print-buffer. This is done because the messages in the
75433d6423SLionel Sambuc * copy may wrap (the kernel buffer is circular).
76433d6423SLionel Sambuc */
77433d6423SLionel Sambuc start = ((kmess->km_next + _KMESS_BUF_SIZE) - kmess->km_size) % _KMESS_BUF_SIZE;
78433d6423SLionel Sambuc r = 0;
79433d6423SLionel Sambuc size = kmess->km_size;
80433d6423SLionel Sambuc while (size > 0) {
81433d6423SLionel Sambuc print_buf[r] = kmess->km_buf[(start+r) % _KMESS_BUF_SIZE];
82433d6423SLionel Sambuc r ++;
83433d6423SLionel Sambuc size--;
84433d6423SLionel Sambuc }
85433d6423SLionel Sambuc print_buf[r] = 0; /* make sure it terminates */
86433d6423SLionel Sambuc printf("Dump of all messages generated by the kernel.\n\n");
87433d6423SLionel Sambuc printf("%s", print_buf); /* print the messages */
88433d6423SLionel Sambuc }
89433d6423SLionel Sambuc
90433d6423SLionel Sambuc /*===========================================================================*
91433d6423SLionel Sambuc * monparams_dmp *
92433d6423SLionel Sambuc *===========================================================================*/
93*4aa48abaSRichard Sailer void
monparams_dmp(void)94*4aa48abaSRichard Sailer monparams_dmp(void)
95433d6423SLionel Sambuc {
96433d6423SLionel Sambuc char val[MULTIBOOT_PARAM_BUF_SIZE];
97433d6423SLionel Sambuc char *e;
98433d6423SLionel Sambuc int r;
99433d6423SLionel Sambuc
100433d6423SLionel Sambuc /* Try to get a copy of the boot monitor parameters. */
101433d6423SLionel Sambuc if ((r = sys_getmonparams(val, sizeof(val))) != OK) {
102433d6423SLionel Sambuc printf("IS: warning: couldn't get copy of monitor params: %d\n", r);
103433d6423SLionel Sambuc return;
104433d6423SLionel Sambuc }
105433d6423SLionel Sambuc
106433d6423SLionel Sambuc /* Append new lines to the result. */
107433d6423SLionel Sambuc e = val;
108433d6423SLionel Sambuc do {
109433d6423SLionel Sambuc e += strlen(e);
110433d6423SLionel Sambuc *e++ = '\n';
111433d6423SLionel Sambuc } while (*e != 0);
112433d6423SLionel Sambuc
113433d6423SLionel Sambuc /* Finally, print the result. */
114433d6423SLionel Sambuc printf("Dump of kernel environment strings set by boot monitor.\n");
115433d6423SLionel Sambuc printf("\n%s\n", val);
116433d6423SLionel Sambuc }
117433d6423SLionel Sambuc
118433d6423SLionel Sambuc /*===========================================================================*
119433d6423SLionel Sambuc * irqtab_dmp *
120433d6423SLionel Sambuc *===========================================================================*/
121*4aa48abaSRichard Sailer void
irqtab_dmp(void)122*4aa48abaSRichard Sailer irqtab_dmp(void)
123433d6423SLionel Sambuc {
124433d6423SLionel Sambuc int i,r;
125433d6423SLionel Sambuc struct irq_hook irq_hooks[NR_IRQ_HOOKS];
126433d6423SLionel Sambuc int irq_actids[NR_IRQ_VECTORS];
127433d6423SLionel Sambuc struct irq_hook *e; /* irq tab entry */
128433d6423SLionel Sambuc
129433d6423SLionel Sambuc if ((r = sys_getirqhooks(irq_hooks)) != OK) {
130433d6423SLionel Sambuc printf("IS: warning: couldn't get copy of irq hooks: %d\n", r);
131433d6423SLionel Sambuc return;
132433d6423SLionel Sambuc }
133433d6423SLionel Sambuc if ((r = sys_getirqactids(irq_actids)) != OK) {
134433d6423SLionel Sambuc printf("IS: warning: couldn't get copy of irq mask: %d\n", r);
135433d6423SLionel Sambuc return;
136433d6423SLionel Sambuc }
137433d6423SLionel Sambuc
138433d6423SLionel Sambuc #if 0
139433d6423SLionel Sambuc printf("irq_actids:");
140433d6423SLionel Sambuc for (i= 0; i<NR_IRQ_VECTORS; i++)
141433d6423SLionel Sambuc printf(" [%d] = 0x%08x", i, irq_actids[i]);
142433d6423SLionel Sambuc printf("\n");
143433d6423SLionel Sambuc #endif
144433d6423SLionel Sambuc
145433d6423SLionel Sambuc printf("IRQ policies dump shows use of kernel's IRQ hooks.\n");
146433d6423SLionel Sambuc printf("-h.id- -proc.nr- -irq nr- -policy- -notify id- -masked-\n");
147433d6423SLionel Sambuc for (i=0; i<NR_IRQ_HOOKS; i++) {
148433d6423SLionel Sambuc e = &irq_hooks[i];
149433d6423SLionel Sambuc printf("%3d", i);
150433d6423SLionel Sambuc if (e->proc_nr_e==NONE) {
151433d6423SLionel Sambuc printf(" <unused>\n");
152433d6423SLionel Sambuc continue;
153433d6423SLionel Sambuc }
154433d6423SLionel Sambuc printf("%10d ", e->proc_nr_e);
155433d6423SLionel Sambuc printf(" (%02d) ", e->irq);
156433d6423SLionel Sambuc printf(" %s", (e->policy & IRQ_REENABLE) ? "reenable" : " - ");
157433d6423SLionel Sambuc printf(" %4lu", e->notify_id);
158433d6423SLionel Sambuc if (irq_actids[e->irq] & e->id)
159433d6423SLionel Sambuc printf(" masked");
160433d6423SLionel Sambuc printf("\n");
161433d6423SLionel Sambuc }
162433d6423SLionel Sambuc printf("\n");
163433d6423SLionel Sambuc }
164433d6423SLionel Sambuc
165433d6423SLionel Sambuc /*===========================================================================*
166433d6423SLionel Sambuc * image_dmp *
167433d6423SLionel Sambuc *===========================================================================*/
168*4aa48abaSRichard Sailer void
image_dmp(void)169*4aa48abaSRichard Sailer image_dmp(void)
170433d6423SLionel Sambuc {
171433d6423SLionel Sambuc int m, r;
172433d6423SLionel Sambuc struct boot_image *ip;
173433d6423SLionel Sambuc
174433d6423SLionel Sambuc if ((r = sys_getimage(image)) != OK) {
175433d6423SLionel Sambuc printf("IS: warning: couldn't get copy of image table: %d\n", r);
176433d6423SLionel Sambuc return;
177433d6423SLionel Sambuc }
178433d6423SLionel Sambuc printf("Image table dump showing all processes included in system image.\n");
179433d6423SLionel Sambuc printf("---name- -nr- flags -stack-\n");
180433d6423SLionel Sambuc for (m=0; m<NR_BOOT_PROCS; m++) {
181433d6423SLionel Sambuc ip = &image[m];
182433d6423SLionel Sambuc printf("%8s %4d\n", ip->proc_name, ip->proc_nr);
183433d6423SLionel Sambuc }
184433d6423SLionel Sambuc printf("\n");
185433d6423SLionel Sambuc }
186433d6423SLionel Sambuc
187433d6423SLionel Sambuc
188433d6423SLionel Sambuc /*===========================================================================*
189433d6423SLionel Sambuc * kenv_dmp *
190433d6423SLionel Sambuc *===========================================================================*/
191*4aa48abaSRichard Sailer void
kenv_dmp(void)192*4aa48abaSRichard Sailer kenv_dmp(void)
193433d6423SLionel Sambuc {
194433d6423SLionel Sambuc struct kinfo kinfo;
195433d6423SLionel Sambuc struct machine machine;
196433d6423SLionel Sambuc int r;
197433d6423SLionel Sambuc if ((r = sys_getkinfo(&kinfo)) != OK) {
198433d6423SLionel Sambuc printf("IS: warning: couldn't get copy of kernel info struct: %d\n", r);
199433d6423SLionel Sambuc return;
200433d6423SLionel Sambuc }
201433d6423SLionel Sambuc if ((r = sys_getmachine(&machine)) != OK) {
202433d6423SLionel Sambuc printf("IS: warning: couldn't get copy of kernel machine struct: %d\n", r);
203433d6423SLionel Sambuc return;
204433d6423SLionel Sambuc }
205433d6423SLionel Sambuc
206433d6423SLionel Sambuc printf("Dump of kinfo structure.\n\n");
207433d6423SLionel Sambuc printf("Kernel info structure:\n");
208433d6423SLionel Sambuc printf("- nr_procs: %3u\n", kinfo.nr_procs);
209433d6423SLionel Sambuc printf("- nr_tasks: %3u\n", kinfo.nr_tasks);
210433d6423SLionel Sambuc printf("- release: %.6s\n", kinfo.release);
211433d6423SLionel Sambuc printf("- version: %.6s\n", kinfo.version);
212433d6423SLionel Sambuc printf("\n");
213433d6423SLionel Sambuc }
214433d6423SLionel Sambuc
215433d6423SLionel Sambuc /*===========================================================================*
216433d6423SLionel Sambuc * s_flags_str *
217433d6423SLionel Sambuc *===========================================================================*/
s_flags_str(int flags)218433d6423SLionel Sambuc static char *s_flags_str(int flags)
219433d6423SLionel Sambuc {
220433d6423SLionel Sambuc static char str[10];
221433d6423SLionel Sambuc str[0] = (flags & PREEMPTIBLE) ? 'P' : '-';
222433d6423SLionel Sambuc str[1] = (flags & BILLABLE) ? 'B' : '-';
223433d6423SLionel Sambuc str[2] = (flags & DYN_PRIV_ID) ? 'D' : '-';
224433d6423SLionel Sambuc str[3] = (flags & SYS_PROC) ? 'S' : '-';
225433d6423SLionel Sambuc str[4] = (flags & CHECK_IO_PORT) ? 'I' : '-';
226433d6423SLionel Sambuc str[5] = (flags & CHECK_IRQ) ? 'Q' : '-';
227433d6423SLionel Sambuc str[6] = (flags & CHECK_MEM) ? 'M' : '-';
228433d6423SLionel Sambuc str[7] = '\0';
229433d6423SLionel Sambuc
230433d6423SLionel Sambuc return str;
231433d6423SLionel Sambuc }
232433d6423SLionel Sambuc
233433d6423SLionel Sambuc /*===========================================================================*
234433d6423SLionel Sambuc * s_traps_str *
235433d6423SLionel Sambuc *===========================================================================*/
s_traps_str(int flags)236433d6423SLionel Sambuc static char *s_traps_str(int flags)
237433d6423SLionel Sambuc {
238433d6423SLionel Sambuc static char str[10];
239433d6423SLionel Sambuc str[0] = (flags & (1 << SEND)) ? 'S' : '-';
240433d6423SLionel Sambuc str[1] = (flags & (1 << SENDA)) ? 'A' : '-';
241433d6423SLionel Sambuc str[2] = (flags & (1 << RECEIVE)) ? 'R' : '-';
242433d6423SLionel Sambuc str[3] = (flags & (1 << SENDREC)) ? 'B' : '-';
243433d6423SLionel Sambuc str[4] = (flags & (1 << NOTIFY)) ? 'N' : '-';
244433d6423SLionel Sambuc str[5] = '\0';
245433d6423SLionel Sambuc
246433d6423SLionel Sambuc return str;
247433d6423SLionel Sambuc }
248433d6423SLionel Sambuc
249433d6423SLionel Sambuc /*===========================================================================*
250433d6423SLionel Sambuc * privileges_dmp *
251433d6423SLionel Sambuc *===========================================================================*/
252*4aa48abaSRichard Sailer void
privileges_dmp(void)253*4aa48abaSRichard Sailer privileges_dmp(void)
254433d6423SLionel Sambuc {
255433d6423SLionel Sambuc register struct proc *rp;
256433d6423SLionel Sambuc static struct proc *oldrp = BEG_PROC_ADDR;
257433d6423SLionel Sambuc register struct priv *sp;
258433d6423SLionel Sambuc int r, i;
259433d6423SLionel Sambuc
260433d6423SLionel Sambuc /* First obtain a fresh copy of the current process and system table. */
261433d6423SLionel Sambuc if ((r = sys_getprivtab(priv)) != OK) {
262433d6423SLionel Sambuc printf("IS: warning: couldn't get copy of system privileges table: %d\n", r);
263433d6423SLionel Sambuc return;
264433d6423SLionel Sambuc }
265433d6423SLionel Sambuc if ((r = sys_getproctab(proc)) != OK) {
266433d6423SLionel Sambuc printf("IS: warning: couldn't get copy of process table: %d\n", r);
267433d6423SLionel Sambuc return;
268433d6423SLionel Sambuc }
269433d6423SLionel Sambuc
270433d6423SLionel Sambuc printf("-nr- -id- -name-- -flags- traps grants -ipc_to--"
271433d6423SLionel Sambuc " -kernel calls-\n");
272433d6423SLionel Sambuc
273433d6423SLionel Sambuc PROCLOOP(rp, oldrp)
274433d6423SLionel Sambuc r = -1;
275433d6423SLionel Sambuc for (sp = &priv[0]; sp < &priv[NR_SYS_PROCS]; sp++)
276433d6423SLionel Sambuc if (sp->s_proc_nr == rp->p_nr) { r ++; break; }
277433d6423SLionel Sambuc if (r == -1 && !isemptyp(rp)) {
278433d6423SLionel Sambuc sp = &priv[USER_PRIV_ID];
279433d6423SLionel Sambuc }
280433d6423SLionel Sambuc printf("(%02u) %-7.7s %s %s %6d",
281433d6423SLionel Sambuc sp->s_id, rp->p_name,
282433d6423SLionel Sambuc s_flags_str(sp->s_flags), s_traps_str(sp->s_trap_mask),
283433d6423SLionel Sambuc sp->s_grant_entries);
284433d6423SLionel Sambuc for (i=0; i < NR_SYS_PROCS; i += BITCHUNK_BITS) {
285433d6423SLionel Sambuc printf(" %08x", get_sys_bits(sp->s_ipc_to, i));
286433d6423SLionel Sambuc }
287433d6423SLionel Sambuc
288433d6423SLionel Sambuc printf(" ");
289433d6423SLionel Sambuc for (i=0; i < NR_SYS_CALLS; i += BITCHUNK_BITS) {
290433d6423SLionel Sambuc printf(" %08x", sp->s_k_call_mask[i/BITCHUNK_BITS]);
291433d6423SLionel Sambuc }
292433d6423SLionel Sambuc printf("\n");
293433d6423SLionel Sambuc
294433d6423SLionel Sambuc }
295433d6423SLionel Sambuc }
296433d6423SLionel Sambuc
297433d6423SLionel Sambuc /*===========================================================================*
298433d6423SLionel Sambuc * p_rts_flags_str *
299433d6423SLionel Sambuc *===========================================================================*/
300433d6423SLionel Sambuc static char *p_rts_flags_str(int flags)
301433d6423SLionel Sambuc {
302433d6423SLionel Sambuc static char str[10];
303433d6423SLionel Sambuc str[0] = (flags & RTS_PROC_STOP) ? 's' : '-';
304433d6423SLionel Sambuc str[1] = (flags & RTS_SENDING) ? 'S' : '-';
305433d6423SLionel Sambuc str[2] = (flags & RTS_RECEIVING) ? 'R' : '-';
306433d6423SLionel Sambuc str[3] = (flags & RTS_SIGNALED) ? 'I' : '-';
307433d6423SLionel Sambuc str[4] = (flags & RTS_SIG_PENDING) ? 'P' : '-';
308433d6423SLionel Sambuc str[5] = (flags & RTS_P_STOP) ? 'T' : '-';
309433d6423SLionel Sambuc str[6] = (flags & RTS_NO_PRIV) ? 'p' : '-';
310433d6423SLionel Sambuc str[7] = '\0';
311433d6423SLionel Sambuc
312433d6423SLionel Sambuc return str;
313433d6423SLionel Sambuc }
314433d6423SLionel Sambuc
315433d6423SLionel Sambuc /*===========================================================================*
316433d6423SLionel Sambuc * proctab_dmp *
317433d6423SLionel Sambuc *===========================================================================*/
318433d6423SLionel Sambuc #if defined(__i386__)
319433d6423SLionel Sambuc void proctab_dmp(void)
320433d6423SLionel Sambuc {
321433d6423SLionel Sambuc /* Proc table dump */
322433d6423SLionel Sambuc
323433d6423SLionel Sambuc register struct proc *rp;
324433d6423SLionel Sambuc static struct proc *oldrp = BEG_PROC_ADDR;
325433d6423SLionel Sambuc int r;
326433d6423SLionel Sambuc
327433d6423SLionel Sambuc /* First obtain a fresh copy of the current process table. */
328433d6423SLionel Sambuc if ((r = sys_getproctab(proc)) != OK) {
329433d6423SLionel Sambuc printf("IS: warning: couldn't get copy of process table: %d\n", r);
330433d6423SLionel Sambuc return;
331433d6423SLionel Sambuc }
332433d6423SLionel Sambuc
333433d6423SLionel Sambuc printf("\n-nr-----gen---endpoint-name--- -prior-quant- -user----sys-rtsflags-from/to-\n");
334433d6423SLionel Sambuc
335433d6423SLionel Sambuc PROCLOOP(rp, oldrp)
336433d6423SLionel Sambuc printf(" %5d %10d ", _ENDPOINT_G(rp->p_endpoint), rp->p_endpoint);
3370a6a1f1dSLionel Sambuc printf("%-8.8s %5u %5u %6u %6u ",
338433d6423SLionel Sambuc rp->p_name,
339433d6423SLionel Sambuc rp->p_priority,
340433d6423SLionel Sambuc rp->p_quantum_size_ms,
341433d6423SLionel Sambuc rp->p_user_time, rp->p_sys_time);
342433d6423SLionel Sambuc PRINTRTS(rp);
343433d6423SLionel Sambuc printf("\n");
344433d6423SLionel Sambuc }
345433d6423SLionel Sambuc }
346433d6423SLionel Sambuc #endif /* defined(__i386__) */
347433d6423SLionel Sambuc
348433d6423SLionel Sambuc #if defined(__arm__)
349433d6423SLionel Sambuc void proctab_dmp(void)
350433d6423SLionel Sambuc {
351433d6423SLionel Sambuc /* LSC FIXME: Not implemented for arm */
352433d6423SLionel Sambuc }
353433d6423SLionel Sambuc #endif /* defined(__arm__) */
354433d6423SLionel Sambuc
355433d6423SLionel Sambuc /*===========================================================================*
356433d6423SLionel Sambuc * procstack_dmp *
357433d6423SLionel Sambuc *===========================================================================*/
358*4aa48abaSRichard Sailer void
359*4aa48abaSRichard Sailer procstack_dmp(void)
360433d6423SLionel Sambuc {
361433d6423SLionel Sambuc /* Proc table dump, with stack */
362433d6423SLionel Sambuc
363433d6423SLionel Sambuc register struct proc *rp;
364433d6423SLionel Sambuc static struct proc *oldrp = BEG_PROC_ADDR;
365433d6423SLionel Sambuc int r;
366433d6423SLionel Sambuc
367433d6423SLionel Sambuc /* First obtain a fresh copy of the current process table. */
368433d6423SLionel Sambuc if ((r = sys_getproctab(proc)) != OK) {
369433d6423SLionel Sambuc printf("IS: warning: couldn't get copy of process table: %d\n", r);
370433d6423SLionel Sambuc return;
371433d6423SLionel Sambuc }
372433d6423SLionel Sambuc
373433d6423SLionel Sambuc printf("\n-nr-rts flags-- --stack--\n");
374433d6423SLionel Sambuc
375433d6423SLionel Sambuc PROCLOOP(rp, oldrp)
376433d6423SLionel Sambuc PRINTRTS(rp);
377433d6423SLionel Sambuc printf("\n"); pagelines++;
378433d6423SLionel Sambuc sys_diagctl_stacktrace(rp->p_endpoint);
379433d6423SLionel Sambuc }
380433d6423SLionel Sambuc }
381433d6423SLionel Sambuc
382433d6423SLionel Sambuc /*===========================================================================*
383433d6423SLionel Sambuc * proc_name *
384433d6423SLionel Sambuc *===========================================================================*/
385*4aa48abaSRichard Sailer static char *
386*4aa48abaSRichard Sailer proc_name(int proc_nr)
387433d6423SLionel Sambuc {
388433d6423SLionel Sambuc struct proc *p;
389433d6423SLionel Sambuc if (proc_nr == ANY) return "ANY";
390433d6423SLionel Sambuc if (proc_nr == NONE) return "NONE"; /* bogus */
391433d6423SLionel Sambuc if (proc_nr < -NR_TASKS || proc_nr >= NR_PROCS) return "BOGUS";
392433d6423SLionel Sambuc p = proc_addr(proc_nr);
393433d6423SLionel Sambuc if (isemptyp(p)) return "EMPTY"; /* bogus */
394433d6423SLionel Sambuc return p->p_name;
395433d6423SLionel Sambuc }
396433d6423SLionel Sambuc
397