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 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #pragma ident "%Z%%M% %I% %E% SMI"
28 #include <kmdb/kctl/kctl.h>
30 #include <sys/modctl.h>
31 #include <sys/bootconf.h>
33 #include <sys/kobj_impl.h>
37 kctl_lookup_by_name(char *modname
, char *symname
)
43 if ((mctl
= mod_hold_by_name(modname
)) == NULL
)
45 if ((ksym
= kobj_lookup_all(mctl
->mod_mp
, symname
, 1)) == NULL
) {
46 mod_release_mod(mctl
);
50 addr
= ksym
->st_value
;
52 mod_release_mod(mctl
);
58 kctl_boot_lookup_by_name(char *modname
, char *symname
)
63 if ((mctl
= kobj_boot_mod_lookup(modname
)) == NULL
)
66 if ((ksym
= kobj_lookup_all(mctl
->mod_mp
, symname
, 1)) == NULL
)
69 return (ksym
->st_value
);
73 kctl_auxv_init(kmdb_auxv_t
*kav
, const char *cfg
, const char **argv
, void *romp
)
75 bzero(kav
, sizeof (kmdb_auxv_t
));
76 kav
->kav_dseg
= kctl
.kctl_dseg
;
77 kav
->kav_dseg_size
= kctl
.kctl_dseg_size
;
78 kav
->kav_pagesize
= PAGESIZE
;
80 kav
->kav_kdi
= &kobj_kdi
;
81 kav
->kav_wrintr_fire
= kctl_wrintr_fire
;
83 kav
->kav_config
= cfg
;
85 kav
->kav_modpath
= kobj_module_path
;
87 kctl_dprintf("kctl_auxv_init: modpath '%s'", kav
->kav_modpath
);
89 if (kctl
.kctl_boot_loaded
) {
90 kav
->kav_lookup_by_name
= kctl_boot_lookup_by_name
;
91 kav
->kav_flags
|= KMDB_AUXV_FL_NOUNLOAD
;
93 kav
->kav_lookup_by_name
= kctl_lookup_by_name
;
95 if (kctl
.kctl_flags
& KMDB_F_TRAP_NOSWITCH
)
96 kav
->kav_flags
|= KMDB_AUXV_FL_NOTRPSWTCH
;
98 kctl_auxv_init_isadep(kav
, romp
); /* can modify anything in kav */
102 kctl_auxv_fini(kmdb_auxv_t
*kav
)
104 kctl_auxv_fini_isadep(kav
);