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]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #include <sys/isa_defs.h>
27 #include <sys/utsname.h>
30 #include <kmdb/kmdb_dpi.h>
31 #include <kmdb/kmdb_kdi.h>
32 #include <mdb/mdb_err.h>
35 static const char _mdb_version
[] = KMDB_VERSION
;
38 mdb_conf_version(void)
40 return (_mdb_version
);
47 #if defined(__sparcv9)
51 #endif /* __sparcv9 */
52 #elif defined(__amd64)
62 * These functions are needed for path evaluation, and must be run prior to
63 * target initialization. The kmdb symbol resolution machinery hasn't been
64 * initialized at this point, so we have to rely on the kernel to look up
65 * utsname and platform for us.
69 mdb_conf_uname(struct utsname
*utsp
)
71 bzero(utsp
, sizeof (struct utsname
));
73 if (kmdb_dpi_get_state(NULL
) == DPI_STATE_INIT
) {
74 struct utsname
*utsaddr
;
77 * The kernel is running during DPI initialization, so we'll ask
78 * it to do the lookup. Our own symbol resolution facilities
79 * won't be available until after the debugger starts.
81 if ((utsaddr
= (struct utsname
*)kmdb_kdi_lookup_by_name("unix",
82 "utsname")) == NULL
) {
83 warn("'utsname' symbol is missing from kernel\n");
84 (void) strcpy(utsp
->sysname
, "unknown");
88 bcopy(utsaddr
, utsp
, sizeof (struct utsname
));
90 (void) mdb_tgt_uname(mdb
.m_target
, utsp
);
94 mdb_conf_platform(void)
96 if (kmdb_dpi_get_state(NULL
) == DPI_STATE_INIT
) {
97 static char plat
[SYS_NMLN
];
101 * The kernel is running during DPI initialization, so we'll ask
102 * it to do the lookup. Our own symbol resolution facilities
103 * won't be available until after the debugger starts.
105 if ((plataddr
= (caddr_t
)kmdb_kdi_lookup_by_name("unix",
106 "platform")) == NULL
) {
107 warn("conf: 'platform' symbol is missing from "
112 (void) strncpy(plat
, plataddr
, sizeof (plat
));
113 plat
[sizeof (plat
) - 1] = '\0';
117 return (mdb_tgt_platform(mdb
.m_target
));