免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1780 | 回复: 0
打印 上一主题 下一主题

arm linux 的内核 start_kernel的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-02-17 00:31 |只看该作者 |倒序浏览
我费解了很久 还是不解::

在include\linux\Cupmask.h中有如下定义
typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
extern cpumask_t _unused_cpumask_arg_;

#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst))
static inline void __cpu_set(int cpu, volatile cpumask_t *dstp)
{
        set_bit(cpu, dstp->bits);
}

在include\linux\Types.h中有如下定义
#ifdef __KERNEL__
#define BITS_TO_LONGS(bits) \
(((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
#define DECLARE_BITMAP(name,bits) \
unsigned long name[BITS_TO_LONGS(bits)](这个bits =32)
#define BITS_PER_BYTE 8
#endif
我们可以得出:cpumask_t 等价于 unsigned long bits[1]
那么cpumask_t *dstp 就是一个指向 unsigned long 数组的指针
那么 为什么会出现 这样的 表达式         set_bit(cpu, dstp->bits);    ?????
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP