dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / mdb / common / kmdb / kmdb_promif.c
blob61e86df9af83c0a5058bba38195bf638bb1b923b
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #include <sys/types.h>
28 #include <sys/termios.h>
29 #include <sys/promif.h>
30 #ifdef sun4v
31 #include <sys/promif_impl.h>
32 #endif
33 #include <unistd.h>
34 #include <string.h>
35 #include <stdlib.h>
37 #include <kmdb/kmdb_promif_impl.h>
38 #include <kmdb/kmdb_kdi.h>
39 #include <kmdb/kmdb_dpi.h>
40 #include <mdb/mdb_debug.h>
41 #include <mdb/mdb_err.h>
42 #include <mdb/mdb_frame.h>
43 #include <mdb/mdb_string.h>
44 #include <mdb/mdb.h>
46 #define KMDB_PROM_DEF_CONS_MODE "9600,n,1,-,-"
48 #define KMDB_PROM_READBUF_SIZE 1024
50 static char kmdb_prom_readbuf[KMDB_PROM_READBUF_SIZE];
51 static int kmdb_prom_readbuf_head;
52 static int kmdb_prom_readbuf_tail;
54 static int
55 kmdb_prom_getchar(int wait)
57 struct cons_polledio *pio = mdb.m_pio;
58 uintptr_t ischar;
59 uintptr_t getchar;
60 uintptr_t arg;
62 if (pio == NULL || pio->cons_polledio_getchar == NULL) {
63 int c;
64 while ((c = prom_mayget()) == -1) {
65 if (!wait)
66 return (-1);
68 return (c);
71 ischar = (uintptr_t)pio->cons_polledio_ischar;
72 getchar = (uintptr_t)pio->cons_polledio_getchar;
73 arg = (uintptr_t)pio->cons_polledio_argument;
75 if (!wait && ischar != 0 && !kmdb_dpi_call(ischar, 1, &arg))
76 return (-1);
78 return ((int)kmdb_dpi_call(getchar, 1, &arg));
81 static ssize_t
82 kmdb_prom_polled_write(caddr_t buf, size_t len)
84 uintptr_t args[2];
85 int i;
87 args[0] = (uintptr_t)mdb.m_pio->cons_polledio_argument;
89 for (i = 0; i < len; i++) {
90 args[1] = *buf++;
91 (void) kmdb_dpi_call(
92 (uintptr_t)mdb.m_pio->cons_polledio_putchar, 2, args);
95 return (len);
98 static ssize_t
99 kmdb_prom_reader(caddr_t buf, size_t len, int wait)
101 int nread = 0;
102 int c;
104 while (nread < len) {
105 if ((c = kmdb_prom_getchar(wait)) == -1)
106 break;
108 *buf++ = (char)c;
109 nread++;
110 wait = 0;
113 return (nread);
116 static ssize_t
117 kmdb_prom_writer(caddr_t buf, size_t len)
119 if (mdb.m_pio != NULL && mdb.m_pio->cons_polledio_putchar != NULL)
120 return (kmdb_prom_polled_write(buf, len));
122 return (kmdb_prom_obp_writer(buf, len));
126 * Due to the nature of kmdb, we don't have signals. This prevents us from
127 * receiving asynchronous notification when the user would like to abort active
128 * dcmds. Whereas mdb can simply declare a SIGINT handler, we must
129 * occasionally poll the input stream, looking for pending ^C characters. To
130 * give the illusion of asynchronous interrupt delivery, this polling is
131 * triggered from several commonly-used functions, such as kmdb_prom_write and
132 * the *read and *write target ops. When an interrupt check is triggered, we
133 * read through pending input, looking for interrupt characters. If we find
134 * one, we deliver an interrupt immediately.
136 * In a read context, we can deliver the interrupt character directly back to
137 * the termio handler rather than raising an interrupt.
139 * OBP doesn't have an "unget" facility. Any character read for interrupt
140 * checking is gone forever, unless we save it. Loss of these characters
141 * would prevent us from supporting typeahead. We like typeahead, so we're
142 * going to save characters gathered during interrupt checking. As with
143 * ungetc(3c), however, we can only store a finite number of characters in
144 * our typeahead buffer. Characters read beyond that will be silently dropped
145 * after they undergo interrupt processing.
147 * The typeahead facility is implemented as a ring buffer, stored in
148 * kmdb_prom_readbuf.
150 static size_t
151 kmdb_prom_drain_readbuf(void *buf, size_t len)
153 size_t n, tailread;
156 * If head > tail, life is easy - we can simply read as much as we need
157 * in one gulp.
159 if (kmdb_prom_readbuf_head > kmdb_prom_readbuf_tail) {
160 n = MIN(kmdb_prom_readbuf_head - kmdb_prom_readbuf_tail, len);
161 bcopy(kmdb_prom_readbuf + kmdb_prom_readbuf_tail, buf, n);
162 kmdb_prom_readbuf_tail += n;
163 return (n);
165 } else if (kmdb_prom_readbuf_head == kmdb_prom_readbuf_tail) {
166 return (0);
170 * The consumable slots wrap around zero (there are slots from tail to
171 * zero, and from zero to head). We have to read them in two parts.
173 n = MIN(KMDB_PROM_READBUF_SIZE - kmdb_prom_readbuf_tail, len);
174 bcopy(kmdb_prom_readbuf + kmdb_prom_readbuf_tail, buf, n);
175 kmdb_prom_readbuf_tail = (kmdb_prom_readbuf_tail + n) %
176 KMDB_PROM_READBUF_SIZE;
178 if (n == len) {
180 * We filled the passed buffer from the first part, so there's
181 * no need to read the second.
183 return (n);
184 } else {
185 tailread = n;
188 n = MIN(kmdb_prom_readbuf_head, len - tailread);
189 buf = (void *)((uintptr_t)buf + tailread);
190 bcopy(kmdb_prom_readbuf, buf, n);
192 kmdb_prom_readbuf_tail = (kmdb_prom_readbuf_tail + n) %
193 KMDB_PROM_READBUF_SIZE;
195 return (tailread + n);
198 static void
199 check_int(char *buf, size_t len)
201 int i;
203 for (i = 0; i < len; i++) {
204 if (buf[i] == CTRL('c')) {
205 kmdb_prom_readbuf_tail = kmdb_prom_readbuf_head;
206 if (mdb.m_intr == 0)
207 longjmp(mdb.m_frame->f_pcb, MDB_ERR_SIGINT);
208 else
209 mdb.m_pend++;
215 * Attempt to refill the ring buffer from the input stream. This called from
216 * two contexts:
218 * Direct read: read the input into our buffer until input is exhausted, or the
219 * buffer is full.
221 * Interrupt check: called 'asynchronously' from the normal read routines; read
222 * the input into our buffer until it is exhausted, discarding input if the
223 * buffer is full. In this case we look ahead for any interrupt characters,
224 * delivering an interrupt directly if we find one.
226 static void
227 kmdb_prom_fill_readbuf(int check_for_int, int wait)
229 int oldhead, left, n;
232 * Calculate the number of slots left before we wrap around to the
233 * beginning again.
235 left = KMDB_PROM_READBUF_SIZE - kmdb_prom_readbuf_head;
236 if (kmdb_prom_readbuf_tail == 0)
237 left--;
239 if (kmdb_prom_readbuf_head == kmdb_prom_readbuf_tail ||
240 (kmdb_prom_readbuf_head > kmdb_prom_readbuf_tail && left > 0)) {
242 * head > tail, so we have to read in two parts - the slots
243 * from head until we wrap back around to zero, and the ones
244 * from zero to tail. We handle the first part here, and let
245 * the common code handle the second.
247 if ((n = kmdb_prom_reader(kmdb_prom_readbuf +
248 kmdb_prom_readbuf_head, left, wait)) <= 0)
249 return;
251 oldhead = kmdb_prom_readbuf_head;
252 kmdb_prom_readbuf_head = (kmdb_prom_readbuf_head + n) %
253 KMDB_PROM_READBUF_SIZE;
255 if (check_for_int)
256 check_int(kmdb_prom_readbuf + oldhead, n);
258 if (n != left)
259 return;
262 left = kmdb_prom_readbuf_tail - kmdb_prom_readbuf_head - 1;
263 if (left > 0) {
264 if ((n = kmdb_prom_reader(kmdb_prom_readbuf +
265 kmdb_prom_readbuf_head, left, wait)) <= 0)
266 return;
268 oldhead = kmdb_prom_readbuf_head;
269 kmdb_prom_readbuf_head = (kmdb_prom_readbuf_head + n) %
270 KMDB_PROM_READBUF_SIZE;
272 if (check_for_int)
273 check_int(kmdb_prom_readbuf + oldhead, n);
275 if (n != left)
276 return;
279 if (check_for_int) {
280 char c;
282 while (kmdb_prom_reader(&c, 1, 0) == 1)
283 check_int(&c, 1);
287 void
288 kmdb_prom_check_interrupt(void)
290 kmdb_prom_fill_readbuf(1, 0);
294 * OBP reads are always non-blocking. If there are characters available,
295 * we'll return as many as we can. If nothing is available, we'll spin
296 * until one shows up.
298 ssize_t
299 kmdb_prom_read(void *buf, size_t len, struct termios *tio)
301 size_t totread = 0;
302 size_t thisread;
303 char *c = (char *)buf;
304 int wait = 1;
306 for (;;) {
307 kmdb_prom_fill_readbuf(0, wait);
308 thisread = kmdb_prom_drain_readbuf(c, len);
309 len -= thisread;
310 totread += thisread;
311 c += thisread;
313 /* wait until something shows up */
314 if (totread == 0)
315 continue;
317 wait = 0;
320 * We're done if we've exhausted available input or if we've
321 * filled the provided buffer.
323 if (len == 0 || thisread == 0)
324 break;
327 if (tio->c_iflag & ICRNL) {
328 char *cbuf = buf;
329 int i;
331 for (i = 0; i < totread; i++) {
332 if (cbuf[i] == '\r')
333 cbuf[i] = '\n';
337 if (tio->c_lflag & ECHO)
338 (void) kmdb_prom_write(buf, totread, tio);
340 return (totread);
343 /*ARGSUSED*/
344 ssize_t
345 kmdb_prom_write(const void *bufp, size_t len, struct termios *tio)
347 caddr_t buf = (caddr_t)bufp;
348 size_t left = len;
349 char *nl = "\r\n";
350 char *c;
352 kmdb_prom_check_interrupt();
354 if (!(tio->c_oflag & ONLCR))
355 return (kmdb_prom_writer(buf, left));
357 /* translate every \n into \r\n */
358 while ((c = strnchr(buf, '\n', left)) != NULL) {
359 if (c != buf) {
360 size_t sz = (size_t)(c - buf);
361 (void) kmdb_prom_writer(buf, sz);
362 left -= sz;
365 buf = c + 1;
366 left--;
368 (void) kmdb_prom_writer(nl, 2);
371 if (*buf != '\0')
372 (void) kmdb_prom_writer(buf, left);
374 return (len);
377 static char *
378 kmdb_get_ttyio_mode(kmdb_auxv_t *kav, char *devname)
380 char *modepname, *modepval;
382 modepname = mdb_alloc(strlen(devname) + 5 + 1, UM_SLEEP);
383 (void) strcpy(modepname, devname);
384 (void) strcat(modepname, "-mode");
386 modepval = kmdb_prom_get_ddi_prop(kav, modepname);
388 strfree(modepname);
390 return (modepval);
393 static int
394 termios_setispeed(struct termios *tip, speed_t s)
396 if (s > (2 * CBAUD + 1))
397 return (-1);
399 if ((s << IBSHIFT) > CIBAUD) {
400 tip->c_cflag |= CIBAUDEXT;
401 s -= ((CIBAUD >> IBSHIFT) + 1);
402 } else
403 tip->c_cflag &= ~CIBAUDEXT;
405 tip->c_cflag = (tip->c_cflag & ~CIBAUD) | ((s << IBSHIFT) & CIBAUD);
407 return (0);
410 static int
411 termios_setospeed(struct termios *tip, speed_t s)
413 if (s > (2 * CBAUD + 1))
414 return (-1);
416 if (s > CBAUD) {
417 tip->c_cflag |= CBAUDEXT;
418 s -= (CBAUD + 1);
419 } else
420 tip->c_cflag &= ~CBAUDEXT;
422 tip->c_cflag = (tip->c_cflag & ~CBAUD) | (s & CBAUD);
424 return (0);
427 static int
428 kmdb_parse_mode(const char *mode, struct termios *tip, int in)
430 static const uint_t baudmap[] = {
431 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200,
432 1800, 2400, 4800, 9600, 19200, 38400, 57600,
433 76800, 115200, 153600, 230400, 307200, 460800, 921600
435 static const uint_t bitsmap[] = { CS6, CS6, CS7, CS8 };
436 char *m = strdup(mode);
437 char *w;
438 int rc = -1;
439 speed_t speed;
440 int baud, i;
443 * termios supports different baud rates and flow control types for
444 * input and output, but it requires character width, parity, and stop
445 * bits to be equal in input and output. obp allows them to be
446 * different, but we're going to (silently) assume that nobody will use
447 * it that way.
450 /* baud rate - see baudmap above */
451 if ((w = strtok(m, ",")) == NULL)
452 goto parse_mode_bail;
454 baud = strtol(w, NULL, 10);
455 speed = 0;
456 for (i = 0; i < sizeof (baudmap) / sizeof (baudmap[0]); i++) {
457 if (baudmap[i] == baud) {
458 speed = i;
459 break;
462 if (speed == 0)
463 goto parse_mode_bail;
465 if (in == 1)
466 (void) termios_setispeed(tip, speed);
467 else
468 (void) termios_setospeed(tip, speed);
470 /* character width (bits) - 5, 6, 7, or 8 */
471 if ((w = strtok(NULL, ",")) == NULL || strlen(w) != 1 || *w < '5' ||
472 *w > '8')
473 goto parse_mode_bail;
474 tip->c_cflag = (tip->c_cflag & ~CSIZE) | bitsmap[*w - '5'];
476 /* parity - `n' (none), `e' (even), or `o' (odd) */
477 if ((w = strtok(NULL, ",")) == NULL || strlen(w) != 1 ||
478 strchr("neo", *w) == NULL)
479 goto parse_mode_bail;
481 tip->c_cflag = (tip->c_cflag & ~(PARENB|PARODD));
482 switch (*w) {
483 case 'n':
484 /* nothing */
485 break;
486 case 'e':
487 tip->c_cflag |= PARENB;
488 break;
489 case 'o':
490 tip->c_cflag |= PARENB|PARODD;
491 break;
495 * stop bits - 1, or 2. obp can, in theory, support 1.5 bits,
496 * but we can't. how many angels can dance on half of a bit?
498 if ((w = strtok(NULL, ",")) == NULL || strlen(w) != 1 || *w < '1' ||
499 *w > '2')
500 goto parse_mode_bail;
502 if (*w == '1')
503 tip->c_cflag &= ~CSTOPB;
504 else
505 tip->c_cflag |= CSTOPB;
507 /* flow control - `-' (none), `h' (h/w), or `s' (s/w - XON/XOFF) */
508 if ((w = strtok(NULL, ",")) == NULL || strlen(w) != 1 ||
509 strchr("-hs", *w) == NULL)
510 goto parse_mode_bail;
512 tip->c_cflag &= ~(CRTSXOFF|CRTSCTS);
513 tip->c_iflag &= ~(IXON|IXANY|IXOFF);
515 switch (*w) {
516 case 'h':
517 tip->c_cflag |= (in == 1 ? CRTSXOFF : CRTSCTS);
518 break;
520 case 's':
521 tip->c_iflag |= (in == 1 ? IXOFF : IXON);
522 break;
525 rc = 0;
527 parse_mode_bail:
528 strfree(m);
530 return (rc);
533 #define ATTACHED_TERM_TYPE "sun-color"
535 static void
536 kmdb_prom_term_init(kmdb_auxv_t *kav, kmdb_promif_t *pif)
538 const char ccs[NCCS] = { 0x03, 0x1c, 0x08, 0x15, 0x04, 0x00, 0x00,
539 0x00, 0x11, 0x13, 0x1a, 0x19, 0x12, 0x0f, 0x17, 0x16 };
540 char *conin = NULL, *conout = NULL;
542 if (kmdb_prom_stdout_is_framebuffer(kav))
543 pif->pif_oterm = ATTACHED_TERM_TYPE;
545 bzero(&pif->pif_tios, sizeof (struct termios));
547 /* output device characteristics */
548 if ((conout = kmdb_prom_get_ddi_prop(kav, "output-device")) ==
549 NULL || strcmp(conout, "screen") == 0) {
550 (void) kmdb_parse_mode(KMDB_PROM_DEF_CONS_MODE,
551 &pif->pif_tios, 0);
552 } else if (*conout == '/') {
554 * We're not going to be able to get characteristics for a
555 * device that's specified as a path, so don't even try.
556 * Conveniently, this allows us to avoid chattering on
557 * Serengetis.
559 (void) kmdb_parse_mode(KMDB_PROM_DEF_CONS_MODE,
560 &pif->pif_tios, 0);
561 } else {
562 char *mode = kmdb_get_ttyio_mode(kav, conout);
565 if (mode == NULL || kmdb_parse_mode(mode,
566 &pif->pif_tios, 0) < 0) {
568 * Either we couldn't retrieve the
569 * characteristics for this console, or they
570 * weren't parseable. The console hasn't been
571 * set up yet, so we can't warn. We'll have to
572 * silently fall back to the default
573 * characteristics.
575 (void) kmdb_parse_mode(KMDB_PROM_DEF_CONS_MODE,
576 &pif->pif_tios, 0);
580 if (mode != NULL)
581 kmdb_prom_free_ddi_prop(mode);
584 /* input device characteristics */
585 if ((conin = kmdb_prom_get_ddi_prop(kav, "input-device")) == NULL ||
586 strcmp(conin, "keyboard") == 0) {
587 (void) kmdb_parse_mode(KMDB_PROM_DEF_CONS_MODE,
588 &pif->pif_tios, 1);
589 } else if (*conin == '/') {
590 /* See similar case in output-device above */
591 (void) kmdb_parse_mode(KMDB_PROM_DEF_CONS_MODE,
592 &pif->pif_tios, 1);
593 } else {
594 char *mode = kmdb_get_ttyio_mode(kav, conin);
597 if (mode == NULL || kmdb_parse_mode(mode,
598 &pif->pif_tios, 1) < 0) {
600 * Either we couldn't retrieve the
601 * characteristics for this console, or they
602 * weren't parseable. The console hasn't been
603 * set up yet, so we can't warn. We'll have to
604 * silently fall back to the default
605 * characteristics.
607 (void) kmdb_parse_mode(KMDB_PROM_DEF_CONS_MODE,
608 &pif->pif_tios, 1);
612 if (mode != NULL)
613 kmdb_prom_free_ddi_prop(mode);
616 /* various characteristics of the prom read/write interface */
617 pif->pif_tios.c_iflag |= ICRNL;
618 pif->pif_tios.c_lflag |= ECHO;
619 bcopy(ccs, &pif->pif_tios.c_cc, sizeof (ccs));
621 if (conin != NULL)
622 kmdb_prom_free_ddi_prop(conin);
623 if (conout != NULL)
624 kmdb_prom_free_ddi_prop(conout);
627 char *
628 kmdb_prom_term_type(void)
630 return (mdb.m_promif->pif_oterm);
634 kmdb_prom_term_ctl(int req, void *arg)
636 switch (req) {
637 case TCGETS: {
638 struct termios *ti = arg;
639 bcopy(&mdb.m_promif->pif_tios, ti, sizeof (struct termios));
640 return (0);
642 case TIOCGWINSZ:
644 * When kmdb is used over a serial console, we have no idea how
645 * large the terminal window is. When we're invoked on a local
646 * console, however, we do, and need to share that information
647 * with the debugger in order to contradict potentially
648 * incorrect sizing information retrieved from the terminfo
649 * database. One specific case where this happens is with the
650 * Intel console, which is 80x25. The terminfo entry for
651 * sun-color -- the default terminal type for local Intel
652 * consoles -- was cloned from sun, which has a height of 34
653 * rows.
655 if (mdb.m_promif->pif_oterm != NULL) {
656 struct winsize *wsz = arg;
657 wsz->ws_row = KMDB_PIF_WINSIZE_ROWS;
658 wsz->ws_col = KMDB_PIF_WINSIZE_COLS;
659 wsz->ws_xpixel = wsz->ws_ypixel = 0;
660 return (0);
663 return (set_errno(ENOTSUP));
664 default:
665 return (set_errno(EINVAL));
670 kmdb_prom_vtop(uintptr_t virt, physaddr_t *pap)
672 physaddr_t pa;
673 int rc = kmdb_kdi_vtop(virt, &pa);
676 if (rc == 0 && pap != NULL)
677 *pap = pa;
679 return (rc);
682 void
683 kmdb_prom_debugger_entry(void)
686 * While kmdb_prom_debugger_entry and kmdb_prom_debugger_exit are not
687 * guaranteed to be called an identical number of times (an intentional
688 * debugger fault will cause an additional entry call without a matching
689 * exit call), we must ensure that the polled I/O entry and exit calls
690 * match.
692 if (mdb.m_pio == NULL) {
693 mdb.m_pio = kmdb_kdi_get_polled_io();
695 if (mdb.m_pio != NULL &&
696 mdb.m_pio->cons_polledio_enter != NULL) {
697 (void) kmdb_dpi_call(
698 (uintptr_t)mdb.m_pio->cons_polledio_enter, 1,
699 (uintptr_t *)&mdb.m_pio->cons_polledio_argument);
704 void
705 kmdb_prom_debugger_exit(void)
707 if (mdb.m_pio != NULL && mdb.m_pio->cons_polledio_exit != NULL) {
708 (void) kmdb_dpi_call((uintptr_t)mdb.m_pio->cons_polledio_exit,
709 1, (uintptr_t *)&mdb.m_pio->cons_polledio_argument);
712 mdb.m_pio = NULL;
716 * The prom_* files use ASSERT, which is #defined as assfail(). We need to
717 * redirect that to our assert function. This is also used by the various STAND
718 * libraries.
721 kmdb_prom_assfail(const char *assertion, const char *file, int line)
723 (void) mdb_dassert(assertion, file, line);
724 /*NOTREACHED*/
725 return (0);
729 * Begin the initialization of the debugger/PROM interface. Initialization is
730 * performed in two steps due to interlocking dependencies between promif and
731 * both the memory allocator and mdb_create. The first phase is performed
732 * before either of the others have been initialized, and thus must neither
733 * attempt to allocate memory nor access/write to `mdb'.
735 void
736 kmdb_prom_init_begin(char *pgmname, kmdb_auxv_t *kav)
738 #ifdef sun4v
739 if (kav->kav_domaining)
740 kmdb_prom_init_promif(pgmname, kav);
741 else
742 prom_init(pgmname, kav->kav_romp);
743 #else
744 prom_init(pgmname, kav->kav_romp);
745 #endif
747 /* Initialize the interrupt ring buffer */
748 kmdb_prom_readbuf_head = kmdb_prom_readbuf_tail;
750 #if defined(__i386) || defined(__amd64)
751 kmdb_sysp = kav->kav_romp;
752 #endif
755 #ifdef sun4v
756 void
757 kmdb_prom_init_promif(char *pgmname, kmdb_auxv_t *kav)
759 ASSERT(kav->kav_domaining);
760 cif_init(pgmname, kav->kav_promif_root,
761 kav->kav_promif_in, kav->kav_promif_out,
762 kav->kav_promif_pin, kav->kav_promif_pout,
763 kav->kav_promif_chosennode, kav->kav_promif_optionsnode);
765 #endif
768 * Conclude the initialization of the debugger/PROM interface. Memory
769 * allocation and the global `mdb' object are now available.
771 void
772 kmdb_prom_init_finish(kmdb_auxv_t *kav)
774 mdb.m_promif = mdb_zalloc(sizeof (kmdb_promif_t), UM_SLEEP);
775 kmdb_prom_term_init(kav, mdb.m_promif);