<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

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

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

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

          在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(這個(gè)bits =32)
          #define BITS_PER_BYTE 8
          #endif

          awk變量使用單引號(hào)的問(wèn)題

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

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

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

          struct stdent *p;
          如果我要訪問(wèn)*p的age,可以這樣寫(xiě) p->age;

          如果你定義一個(gè) unsigned long aaa;unsigned long p; 沒(méi)有這種用法吧 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;
          如果我要訪問(wèn)*p的age,可以這樣寫(xiě) p->age;

          如果你定義一個(gè) unsigned long aaa;unsigned long ...

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


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

          評(píng)論


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

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();