summaryrefslogtreecommitdiffstats
path: root/include/asm-sh
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2006-09-27 16:01:12 +0900
committerPaul Mundt <lethal@linux-sh.org>2006-09-27 16:01:12 +0900
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);
#define set_mb(var, value) do { xchg(&var, value); } while (0)
/* Interrupt Control */
-static __inline__ void local_irq_enable(void)
+#ifdef CONFIG_CPU_HAS_SR_RB
+static inline void local_irq_enable(void)
{
unsigned long __dummy0, __dummy1;
@@ -149,6 +150,20 @@ static __inline__ void local_irq_enable(void)
: "1" (~0x000000f0)
: "memory");
}
+#else
+static inline void local_irq_enable(void)
+{
+ unsigned long __dummy0, __dummy1;
+
+ __asm__ __volatile__ (
+ "stc sr, %0\n\t"
+ "and %1, %0\n\t"
+ "ldc %0, sr\n\t"
+ : "=&r" (__dummy0), "=r" (__dummy1)
+ : "1" (~0x000000f0)
+ : "memory");
+}
+#endif
static __inline__ void local_irq_disable(void)
{
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 {
#define init_thread_info (init_thread_union.thread_info)
#define init_stack (init_thread_union.stack)
+#define THREAD_SIZE (2*PAGE_SIZE)
+
/* how to get the thread information struct from C */
static inline struct thread_info *current_thread_info(void)
{
struct thread_info *ti;
+#ifdef CONFIG_CPU_HAS_SR_RB
__asm__("stc r7_bank, %0" : "=r" (ti));
+#else
+ unsigned long __dummy;
+
+ __asm__ __volatile__ (
+ "mov r15, %0\n\t"
+ "and %1, %0\n\t"
+ : "=&r" (ti), "=r" (__dummy)
+ : "1" (~(THREAD_SIZE - 1))
+ : "memory");
+#endif
+
return ti;
}
/* thread information allocation */
-#define THREAD_SIZE (2*PAGE_SIZE)
#define alloc_thread_info(ti) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
@@ -65,7 +78,7 @@ static inline struct thread_info *current_thread_info(void)
/* how to get the thread information struct from ASM */
#define GET_THREAD_INFO(reg) \
- stc r7_bank, reg
+ stc r7_bank, reg
#endif