aboutsummaryrefslogtreecommitdiff
path: root/arch/v850/kernel/asm-offsets.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 15:46:49 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 15:46:49 -0700
commit486a153f0e294f7cc735838edcb6b32e623cbe52 (patch)
treef16a31eb3526968dd08aa93c12cbb211f31f2084 /arch/v850/kernel/asm-offsets.c
parent9c8550ee25e26d14a8f0fe1b761a676e23fe3cf0 (diff)
parentf64a227b6b5cc1f8cc7f6ef9cc3351343636bac9 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild
Diffstat (limited to 'arch/v850/kernel/asm-offsets.c')
-rw-r--r--arch/v850/kernel/asm-offsets.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/arch/v850/kernel/asm-offsets.c b/arch/v850/kernel/asm-offsets.c
new file mode 100644
index 00000000000..24f29136907
--- /dev/null
+++ b/arch/v850/kernel/asm-offsets.c
@@ -0,0 +1,61 @@
+/*
+ * 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/sched.h>
+#include <linux/kernel_stat.h>
+#include <linux/ptrace.h>
+#include <linux/hardirq.h>
+#include <asm/irq.h>
+#include <asm/errno.h>
+
+#define DEFINE(sym, val) \
+ asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+
+#define BLANK() asm volatile("\n->" : : )
+
+int main (void)
+{
+ /* offsets into the task struct */
+ DEFINE (TASK_STATE, offsetof (struct task_struct, state));
+ DEFINE (TASK_FLAGS, offsetof (struct task_struct, flags));
+ DEFINE (TASK_PTRACE, offsetof (struct task_struct, ptrace));
+ DEFINE (TASK_BLOCKED, offsetof (struct task_struct, blocked));
+ DEFINE (TASK_THREAD, offsetof (struct task_struct, thread));
+ DEFINE (TASK_THREAD_INFO, offsetof (struct task_struct, thread_info));
+ DEFINE (TASK_MM, offsetof (struct task_struct, mm));
+ DEFINE (TASK_ACTIVE_MM, offsetof (struct task_struct, active_mm));
+ DEFINE (TASK_PID, offsetof (struct task_struct, pid));
+
+ /* offsets into the kernel_stat struct */
+ DEFINE (STAT_IRQ, offsetof (struct kernel_stat, irqs));
+
+
+ /* signal defines */
+ DEFINE (SIGSEGV, SIGSEGV);
+ DEFINE (SEGV_MAPERR, SEGV_MAPERR);
+ DEFINE (SIGTRAP, SIGTRAP);
+ DEFINE (SIGCHLD, SIGCHLD);
+ DEFINE (SIGILL, SIGILL);
+ DEFINE (TRAP_TRACE, TRAP_TRACE);
+
+ /* ptrace flag bits */
+ DEFINE (PT_PTRACED, PT_PTRACED);
+ DEFINE (PT_DTRACE, PT_DTRACE);
+
+ /* error values */
+ DEFINE (ENOSYS, ENOSYS);
+
+ /* clone flag bits */
+ DEFINE (CLONE_VFORK, CLONE_VFORK);
+ DEFINE (CLONE_VM, CLONE_VM);
+
+ return 0;
+}