在Linux Kernel中有些constant需要被C code 跟 assembler共同使用
在用constant的時候,不能單方面給0x1000UL因為assembler無法看這東西。
但是C compiler卻可以。所以使用這個gcc feature.
讓C compiler看到的constant是0x1000UL.
而assembler看起來是0x1000.
6 | /* Some constant macros are used in both assembler and |
---|---|
7 | * C code. Therefore we cannot annotate them always with |
8 | * ‘UL‘ and other type specifiers unilaterally. We |
9 | * use the following macros to deal with this. |
10 | * |
11 | * Similarly, _AT() will cast an expression with a type in C, but |
12 | * leave it unchanged in asm. |
13 | */ |
ref.
[1] http://code.woboq.org/linux/linux/include/uapi/linux/const.h.html
[原]__ASSEMBLY__的用途,布布扣,bubuko.com
原文地址:http://www.cnblogs.com/bittorrent/p/3839849.html