在uclinux啟動時有一個默認的初始線程,uclinux用一個union來保存這個線程的數據,其定義在arch/blackfin/kenel/init_task.c中:
/*
* Initial thread structure.
*
* We need to make sure that this is 8192-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 2...
*/
#define THREAD_SIZE 8192 /* 2 pages */
此union中的thread_info這個結構體我們暫且不管(因為目前還不需要使用到它)。先看看head.s中與此union相關的部分:
/*
* load the current thread pointer and stack
*/
r1.l = _init_thread_union;
r1.h = _init_thread_union;
r2.l = 0x2000; // 8192字節
r2.h = 0x0000;
r1 = r1 + r2;
sp = r1;
usp = sp;
fp = sp;
也就是說,在初始化的時候,將FP和SP都指向了stack的最高位置,它並沒有使用thread_info這個結構體。
uclinux-2008R1-RC8(bf561)到VDSP5的移植(62)
uclinux-2008R1-RC8(bf561)到VDSP5的移植(60):current_text_addr
uclinux-2008R1-RC8(bf561)到VDSP5的移植(58)
uclinux-2008R1-RC8(bf561)到VDSP5的移植(57)
uclinux-2008R1-RC8(bf561)到VDSP5的移植(56):__grab_cache_page
uclinux-2008R1-RC8(bf561)到VDSP5的移植(46):raw_rwlock_t