- 论坛徽章:
- 0
|
宏current实际是个函数,把SUSE10、11该函数帖上来看看,估计改了什么地方,和中断冲突了。
zyr-linux 发表于 2010-06-30 09:58 ![]() - /* suse11: x86_x64*/
- static __always_inline struct task_struct *get_current(void)
- {
- return read_pda(pcurrent);
- }
- #define read_pda(field) pda_from_op("mov", field)
- #define pda_from_op(op, field) \
- ({ \
- typeof(_proxy_pda.field) ret__; \
- switch (sizeof(_proxy_pda.field)) { \
- case 2: \
- asm(op "w %%gs:%c1,%0" : \
- "=r" (ret__) : \
- "i" (pda_offset(field)), \
- "m" (_proxy_pda.field)); \
- break; \
- case 4: \
- asm(op "l %%gs:%c1,%0": \
- "=r" (ret__): \
- "i" (pda_offset(field)), \
- "m" (_proxy_pda.field)); \
- break; \
- case 8: \
- asm(op "q %%gs:%c1,%0": \
- "=r" (ret__) : \
- "i" (pda_offset(field)), \
- "m" (_proxy_pda.field)); \
- break; \
- default: \
- __bad_pda_field(); \
- } \
- ret__; \
- })
复制代码 suse 10:- i386:
- static __always_inline struct task_struct * get_current(void)
- {
- return current_thread_info()->task;
- }
-
- #define current get_current()
- static inline struct thread_info *current_thread_info(void)
- {
- struct thread_info *ti;
- __asm__("andl %%esp,%0; ":"=r" (ti) : "0" (~(THREAD_SIZE - 1)));
- return ti;
- }
复制代码 suse10 86_x64:64位实现- static inline struct thread_info *current_thread_info(void)
- {
- struct thread_info *ti;
- ti = (void *)(read_pda(kernelstack) + PDA_STACKOFFSET - THREAD_SIZE);
- return ti;
- }
复制代码 suse10内核中64位的实现和suse11 64位实现是不一样的。
还有一个关键问题忘了说了,
就是在suse11上,应用进程是32位,内核模块都是64位,操作系统默认也都是64位的
而在suse10上,内核和应用程序都是32位 |
|