0

How to understand the below macros found in include/linux/compiler.h.Mainly, address_space, context macros.

7 # define __user         __attribute__((noderef, address_space(1)))
8 # define __kernel       __attribute__((address_space(0)))
9 # define __safe         __attribute__((safe))
10 # define __force        __attribute__((force))
11 # define __nocast       __attribute__((nocast))
12 # define __iomem        __attribute__((noderef, address_space(2)))
13 # define __must_hold(x) __attribute__((context(x,1,1)))
14 # define __acquires(x)  __attribute__((context(x,0,1)))
15 # define __releases(x)  __attribute__((context(x,1,0)))
16 # define __acquire(x)   __context__(x,1)
17 # define __release(x)   __context__(x,-1)
18 # define __cond_lock(x,c)       ((c) ? ({ __acquire(x); 1; }) : 0)
19 # define __percpu       __attribute__((noderef, address_space(3)))
20 #ifdef CONFIG_SPARSE_RCU_POINTER
21 # define __rcu          __attribute__((noderef, address_space(4)))
22 #else
23 # define __rcu
24 #endif
askb
  • 6,501
  • 30
  • 43
kee
  • 46
  • 2
  • 10
  • Refer to [__user macro](http://stackoverflow.com/questions/4521551/what-are-the-implications-of-the-linux-user-macro) and [GCC attribute syntax](https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html) – askb Nov 20 '14 at 04:38
  • 2
    The key point in [compiler.h](http://lxr.free-electrons.com/source/include/linux/compiler.h) is the `#ifdef __CHECKER__`. Google **sparse**; a program checker. Normal Linux compilation doesn't use this. – artless noise Nov 21 '14 at 22:39
  • I have referred this GCC page, but could not see the any pointers on noderef, address_space() and how they help here. – kee Nov 25 '14 at 06:31

0 Answers0