aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sh
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
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')
-rw-r--r--include/asm-sh/system.h17
-rw-r--r--include/asm-sh/thread_info.h17
2 files changed, 31 insertions, 3 deletions
diff --git a/include/asm-sh/system.h b/include/asm-sh/system.h
index 1630a5411e5..198d17e3069 100644
--- a/include/asm-sh/system.h
+++ b/include/asm-sh/system.h
@@ -136,7 +136,8 @@ extern void __xchg_called_with_bad_pointer(void);
136#define set_mb(var, value) do { xchg(&var, value); } while (0) 136#define set_mb(var, value) do { xchg(&var, value); } while (0)
137 137
138/* Interrupt Control */ 138/* Interrupt Control */
139static __inline__ void local_irq_enable(void) 139#ifdef CONFIG_CPU_HAS_SR_RB
140static inline void local_irq_enable(void)
140{ 141{
141 unsigned long __dummy0, __dummy1; 142 unsigned long __dummy0, __dummy1;
142 143
@@ -149,6 +150,20 @@ static __inline__ void local_irq_enable(void)
149 : "1" (~0x000000f0) 150 : "1" (~0x000000f0)
150 : "memory"); 151 : "memory");
151} 152}
153#else
154static inline void local_irq_enable(void)
155{
156 unsigned long __dummy0, __dummy1;
157
158 __asm__ __volatile__ (
159 "stc sr, %0\n\t"
160 "and %1, %0\n\t"
161 "ldc %0, sr\n\t"
162 : "=&r" (__dummy0), "=r" (__dummy1)
163 : "1" (~0x000000f0)
164 : "memory");
165}
166#endif
152 167
153static __inline__ void local_irq_disable(void) 168static __inline__ void local_irq_disable(void)
154{ 169{
diff --git a/include/asm-sh/thread_info.h b/include/asm-sh/thread_info.h
index 7345350d98c..f64dd803a01 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