aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChuck Ebbert <76306.1226@compuserve.com>2006-06-27 05:53:47 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-27 20:32:37 -0400
commitc723e084606ca1c81e91b80b2c0c44bde7bbc4df (patch)
treec338f62586978093d7c6b85c3f783cb65879c1f1 /include
parent4b89aff930d632be10d557d08d1b60dee7163dbe (diff)
[PATCH] i386: use C code for current_thread_info()
Using C code for current_thread_info() lets the compiler optimize it. With gcc 4.0.2, kernel is smaller: text data bss dec hex filename 3645212 555556 312024 4512792 44dc18 2.6.17-rc6-nb-post/vmlinux 3647276 555556 312024 4514856 44e428 2.6.17-rc6-nb/vmlinux ------- -2064 Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/asm-i386/thread_info.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
index fdbc7f422ea5..ff1e2b1a7c84 100644
--- a/include/asm-i386/thread_info.h
+++ b/include/asm-i386/thread_info.h
@@ -83,17 +83,15 @@ struct thread_info {
83#define init_stack (init_thread_union.stack) 83#define init_stack (init_thread_union.stack)
84 84
85 85
86/* how to get the current stack pointer from C */
87register unsigned long current_stack_pointer asm("esp") __attribute_used__;
88
86/* how to get the thread information struct from C */ 89/* how to get the thread information struct from C */
87static inline struct thread_info *current_thread_info(void) 90static inline struct thread_info *current_thread_info(void)
88{ 91{
89 struct thread_info *ti; 92 return (struct thread_info *)(current_stack_pointer & ~(THREAD_SIZE - 1));
90 __asm__("andl %%esp,%0; ":"=r" (ti) : "0" (~(THREAD_SIZE - 1)));
91 return ti;
92} 93}
93 94
94/* how to get the current stack pointer from C */
95register unsigned long current_stack_pointer asm("esp") __attribute_used__;
96
97/* thread information allocation */ 95/* thread information allocation */
98#ifdef CONFIG_DEBUG_STACK_USAGE 96#ifdef CONFIG_DEBUG_STACK_USAGE
99#define alloc_thread_info(tsk) \ 97#define alloc_thread_info(tsk) \