add libtracing Makefile.am
[ust.git] / libmarkers / immediate.h
CommitLineData
a72ca31a
PMF
1#ifndef _LINUX_IMMEDIATE_H
2#define _LINUX_IMMEDIATE_H
3
4/*
5 * Immediate values, can be updated at runtime and save cache lines.
6 *
7 * (C) Copyright 2007 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
8 *
9 * This file is released under the GPLv2.
10 * See the file COPYING for more details.
11 */
12
13#ifdef USE_IMMEDIATE
14
15#include <asm/immediate.h>
16
17/**
18 * imv_set - set immediate variable (with locking)
19 * @name: immediate value name
20 * @i: required value
21 *
22 * Sets the value of @name, taking the module_mutex if required by
23 * the architecture.
24 */
25#define imv_set(name, i) \
26 do { \
27 name##__imv = (i); \
28 core_imv_update(); \
29 module_imv_update(); \
30 } while (0)
31
32/*
33 * Internal update functions.
34 */
35extern void core_imv_update(void);
36extern void imv_update_range(const struct __imv *begin,
37 const struct __imv *end);
38extern void imv_unref_core_init(void);
39extern void imv_unref(struct __imv *begin, struct __imv *end, void *start,
40 unsigned long size);
41
42#else
43
44/*
45 * Generic immediate values: a simple, standard, memory load.
46 */
47
48/**
49 * imv_read - read immediate variable
50 * @name: immediate value name
51 *
52 * Reads the value of @name.
53 */
54#define imv_read(name) _imv_read(name)
55
56/**
57 * imv_set - set immediate variable (with locking)
58 * @name: immediate value name
59 * @i: required value
60 *
61 * Sets the value of @name, taking the module_mutex if required by
62 * the architecture.
63 */
64#define imv_set(name, i) (name##__imv = (i))
65
66static inline void core_imv_update(void) { }
67static inline void imv_unref_core_init(void) { }
68
69#endif
70
71#define DECLARE_IMV(type, name) extern __typeof__(type) name##__imv
72#define DEFINE_IMV(type, name) __typeof__(type) name##__imv
73
74#define EXPORT_IMV_SYMBOL(name) EXPORT_SYMBOL(name##__imv)
75#define EXPORT_IMV_SYMBOL_GPL(name) EXPORT_SYMBOL_GPL(name##__imv)
76
77/**
78 * _imv_read - Read immediate value with standard memory load.
79 * @name: immediate value name
80 *
81 * Force a data read of the immediate value instead of the immediate value
82 * based mechanism. Useful for __init and __exit section data read.
83 */
84#define _imv_read(name) (name##__imv)
85
86#endif
This page took 0.025685 seconds and 4 git commands to generate.