![]() |
|
||||||||||||||
| | 首页 | 新闻 | 文库 | 方案 | 技术 | 独家 | 座谈 | 下载 | 图库 | 开发板 | 仿真器 | 邮购 | VIP | 芯片 | 客户评价 | 论坛 | | ||
|
||
|
|||||
| uclinux-2008R1-RC8(bf561)到VDSP5的移植(12):init_thread_union | |||||
作者:快乐虾 文章来源:http://blog.csdn.net/lights_joy 点击数: 更新时间:2008-5-5 ![]() |
|||||
|
在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这个结构体。
|
|||||
| 文章录入:admin 责任编辑:admin | |||||
| 【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 | |||||
| 网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!) |
| | 本站介绍 | 合作联络 | 欢迎投稿 | 广告业务 | 网站地图 | 设为首页 | 加入收藏 | 友情链接 | 网站公告 | 联系我们 | | |||
|