]> git.hungrycats.org Git - linux/commitdiff
[PATCH] sh: Use asm-offsets
authorPaul Mundt <paul.mundt@nokia.com>
Mon, 18 Oct 2004 15:58:30 +0000 (08:58 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 18 Oct 2004 15:58:30 +0000 (08:58 -0700)
This basically follows the same change as for sh64 and adds asm-offsets to sh.
 Some hardcoded thread_info struct offsets get cleaned up by this.

Signed-off-by: Paul Mundt <paul.mundt@nokia.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/sh/kernel/asm-offsets.c [new file with mode: 0644]
arch/sh/kernel/entry.S
include/asm-sh/thread_info.h

diff --git a/arch/sh/kernel/asm-offsets.c b/arch/sh/kernel/asm-offsets.c
new file mode 100644 (file)
index 0000000..dc6725c
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * This program is used to generate definitions needed by
+ * assembly language modules.
+ *
+ * We use the technique used in the OSF Mach kernel code:
+ * generate asm statements containing #defines,
+ * compile this file to assembler, and then extract the
+ * #defines from the assembly-language output.
+ */
+
+#include <linux/stddef.h>
+#include <linux/types.h>
+#include <linux/mm.h>
+#include <asm/thread_info.h>
+
+#define DEFINE(sym, val) \
+        asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+
+#define BLANK() asm volatile("\n->" : : )
+
+int main(void)
+{
+       /* offsets into the thread_info struct */
+       DEFINE(TI_TASK,         offsetof(struct thread_info, task));
+       DEFINE(TI_EXEC_DOMAIN,  offsetof(struct thread_info, exec_domain));
+       DEFINE(TI_FLAGS,        offsetof(struct thread_info, flags));
+       DEFINE(TI_CPU,          offsetof(struct thread_info, cpu));
+       DEFINE(TI_PRE_COUNT,    offsetof(struct thread_info, preempt_count));
+       DEFINE(TI_RESTART_BLOCK,offsetof(struct thread_info, restart_block));
+
+       return 0;
+}
index 05dcc2e01fc1d1a680b4c67408a6030117d867b3..bb451cb483867be81358a76a320b10aacea62609 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/sys.h>
 #include <linux/linkage.h>
 #include <linux/config.h>
+#include <asm/asm-offsets.h>
 #include <asm/thread_info.h>
 #include <asm/unistd.h>
 
index a4a70df910f00e37089e36eecc108a8ae19bf68f..3bac2a5a5656d25ad2c5627662bb8c19d6d731ee 100644 (file)
@@ -25,16 +25,6 @@ struct thread_info {
        __u8                    supervisor_stack[0];
 };
 
-#else /* !__ASSEMBLY__ */
-
-/* offsets into the thread_info struct for assembly code access */
-#define TI_TASK                0x00000000
-#define TI_EXEC_DOMAIN 0x00000004
-#define TI_FLAGS       0x00000008
-#define TI_CPU         0x0000000c
-#define TI_PRE_COUNT   0x00000010
-#define TI_RESTART_BLOCK 0x00000014
-
 #endif
 
 #define PREEMPT_ACTIVE         0x4000000