Print this page
12399 kobj printf functions should be checked
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/uts/common/sys/kobj_impl.h
+++ new/usr/src/uts/common/sys/kobj_impl.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 + *
25 + * Copyright 2020 Joyent, Inc.
24 26 */
25 27
26 28 /*
27 29 * Kernel Run-Time Linker/Loader private interfaces.
28 30 */
29 31
30 32 #ifndef _SYS_KOBJ_IMPL_H
31 33 #define _SYS_KOBJ_IMPL_H
32 34
33 35 #include <sys/kdi.h>
34 36 #include <sys/kobj.h>
35 37 #include <sys/varargs.h>
36 38
37 39 #ifdef __cplusplus
38 40 extern "C" {
39 41 #endif
40 42
41 43 /*
42 44 * Boot/aux vector attributes.
43 45 */
44 46
45 47 #define BA_DYNAMIC 0
46 48 #define BA_PHDR 1
47 49 #define BA_PHNUM 2
48 50 #define BA_PHENT 3
49 51 #define BA_ENTRY 4
50 52 #define BA_PAGESZ 5
51 53 #define BA_LPAGESZ 6
52 54 #define BA_LDELF 7
53 55 #define BA_LDSHDR 8
54 56 #define BA_LDNAME 9
55 57 #define BA_BSS 10
56 58 #define BA_IFLUSH 11
57 59 #define BA_CPU 12
58 60 #define BA_MMU 13
59 61 #define BA_GOTADDR 14
60 62 #define BA_NEXTGOT 15
61 63 #define BA_NUM 16
62 64
63 65 typedef union {
64 66 unsigned long ba_val;
65 67 void *ba_ptr;
66 68 } val_t;
67 69
68 70 /*
69 71 * Segment info.
70 72 */
71 73 struct proginfo {
72 74 uint_t size;
73 75 uint_t align;
74 76 };
75 77
76 78 /*
77 79 * Implementation-specific flags.
78 80 */
79 81 #define KOBJ_EXEC 0x0004 /* executable (unix module) */
80 82 #define KOBJ_INTERP 0x0008 /* the interpreter module */
81 83 #define KOBJ_PRIM 0x0010 /* a primary kernel module */
82 84 #define KOBJ_RESOLVED 0x0020 /* fully resolved */
83 85 #define KOBJ_TNF_PROBE 0x0040 /* Contains TNF probe(s) */
84 86 #define KOBJ_RELOCATED 0x0080 /* relocation completed */
85 87 #define KOBJ_NOPARENTS 0x0200 /* nothing can depend on this module */
86 88 #define KOBJ_IGNMULDEF 0x0400 /* ignore dups during sym resolution */
87 89 #define KOBJ_NOKSYMS 0x0800 /* module's symbols don't go into ksyms */
88 90 #define KOBJ_EXPORTED 0x1000 /* ctf, syms copied to vmem */
89 91
90 92 /*
91 93 * kobj_notify_add() data notification structure
92 94 */
93 95 typedef void kobj_notify_f(uint_t, struct modctl *);
94 96
95 97 typedef struct kobj_notify_list {
96 98 kobj_notify_f *kn_func; /* notification func */
97 99 uint_t kn_type; /* notification type */
98 100 struct kobj_notify_list *kn_prev;
99 101 struct kobj_notify_list *kn_next;
100 102 } kobj_notify_list_t;
101 103
102 104 /*
103 105 * krtld can provide notification to external clients on the
104 106 * following events.
105 107 */
106 108 #define KOBJ_NOTIFY_MODLOADING 1 /* very early in module load */
107 109 #define KOBJ_NOTIFY_MODUNLOADING 2 /* before module unload */
108 110 #define KOBJ_NOTIFY_MODLOADED 3 /* after module load */
109 111 #define KOBJ_NOTIFY_MODUNLOADED 4 /* after module unload */
110 112 #define KOBJ_NOTIFY_MAX 4
111 113
112 114 #define ALIGN(x, a) ((a) == 0 ? (uintptr_t)(x) : \
113 115 (((uintptr_t)(x) + (uintptr_t)(a) - 1l) & ~((uintptr_t)(a) - 1l)))
114 116
115 117 #ifdef DEBUG
116 118 #define KOBJ_DEBUG
117 119 #endif
118 120
119 121 #ifdef KOBJ_DEBUG
120 122 /*
121 123 * Debugging flags.
122 124 */
123 125 #define D_DEBUG 0x001 /* general debugging */
124 126 #define D_SYMBOLS 0x002 /* debug symbols */
125 127 #define D_RELOCATIONS 0x004 /* debug relocations */
126 128 #define D_LOADING 0x008 /* section loading */
127 129
128 130 extern int kobj_debug; /* different than moddebug */
129 131 #endif
130 132
131 133 /*
132 134 * Flags for kobj memory allocation.
133 135 */
134 136 #define KM_WAIT 0x0 /* wait for it */
135 137 #define KM_NOWAIT 0x1 /* return immediately */
136 138
137 139 #define KM_TMP 0x1000 /* freed before kobj_init returns */
138 140 #define KM_SCRATCH 0x2000 /* not freed until kobj_sync */
139 141
140 142 #ifdef KOBJ_OVERRIDES
141 143 /*
142 144 * Until the kernel is fully linked, all code running in the
143 145 * context of krtld/kobj using bcopy or bzero must be directed
144 146 * to the kobj equivalents. All (ok, most) references to bcopy
145 147 * or bzero are thus so vectored.
146 148 */
147 149 #define bcopy(s, d, n) kobj_bcopy((s), (d), (n))
148 150 #define bzero(p, n) kobj_bzero((p), (n))
149 151 #define strlcat(s, d, n) kobj_strlcat((s), (d), (n))
150 152 #endif
151 153
152 154 extern kdi_t kobj_kdi;
153 155
154 156 struct bootops;
155 157
156 158 extern struct modctl_list *kobj_linkmaps[];
157 159
158 160 extern char *kobj_kmdb_argv[];
159 161
160 162 extern int kobj_mmu_pagesize;
161 163
162 164 extern void kobj_init(void *romvec, void *dvec,
163 165 struct bootops *bootvec, val_t *bootaux);
164 166 extern int kobj_notify_add(kobj_notify_list_t *);
165 167 extern int kobj_notify_remove(kobj_notify_list_t *);
166 168 extern int do_relocations(struct module *);
167 169 extern int do_relocate(struct module *, char *, int, int, Addr);
168 170 extern struct bootops *ops;
169 171 extern void exitto(caddr_t);
170 172 extern void kobj_sync_instruction_memory(caddr_t, size_t);
171 173 extern uint_t kobj_gethashsize(uint_t);
172 174 extern void * kobj_mod_alloc(struct module *, size_t, int, reloc_dest_t *);
173 175 extern void mach_alloc_funcdesc(struct module *);
174 176 extern uint_t kobj_hash_name(const char *);
175 177 extern caddr_t kobj_segbrk(caddr_t *, size_t, size_t, caddr_t);
176 178 extern int get_progbits_size(struct module *, struct proginfo *,
↓ open down ↓ |
143 lines elided |
↑ open up ↑ |
177 179 struct proginfo *, struct proginfo *);
178 180 extern Sym *kobj_lookup_kernel(const char *);
179 181 extern struct modctl *kobj_boot_mod_lookup(const char *);
180 182 extern void kobj_export_module(struct module *);
181 183 extern int kobj_load_primary_module(struct modctl *);
182 184 extern int boot_compinfo(int, struct compinfo *);
183 185 extern void mach_modpath(char *, const char *);
184 186
185 187 extern void kobj_setup_standalone_vectors(void);
186 188 extern void kobj_restore_vectors(void);
187 -extern void (*_kobj_printf)(void *, const char *fmt, ...);
188 -extern void (*_vkobj_printf)(void *, const char *fmt, va_list);
189 +extern void (*_kobj_printf)(void *, const char *fmt, ...) __KPRINTFLIKE(2);
190 +extern void (*_vkobj_printf)(void *, const char *fmt, va_list)
191 + __KVPRINTFLIKE(2);
189 192 extern void (*kobj_bcopy)(const void *, void *, size_t);
190 193 extern void (*kobj_bzero)(void *, size_t);
191 194 extern size_t (*kobj_strlcat)(char *, const char *, size_t);
192 195
193 196 #define KOBJ_LM_PRIMARY 0x0
194 197 #define KOBJ_LM_DEBUGGER 0x1
195 198
196 199 extern void kobj_lm_append(int, struct modctl *modp);
197 200 extern struct modctl_list *kobj_lm_lookup(int);
198 201 extern void kobj_lm_dump(int);
199 202
200 203 #ifdef __cplusplus
201 204 }
202 205 #endif
203 206
204 207 #endif /* _SYS_KOBJ_IMPL_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX