Linux 协议号 宏,这是linux内核代码中的任何一种宏吗?

MACHINE_START(OMAP4_PANDA, "OMAP4430 Panda Board")

.phys_io = 0x48000000,

.io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,

.boot_params = 0x80000100,

.map_io = omap_panda_map_io,

.init_irq = omap_panda_init_irq,

.init_machine = omap_panda_init,

.timer = &omap_timer,

MACHINE_END

我不知道这是什么..?这是一个宏观或结构或什么.. ???

定义说

/*

* Set of macros to define architecture features. This is built into

* a table by the linker.

*/

#define MACHINE_START(_type,_name) \

static const struct machine_desc __mach_desc_##_type \

__used \

__attribute__((__section__(".arch.info.init"))) = { \

.nr = MACH_TYPE_##_type, \

.name = _name,

#define MACHINE_END \

};

#endif

但我不明白它是如何工作的?

解决方法:

designated structure initialization是一个GNU GCC扩展,如果您习惯于ANSI C编译器,它看起来有点奇怪.结合雄心勃勃的宏观,使其在许多方面看起来像一门外语.扩展的源代码是:

static const struct machine_desc __mach_desc_OMAP4_PANDA

__used __attribute__((__section__(".arch.info.init"))) = {

.nr = MACH_TYPE_OMAP4_PANDA,

.name = "OMAP4430 Panda Board",

.phys_io = 0x48000000,

.io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,

.boot_params = 0x80000100,

.map_io = omap_panda_map_io,

.init_irq = omap_panda_init_irq,

.init_machine = omap_panda_init,

.timer = &omap_timer,

};

标签:c-3,linux,linux-kernel

来源: https://codeday.me/bug/20190826/1730395.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值