4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
34 #include <sys/kobj_impl.h>
35 #include <sys/modctl.h>
36 #include <sys/types.h>
38 #pragma weak primaries = kobj_linkmaps /* backwards compatibility */
39 struct modctl_list
*kobj_linkmaps
[] = {
45 #define KOBJ_LM_NENT (sizeof (kobj_linkmaps) / sizeof (struct modctl *) - 1)
48 kobj_lm_lookup(int lmid
)
50 if (lmid
< 0 || lmid
>= KOBJ_LM_NENT
)
53 return (kobj_linkmaps
[lmid
]);
57 kobj_lm_append(int lmid
, struct modctl
*modp
)
59 struct modctl_list
**lpp
, *lp
;
61 if (lmid
< 0 || lmid
>= KOBJ_LM_NENT
)
64 lpp
= &kobj_linkmaps
[lmid
];
66 lp
= kobj_zalloc(sizeof (struct modctl_list
), KM_WAIT
);
72 struct modctl_list
*last
;
74 for (last
= *lpp
; last
->modl_next
!= NULL
;
75 last
= last
->modl_next
)
83 kobj_lm_dump(int lmid
)
85 struct modctl_list
*lp
;
87 for (lp
= kobj_lm_lookup(lmid
); lp
; lp
= lp
->modl_next
) {
88 struct module
*mp
= lp
->modl_modp
->mod_mp
;
90 _kobj_printf(ops
, "module %s: ", mp
->filename
);
91 _kobj_printf(ops
, "text at [0x%p, ", mp
->text
);
92 _kobj_printf(ops
, "0x%lx] ", (uintptr_t)mp
->text
+
94 _kobj_printf(ops
, "data at 0x%p\n", mp
->data
);