新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > arm linux 內(nèi)核 startkenal 的問題

arm linux 內(nèi)核 startkenal 的問題

作者: 時間:2016-11-21 來源:網(wǎng)絡(luò) 收藏
arm linux 內(nèi)核 start_kenal 的問題我費解了很久 還是不解::

在includelinuxCupmask.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);
}

在includelinuxTypes.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 =32)
#define BITS_PER_BYTE 8
#endif

awk變量使用單引號的問題

本文引用地址:http://butianyuan.cn/article/201611/319188.htm
我們可以得出:cpumask_t 等價于 unsigned long bits
那么cpumask_t *dstp 就是一個指向 unsigned long 數(shù)組的指針
那么 為什么會出現(xiàn) 這樣的 表達式 set_bit(cpu, dstp->bits); ?????cpusets是使用位掩碼來表示的。
對于一個32位機上的unsigned int類型來說,它有32個bit位。那么每個bit位就對應(yīng)一個CPU。比如0x1就表示0號位的那個CPU。0x3就表示0,1號位的那兩個CPU。

也可以看看這個貼子第六樓:
http://www.chinaunix.net/index.php?uid=20551201&url=http://linux.chinaunix.net/bbs/viewthread.php?tid=904906感謝 scutan (冬日夜雨)的幫助 (牛人啊 )
我更加了解了代碼表達的 意思

我還有一個地方不 明白
static inline void __cpu_set(int cpu, volatile cpumask_t *dstp) //dest是指向 unsigned long bits
//我就看不 個這個表達式了 dstp->bits
{
set_bit(cpuhttp://www.airmaxshoe.net, dstp->bits);
}-> 一般用于數(shù)據(jù)結(jié)構(gòu)里面啊
例如
struct student
{
age;
heathy;
}

struct stdent *p;
如果我要訪問*p的age,可以這樣寫 p->age;

如果你定義一個 unsigned long aaa;unsigned long p; 沒有這種用法吧 p->bit,,,,就是這里不 明白原帖由 eezzrr 于 2009-2-17 01:36 發(fā)表 http://linux.chinaunix.net/bbs/images/common/back.gif
-> 一般用于數(shù)據(jù)結(jié)構(gòu)里面啊
例如
struct student
{
age;
heathy;
}

struct stdent *p;
如果我要訪問*p的age,可以這樣寫 p->age;

如果你定義一個 unsigned long aaa;unsigned long ...

是這樣的http://www.posercity.com,比如說 unsigned long a,此時的a就是訪問這個數(shù)組的第一個元素的值。而同樣也可以使用a,此時的a就表示這個數(shù)組的首地址。


關(guān)鍵詞: armlinux內(nèi)核startkena

評論


技術(shù)專區(qū)

關(guān)閉