Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[linux-2.6] / arch / mn10300 / 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 <asm/ucontext.h>
11 #include <asm/processor.h>
12 #include <asm/thread_info.h>
13 #include <asm/ptrace.h>
14 #include "sigframe.h"
15 #include "mn10300-serial.h"
16
17 #define DEFINE(sym, val) \
18         asm volatile("\n->" #sym " %0 " #val : : "i" (val))
19
20 #define BLANK() asm volatile("\n->")
21
22 #define OFFSET(sym, str, mem) \
23         DEFINE(sym, offsetof(struct str, mem));
24
25 void foo(void)
26 {
27         OFFSET(SIGCONTEXT_d0, sigcontext, d0);
28         OFFSET(SIGCONTEXT_d1, sigcontext, d1);
29         BLANK();
30
31         OFFSET(TI_task,                 thread_info, task);
32         OFFSET(TI_exec_domain,          thread_info, exec_domain);
33         OFFSET(TI_flags,                thread_info, flags);
34         OFFSET(TI_cpu,                  thread_info, cpu);
35         OFFSET(TI_preempt_count,        thread_info, preempt_count);
36         OFFSET(TI_addr_limit,           thread_info, addr_limit);
37         OFFSET(TI_restart_block,        thread_info, restart_block);
38         BLANK();
39
40         OFFSET(REG_D0,                  pt_regs, d0);
41         OFFSET(REG_D1,                  pt_regs, d1);
42         OFFSET(REG_D2,                  pt_regs, d2);
43         OFFSET(REG_D3,                  pt_regs, d3);
44         OFFSET(REG_A0,                  pt_regs, a0);
45         OFFSET(REG_A1,                  pt_regs, a1);
46         OFFSET(REG_A2,                  pt_regs, a2);
47         OFFSET(REG_A3,                  pt_regs, a3);
48         OFFSET(REG_E0,                  pt_regs, e0);
49         OFFSET(REG_E1,                  pt_regs, e1);
50         OFFSET(REG_E2,                  pt_regs, e2);
51         OFFSET(REG_E3,                  pt_regs, e3);
52         OFFSET(REG_E4,                  pt_regs, e4);
53         OFFSET(REG_E5,                  pt_regs, e5);
54         OFFSET(REG_E6,                  pt_regs, e6);
55         OFFSET(REG_E7,                  pt_regs, e7);
56         OFFSET(REG_SP,                  pt_regs, sp);
57         OFFSET(REG_EPSW,                pt_regs, epsw);
58         OFFSET(REG_PC,                  pt_regs, pc);
59         OFFSET(REG_LAR,                 pt_regs, lar);
60         OFFSET(REG_LIR,                 pt_regs, lir);
61         OFFSET(REG_MDR,                 pt_regs, mdr);
62         OFFSET(REG_MCVF,                pt_regs, mcvf);
63         OFFSET(REG_MCRL,                pt_regs, mcrl);
64         OFFSET(REG_MCRH,                pt_regs, mcrh);
65         OFFSET(REG_MDRQ,                pt_regs, mdrq);
66         OFFSET(REG_ORIG_D0,             pt_regs, orig_d0);
67         OFFSET(REG_NEXT,                pt_regs, next);
68         DEFINE(REG__END,                sizeof(struct pt_regs));
69         BLANK();
70
71         OFFSET(THREAD_UREGS,            thread_struct, uregs);
72         OFFSET(THREAD_PC,               thread_struct, pc);
73         OFFSET(THREAD_SP,               thread_struct, sp);
74         OFFSET(THREAD_A3,               thread_struct, a3);
75         OFFSET(THREAD_USP,              thread_struct, usp);
76         OFFSET(THREAD_FRAME,            thread_struct, __frame);
77         BLANK();
78
79         DEFINE(CLONE_VM_asm,            CLONE_VM);
80         DEFINE(CLONE_FS_asm,            CLONE_FS);
81         DEFINE(CLONE_FILES_asm,         CLONE_FILES);
82         DEFINE(CLONE_SIGHAND_asm,       CLONE_SIGHAND);
83         DEFINE(CLONE_UNTRACED_asm,      CLONE_UNTRACED);
84         DEFINE(SIGCHLD_asm,             SIGCHLD);
85         BLANK();
86
87         OFFSET(EXEC_DOMAIN_handler,     exec_domain, handler);
88         OFFSET(RT_SIGFRAME_sigcontext,  rt_sigframe, uc.uc_mcontext);
89
90         DEFINE(PAGE_SIZE_asm,           PAGE_SIZE);
91
92         OFFSET(__rx_buffer,             mn10300_serial_port, rx_buffer);
93         OFFSET(__rx_inp,                mn10300_serial_port, rx_inp);
94         OFFSET(__rx_outp,               mn10300_serial_port, rx_outp);
95         OFFSET(__tx_info_buffer,        mn10300_serial_port, uart.info);
96         OFFSET(__tx_xchar,              mn10300_serial_port, tx_xchar);
97         OFFSET(__tx_break,              mn10300_serial_port, tx_break);
98         OFFSET(__intr_flags,            mn10300_serial_port, intr_flags);
99         OFFSET(__rx_icr,                mn10300_serial_port, rx_icr);
100         OFFSET(__tx_icr,                mn10300_serial_port, tx_icr);
101         OFFSET(__tm_icr,                mn10300_serial_port, _tmicr);
102         OFFSET(__iobase,                mn10300_serial_port, _iobase);
103
104         DEFINE(__UART_XMIT_SIZE,        UART_XMIT_SIZE);
105         OFFSET(__xmit_buffer,           uart_info, xmit.buf);
106         OFFSET(__xmit_head,             uart_info, xmit.head);
107         OFFSET(__xmit_tail,             uart_info, xmit.tail);
108 }