在uclinux启动时有一个默认的初始线程uclinux用一个union来保存这个线程的数据其定义在arch/blackfin/kenel/init_taskc中 /* * 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__(datainit_task))) = { INIT_THREAD_INFO(init_task)} thread_union的定义在include/linux/shedh中 union thread_union { struct thread_info thread_info unsigned long stack[THREAD_SIZE/sizeof(long)] } 其中THREAD_SIZE的定义在include/asm/thread_infoh中 /* * Size of kernel stack for each process This must be a power of …… */ #define THREAD_SIZE /* pages */ 此union中的thread_info这个结构体我们暂且不管(因为目前还不需要使用到它)先看看heads中与此union相关的部分 /* * load the current thread pointer and stack */ rl = _init_thread_union rh = _init_thread_union rl = x // 字节 rh = x r = r + r sp = r usp = sp fp = sp 也就是说在初始化的时候将FP和SP都指向了stack的最高位置它并没有使用thread_info这个结构体 猜想uclinux应该是把前面的启动过程都当成一个特殊的线程看待这个线程从heads的第一行语句开始一直工作到内核启动完成 |