Lines Matching +full:name +full:-

1 /* SPDX-License-Identifier: GPL-2.0 */
8 * Static calls use code patching to hard-code function pointers into direct
17 * DECLARE_STATIC_CALL(name, func);
18 * DEFINE_STATIC_CALL(name, func);
19 * DEFINE_STATIC_CALL_NULL(name, typename);
20 * DEFINE_STATIC_CALL_RET0(name, typename);
24 * static_call(name)(args...);
25 * static_call_cond(name)(args...);
26 * static_call_update(name, func);
27 * static_call_query(name);
52 * This requires some arch-specific code (CONFIG_HAVE_STATIC_CALL).
55 * Each static_call() site calls into a trampoline associated with the name.
57 * name will modify the trampoline's branch destination.
84 * instruction, instead of an immediate tail-call JMP. HAVE_STATIC_CALL_INLINE
97 * static_call_cond(name)(arg1);
99 * which will include the required value tests to avoid NULL-pointer
104 * func = static_call_query(name);
115 * make things work. In particular it relies on Caller Stack-cleanup and the
146 #define STATIC_CALL_TRAMP_ADDR(name) &STATIC_CALL_TRAMP(name) argument
149 #define STATIC_CALL_TRAMP_ADDR(name) NULL argument
152 #define static_call_update(name, func) \ argument
154 typeof(&STATIC_CALL_TRAMP(name)) __F = (func); \
155 __static_call_update(&STATIC_CALL_KEY(name), \
156 STATIC_CALL_TRAMP_ADDR(name), __F); \
159 #define static_call_query(name) (READ_ONCE(STATIC_CALL_KEY(name).func)) argument
183 #define DEFINE_STATIC_CALL(name, _func) \ argument
184 DECLARE_STATIC_CALL(name, _func); \
185 struct static_call_key STATIC_CALL_KEY(name) = { \
189 ARCH_DEFINE_STATIC_CALL_TRAMP(name, _func)
191 #define DEFINE_STATIC_CALL_NULL(name, _func) \ argument
192 DECLARE_STATIC_CALL(name, _func); \
193 struct static_call_key STATIC_CALL_KEY(name) = { \
197 ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name)
199 #define DEFINE_STATIC_CALL_RET0(name, _func) \ argument
200 DECLARE_STATIC_CALL(name, _func); \
201 struct static_call_key STATIC_CALL_KEY(name) = { \
205 ARCH_DEFINE_STATIC_CALL_RET0_TRAMP(name)
207 #define static_call_cond(name) (void)__static_call(name) argument
209 #define EXPORT_STATIC_CALL(name) \ argument
210 EXPORT_SYMBOL(STATIC_CALL_KEY(name)); \
211 EXPORT_SYMBOL(STATIC_CALL_TRAMP(name))
212 #define EXPORT_STATIC_CALL_GPL(name) \ argument
213 EXPORT_SYMBOL_GPL(STATIC_CALL_KEY(name)); \
214 EXPORT_SYMBOL_GPL(STATIC_CALL_TRAMP(name))
217 #define EXPORT_STATIC_CALL_TRAMP(name) \ argument
218 EXPORT_SYMBOL(STATIC_CALL_TRAMP(name)); \
219 ARCH_ADD_TRAMP_KEY(name)
220 #define EXPORT_STATIC_CALL_TRAMP_GPL(name) \ argument
221 EXPORT_SYMBOL_GPL(STATIC_CALL_TRAMP(name)); \
222 ARCH_ADD_TRAMP_KEY(name)
228 #define DEFINE_STATIC_CALL(name, _func) \ argument
229 DECLARE_STATIC_CALL(name, _func); \
230 struct static_call_key STATIC_CALL_KEY(name) = { \
233 ARCH_DEFINE_STATIC_CALL_TRAMP(name, _func)
235 #define DEFINE_STATIC_CALL_NULL(name, _func) \ argument
236 DECLARE_STATIC_CALL(name, _func); \
237 struct static_call_key STATIC_CALL_KEY(name) = { \
240 ARCH_DEFINE_STATIC_CALL_NULL_TRAMP(name)
242 #define DEFINE_STATIC_CALL_RET0(name, _func) \ argument
243 DECLARE_STATIC_CALL(name, _func); \
244 struct static_call_key STATIC_CALL_KEY(name) = { \
247 ARCH_DEFINE_STATIC_CALL_RET0_TRAMP(name)
249 #define static_call_cond(name) (void)__static_call(name) argument
255 WRITE_ONCE(key->func, func); in __static_call_update()
267 #define EXPORT_STATIC_CALL(name) \ argument
268 EXPORT_SYMBOL(STATIC_CALL_KEY(name)); \
269 EXPORT_SYMBOL(STATIC_CALL_TRAMP(name))
270 #define EXPORT_STATIC_CALL_GPL(name) \ argument
271 EXPORT_SYMBOL_GPL(STATIC_CALL_KEY(name)); \
272 EXPORT_SYMBOL_GPL(STATIC_CALL_TRAMP(name))
275 #define EXPORT_STATIC_CALL_TRAMP(name) \ argument
276 EXPORT_SYMBOL(STATIC_CALL_TRAMP(name))
277 #define EXPORT_STATIC_CALL_TRAMP_GPL(name) \ argument
278 EXPORT_SYMBOL_GPL(STATIC_CALL_TRAMP(name))
289 #define __DEFINE_STATIC_CALL(name, _func, _func_init) \ argument
290 DECLARE_STATIC_CALL(name, _func); \
291 struct static_call_key STATIC_CALL_KEY(name) = { \
295 #define DEFINE_STATIC_CALL(name, _func) \ argument
296 __DEFINE_STATIC_CALL(name, _func, _func)
298 #define DEFINE_STATIC_CALL_NULL(name, _func) \ argument
299 __DEFINE_STATIC_CALL(name, _func, NULL)
301 #define DEFINE_STATIC_CALL_RET0(name, _func) \ argument
302 __DEFINE_STATIC_CALL(name, _func, __static_call_return0)
309 * - it ensures the compiler will only load the function pointer ONCE,
312 * - it ensures the argument evaluation is unconditional, similar
316 * and will emit an indirect call for the NULL case :-(
318 #define __static_call_cond(name) \ argument
320 void *func = READ_ONCE(STATIC_CALL_KEY(name).func); \
323 (typeof(STATIC_CALL_TRAMP(name))*)func; \
326 #define static_call_cond(name) (void)__static_call_cond(name) argument
331 WRITE_ONCE(key->func, func); in __static_call_update()
339 #define EXPORT_STATIC_CALL(name) EXPORT_SYMBOL(STATIC_CALL_KEY(name)) argument
340 #define EXPORT_STATIC_CALL_GPL(name) EXPORT_SYMBOL_GPL(STATIC_CALL_KEY(name)) argument