知识大全 init

Posted

篇首语:登山则情满于山,观海则意溢于海。本文由小常识网(cha138.com)小编为大家整理,主要介绍了知识大全 init相关的知识,希望对你有一定的参考价值。

  在uclinux启动时有一个默认的初始线程 uclinux用一个union来保存这个线程的数据 其定义在arch/blackfin/kenel/init_task c中

  /*

  * Initial thread structure

  *

  * We need to make sure that this is byte aligned due to the

  * way process stacks are handled This is done by having a special

  * init_task linker map entry

  */

  union thread_union init_thread_union

  __attribute__ ((__section__( data init_task ))) =

  INIT_THREAD_INFO(init_task)

  thread_union的定义在include/linux/shed h中

  union thread_union

  struct thread_info thread_info

  unsigned long stack[THREAD_SIZE/sizeof(long)]

  

  其中THREAD_SIZE的定义在include/asm/thread_info h中

  /*

  * Size of kernel stack for each process This must be a power of ……

  */

  #define THREAD_SIZE /* pages */

  此union中的thread_info这个结构体我们暂且不管(因为目前还不需要使用到它) 先看看head s中与此union相关的部分

  /*

  * load the current thread pointer and stack

  */

  r l = _init_thread_union

  r h = _init_thread_union

  r l = x // 字节

  r h = x

  r = r + r

  sp = r

  usp = sp

  fp = sp

  也就是说 在初始化的时候 将FP和SP都指向了stack的最高位置 它并没有使用thread_info这个结构体

cha138/Article/program/net/201311/12009

相关参考