]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - arch/frv/kernel/asm-offsets.c
Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux...
[karo-tx-linux.git] / arch / frv / kernel / asm-offsets.c
1 /*
2  * Generate definitions needed by assembly language modules.
3  * This code generates raw asm output which is post-processed
4  * to extract and format the required data.
5  */
6
7 #include <linux/sched.h>
8 #include <linux/signal.h>
9 #include <linux/personality.h>
10 #include <linux/kbuild.h>
11 #include <asm/registers.h>
12 #include <asm/ucontext.h>
13 #include <asm/processor.h>
14 #include <asm/thread_info.h>
15 #include <asm/gdb-stub.h>
16
17 #define DEF_PTREG(sym, reg) \
18         asm volatile("\n->" #sym " %0 offsetof(struct pt_regs, " #reg ")" \
19                      : : "i" (offsetof(struct pt_regs, reg)))
20
21 #define DEF_IREG(sym, reg) \
22         asm volatile("\n->" #sym " %0 offsetof(struct user_context, " #reg ")" \
23                      : : "i" (offsetof(struct user_context, reg)))
24
25 #define DEF_FREG(sym, reg) \
26         asm volatile("\n->" #sym " %0 offsetof(struct user_context, " #reg ")" \
27                      : : "i" (offsetof(struct user_context, reg)))
28
29 #define DEF_0REG(sym, reg) \
30         asm volatile("\n->" #sym " %0 offsetof(struct frv_frame0, " #reg ")" \
31                      : : "i" (offsetof(struct frv_frame0, reg)))
32
33 void foo(void)
34 {
35         /* offsets into the thread_info structure */
36         OFFSET(TI_TASK,                 thread_info, task);
37         OFFSET(TI_EXEC_DOMAIN,          thread_info, exec_domain);
38         OFFSET(TI_FLAGS,                thread_info, flags);
39         OFFSET(TI_STATUS,               thread_info, status);
40         OFFSET(TI_CPU,                  thread_info, cpu);
41         OFFSET(TI_PREEMPT_COUNT,        thread_info, preempt_count);
42         OFFSET(TI_ADDR_LIMIT,           thread_info, addr_limit);
43         BLANK();
44
45         /* offsets into register file storage */
46         DEF_PTREG(REG_PSR,              psr);
47         DEF_PTREG(REG_ISR,              isr);
48         DEF_PTREG(REG_CCR,              ccr);
49         DEF_PTREG(REG_CCCR,             cccr);
50         DEF_PTREG(REG_LR,               lr);
51         DEF_PTREG(REG_LCR,              lcr);
52         DEF_PTREG(REG_PC,               pc);
53         DEF_PTREG(REG__STATUS,          __status);
54         DEF_PTREG(REG_SYSCALLNO,        syscallno);
55         DEF_PTREG(REG_ORIG_GR8,         orig_gr8);
56         DEF_PTREG(REG_GNER0,            gner0);
57         DEF_PTREG(REG_GNER1,            gner1);
58         DEF_PTREG(REG_IACC0,            iacc0);
59         DEF_PTREG(REG_TBR,              tbr);
60         DEF_PTREG(REG_GR0,              tbr);
61         DEFINE(REG__END,                sizeof(struct pt_regs));
62         BLANK();
63
64         DEF_0REG(REG_DCR,               debug.dcr);
65         DEF_0REG(REG_IBAR0,             debug.ibar[0]);
66         DEF_0REG(REG_DBAR0,             debug.dbar[0]);
67         DEF_0REG(REG_DBDR00,            debug.dbdr[0][0]);
68         DEF_0REG(REG_DBMR00,            debug.dbmr[0][0]);
69         BLANK();
70
71         DEF_IREG(__INT_GR0,             i.gr[0]);
72         DEF_FREG(__USER_FPMEDIA,        f);
73         DEF_FREG(__FPMEDIA_FR0,         f.fr[0]);
74         DEF_FREG(__FPMEDIA_FNER0,       f.fner[0]);
75         DEF_FREG(__FPMEDIA_MSR0,        f.msr[0]);
76         DEF_FREG(__FPMEDIA_ACC0,        f.acc[0]);
77         DEF_FREG(__FPMEDIA_ACCG0,       f.accg[0]);
78         DEF_FREG(__FPMEDIA_FSR0,        f.fsr[0]);
79         BLANK();
80
81         DEFINE(NR_PT_REGS,              sizeof(struct pt_regs) / 4);
82         DEFINE(NR_USER_INT_REGS,        sizeof(struct user_int_regs) / 4);
83         DEFINE(NR_USER_FPMEDIA_REGS,    sizeof(struct user_fpmedia_regs) / 4);
84         DEFINE(NR_USER_CONTEXT,         sizeof(struct user_context) / 4);
85         DEFINE(FRV_FRAME0_SIZE,         sizeof(struct frv_frame0));
86         BLANK();
87
88         /* offsets into thread_struct */
89         OFFSET(__THREAD_FRAME,          thread_struct, frame);
90         OFFSET(__THREAD_CURR,           thread_struct, curr);
91         OFFSET(__THREAD_SP,             thread_struct, sp);
92         OFFSET(__THREAD_FP,             thread_struct, fp);
93         OFFSET(__THREAD_LR,             thread_struct, lr);
94         OFFSET(__THREAD_PC,             thread_struct, pc);
95         OFFSET(__THREAD_GR16,           thread_struct, gr[0]);
96         OFFSET(__THREAD_SCHED_LR,       thread_struct, sched_lr);
97         OFFSET(__THREAD_FRAME0,         thread_struct, frame0);
98         OFFSET(__THREAD_USER,           thread_struct, user);
99         BLANK();
100
101         /* offsets into frv_debug_status */
102         OFFSET(DEBUG_BPSR,              frv_debug_status, bpsr);
103         OFFSET(DEBUG_DCR,               frv_debug_status, dcr);
104         OFFSET(DEBUG_BRR,               frv_debug_status, brr);
105         OFFSET(DEBUG_NMAR,              frv_debug_status, nmar);
106         BLANK();
107 }