File: /usr/src/linux/arch/cris/kernel/entryoffsets.c

1     /* linux/arch/cris/entryoffsets.c
2      *
3      * Copyright (C) 2001 Axis Communications AB
4      *
5      * Generate structure offsets for use in entry.S.  No extra processing
6      * needed more than compiling this file to assembly code.  Horrendous
7      * assembly code will be generated, so don't look at that.
8      *
9      * Authors:	Hans-Peter Nilsson (hp@axis.com)
10      */
11     
12     /* There can be string constants fallout from inline functions, so we'd
13        better make sure we don't assemble anything emitted from inclusions.  */
14     __asm__ (".if 0");
15     
16     #include <linux/sched.h>
17     #include <linux/ptrace.h>
18     #include <asm/processor.h>
19     
20     /* Exclude everything except the assembly by wrapping it in ".if 0".  */
21     #undef VAL
22     #define VAL(NAME, VALUE)			\
23     void NAME ## _fun (void)			\
24      {						\
25       __asm__ (".endif \n"				\
26     	   #NAME " = %0 \n"			\
27     	   ".if 0\n"				\
28     	   : : "i" (VALUE));			\
29      }
30     
31     #undef OF
32     #define OF(NAME, TYPE, MEMBER)			\
33       VAL (NAME, offsetof (TYPE, MEMBER))
34     
35     /* task_struct offsets.  */
36     OF (LTASK_SIGPENDING, struct task_struct, sigpending)
37     OF (LTASK_NEEDRESCHED, struct task_struct, need_resched)
38     OF (LTASK_PTRACE, struct task_struct, ptrace)
39     OF (LTASK_PID, struct task_struct, pid)
40     
41     /* pt_regs offsets.  */
42     OF (LORIG_R10, struct pt_regs, orig_r10)
43     OF (LR13, struct pt_regs, r13)
44     OF (LR12, struct pt_regs, r12)
45     OF (LR11, struct pt_regs, r11)
46     OF (LR10, struct pt_regs, r10)
47     OF (LR9, struct pt_regs, r9)
48     OF (LMOF, struct pt_regs, mof)
49     OF (LDCCR, struct pt_regs, dccr)
50     OF (LSRP, struct pt_regs, srp)
51     OF (LIRP, struct pt_regs, irp)
52     
53     /* thread_struct offsets.  */
54     OF (LTHREAD_KSP, struct thread_struct, ksp)
55     OF (LTHREAD_USP, struct thread_struct, usp)
56     OF (LTHREAD_DCCR, struct thread_struct, dccr)
57     
58     /* linux/sched.h values - doesn't have an #ifdef __ASSEMBLY__ for these.  */
59     VAL (LCLONE_VM, CLONE_VM)
60     
61     __asm__ (".endif");
62