Merge tag 'pstore-v4.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/kees...
[sfrench/cifs-2.6.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) OFFSET(sym, pt_regs, reg)
18 #define DEF_IREG(sym, reg) OFFSET(sym, user_context, reg)
19 #define DEF_FREG(sym, reg) OFFSET(sym, user_context, reg)
20 #define DEF_0REG(sym, reg) OFFSET(sym, frv_frame0, reg)
21
22 void foo(void)
23 {
24         /* offsets into the thread_info structure */
25         OFFSET(TI_TASK,                 thread_info, task);
26         OFFSET(TI_FLAGS,                thread_info, flags);
27         OFFSET(TI_STATUS,               thread_info, status);
28         OFFSET(TI_CPU,                  thread_info, cpu);
29         OFFSET(TI_PREEMPT_COUNT,        thread_info, preempt_count);
30         OFFSET(TI_ADDR_LIMIT,           thread_info, addr_limit);
31         BLANK();
32
33         /* offsets into register file storage */
34         DEF_PTREG(REG_PSR,              psr);
35         DEF_PTREG(REG_ISR,              isr);
36         DEF_PTREG(REG_CCR,              ccr);
37         DEF_PTREG(REG_CCCR,             cccr);
38         DEF_PTREG(REG_LR,               lr);
39         DEF_PTREG(REG_LCR,              lcr);
40         DEF_PTREG(REG_PC,               pc);
41         DEF_PTREG(REG__STATUS,          __status);
42         DEF_PTREG(REG_SYSCALLNO,        syscallno);
43         DEF_PTREG(REG_ORIG_GR8,         orig_gr8);
44         DEF_PTREG(REG_GNER0,            gner0);
45         DEF_PTREG(REG_GNER1,            gner1);
46         DEF_PTREG(REG_IACC0,            iacc0);
47         DEF_PTREG(REG_TBR,              tbr);
48         DEF_PTREG(REG_GR0,              tbr);
49         DEFINE(REG__END,                sizeof(struct pt_regs));
50         BLANK();
51
52         DEF_0REG(REG_DCR,               debug.dcr);
53         DEF_0REG(REG_IBAR0,             debug.ibar[0]);
54         DEF_0REG(REG_DBAR0,             debug.dbar[0]);
55         DEF_0REG(REG_DBDR00,            debug.dbdr[0][0]);
56         DEF_0REG(REG_DBMR00,            debug.dbmr[0][0]);
57         BLANK();
58
59         DEF_IREG(__INT_GR0,             i.gr[0]);
60         DEF_FREG(__USER_FPMEDIA,        f);
61         DEF_FREG(__FPMEDIA_FR0,         f.fr[0]);
62         DEF_FREG(__FPMEDIA_FNER0,       f.fner[0]);
63         DEF_FREG(__FPMEDIA_MSR0,        f.msr[0]);
64         DEF_FREG(__FPMEDIA_ACC0,        f.acc[0]);
65         DEF_FREG(__FPMEDIA_ACCG0,       f.accg[0]);
66         DEF_FREG(__FPMEDIA_FSR0,        f.fsr[0]);
67         BLANK();
68
69         DEFINE(NR_PT_REGS,              sizeof(struct pt_regs) / 4);
70         DEFINE(NR_USER_INT_REGS,        sizeof(struct user_int_regs) / 4);
71         DEFINE(NR_USER_FPMEDIA_REGS,    sizeof(struct user_fpmedia_regs) / 4);
72         DEFINE(NR_USER_CONTEXT,         sizeof(struct user_context) / 4);
73         DEFINE(FRV_FRAME0_SIZE,         sizeof(struct frv_frame0));
74         BLANK();
75
76         /* offsets into thread_struct */
77         OFFSET(__THREAD_FRAME,          thread_struct, frame);
78         OFFSET(__THREAD_CURR,           thread_struct, curr);
79         OFFSET(__THREAD_SP,             thread_struct, sp);
80         OFFSET(__THREAD_FP,             thread_struct, fp);
81         OFFSET(__THREAD_LR,             thread_struct, lr);
82         OFFSET(__THREAD_PC,             thread_struct, pc);
83         OFFSET(__THREAD_GR16,           thread_struct, gr[0]);
84         OFFSET(__THREAD_SCHED_LR,       thread_struct, sched_lr);
85         OFFSET(__THREAD_FRAME0,         thread_struct, frame0);
86         OFFSET(__THREAD_USER,           thread_struct, user);
87         BLANK();
88
89         /* offsets into frv_debug_status */
90         OFFSET(DEBUG_BPSR,              frv_debug_status, bpsr);
91         OFFSET(DEBUG_DCR,               frv_debug_status, dcr);
92         OFFSET(DEBUG_BRR,               frv_debug_status, brr);
93         OFFSET(DEBUG_NMAR,              frv_debug_status, nmar);
94         BLANK();
95 }