aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sh/thread_info.h
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2006-09-27 03:01:12 -0400
committerPaul Mundt <lethal@linux-sh.org>2006-09-27 03:01:12 -0400
commitf1517494407b1f1ca0063a756cc30d75e96d433c (patch)
treefe7827210e76750687de601e6b0695a4e4e16fa7 /include/asm-sh/thread_info.h
parent5283ecb5ccbdb90d49fce6488d3944bba63a591c (diff)
sh: Cleanup and document register bank usage.
Initial register bank cleanup. Make SR.RB configurable, and add some preliminary documentation on register bank usage within the kernel. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include/asm-sh/thread_info.h')
-rw-r--r--include/asm-sh/thread_info.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h
index 7345350d98c0..f64dd803a014 100644
--- a/include/asm-sh/thread_info.h
+++ b/include/asm-sh/thread_info.h
@@ -48,16 +48,29 @@ struct thread_info {
48#define init_thread_info (init_thread_union.thread_info) 48#define init_thread_info (init_thread_union.thread_info)
49#define init_stack (init_thread_union.stack) 49#define init_stack (init_thread_union.stack)
50 50
51#define THREAD_SIZE (2*PAGE_SIZE)
52
51/* how to get the thread information struct from C */ 53/* how to get the thread information struct from C */
52static inline struct thread_info *current_thread_info(void) 54static inline struct thread_info *current_thread_info(void)
53{ 55{
54 struct thread_info *ti; 56 struct thread_info *ti;
57#ifdef CONFIG_CPU_HAS_SR_RB
55 __asm__("stc r7_bank, %0" : "=r" (ti)); 58 __asm__("stc r7_bank, %0" : "=r" (ti));
59#else
60 unsigned long __dummy;
61
62 __asm__ __volatile__ (
63 "mov r15, %0\n\t"
64 "and %1, %0\n\t"
65 : "=&r" (ti), "=r" (__dummy)
66 : "1" (~(THREAD_SIZE - 1))
67 : "memory");
68#endif
69
56 return ti; 70 return ti;
57} 71}
58 72
59/* thread information allocation */ 73/* thread information allocation */
60#define THREAD_SIZE (2*PAGE_SIZE)
61#define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1)) 74#define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
62#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) 75#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
63 76
@@ -65,7 +78,7 @@ static inline struct thread_info *current_thread_info(void)
65 78
66/* how to get the thread information struct from ASM */ 79/* how to get the thread information struct from ASM */
67#define GET_THREAD_INFO(reg) \ 80#define GET_THREAD_INFO(reg) \
68 stc r7_bank, reg 81 stc r7_bank, reg
69 82
70#endif 83#endif
71 84