diff options
author | David Howells <dhowells@redhat.com> | 2006-07-10 07:44:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-07-10 16:24:22 -0400 |
commit | 84e8cd6dbc00b4979e8d1c15c80d91987aeb3417 (patch) | |
tree | 5df8103b5e6d414bc39e165655ae8bd5341abd76 /arch/frv/kernel/asm-offsets.c | |
parent | 6d8c4e3b0150ff537902477ed62f8a8e9e70007b (diff) |
[PATCH] FRV: Introduce asm-offsets for FRV arch
Introduce the use of asm-offsets into the FRV architecture.
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/frv/kernel/asm-offsets.c')
-rw-r--r-- | arch/frv/kernel/asm-offsets.c | 116 |
1 files changed, 115 insertions, 1 deletions
diff --git a/arch/frv/kernel/asm-offsets.c b/arch/frv/kernel/asm-offsets.c index 9e263112a6e2..fbb19fc1af40 100644 --- a/arch/frv/kernel/asm-offsets.c +++ b/arch/frv/kernel/asm-offsets.c | |||
@@ -1 +1,115 @@ | |||
1 | /* Dummy asm-offsets.c file. Required by kbuild and ready to be used - hint! */ | 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/registers.h> | ||
11 | #include <asm/ucontext.h> | ||
12 | #include <asm/processor.h> | ||
13 | #include <asm/thread_info.h> | ||
14 | #include <asm/gdb-stub.h> | ||
15 | |||
16 | #define DEFINE(sym, val) \ | ||
17 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) | ||
18 | |||
19 | #define DEF_PTREG(sym, reg) \ | ||
20 | asm volatile("\n->" #sym " %0 offsetof(struct pt_regs, " #reg ")" \ | ||
21 | : : "i" (offsetof(struct pt_regs, reg))) | ||
22 | |||
23 | #define DEF_IREG(sym, reg) \ | ||
24 | asm volatile("\n->" #sym " %0 offsetof(struct user_context, " #reg ")" \ | ||
25 | : : "i" (offsetof(struct user_context, reg))) | ||
26 | |||
27 | #define DEF_FREG(sym, reg) \ | ||
28 | asm volatile("\n->" #sym " %0 offsetof(struct user_context, " #reg ")" \ | ||
29 | : : "i" (offsetof(struct user_context, reg))) | ||
30 | |||
31 | #define DEF_0REG(sym, reg) \ | ||
32 | asm volatile("\n->" #sym " %0 offsetof(struct frv_frame0, " #reg ")" \ | ||
33 | : : "i" (offsetof(struct frv_frame0, reg))) | ||
34 | |||
35 | #define BLANK() asm volatile("\n->" : : ) | ||
36 | |||
37 | #define OFFSET(sym, str, mem) \ | ||
38 | DEFINE(sym, offsetof(struct str, mem)); | ||
39 | |||
40 | void foo(void) | ||
41 | { | ||
42 | /* offsets into the thread_info structure */ | ||
43 | OFFSET(TI_TASK, thread_info, task); | ||
44 | OFFSET(TI_EXEC_DOMAIN, thread_info, exec_domain); | ||
45 | OFFSET(TI_FLAGS, thread_info, flags); | ||
46 | OFFSET(TI_STATUS, thread_info, status); | ||
47 | OFFSET(TI_CPU, thread_info, cpu); | ||
48 | OFFSET(TI_PREEMPT_COUNT, thread_info, preempt_count); | ||
49 | OFFSET(TI_ADDR_LIMIT, thread_info, addr_limit); | ||
50 | OFFSET(TI_RESTART_BLOCK, thread_info, restart_block); | ||
51 | BLANK(); | ||
52 | |||
53 | /* offsets into register file storage */ | ||
54 | DEF_PTREG(REG_PSR, psr); | ||
55 | DEF_PTREG(REG_ISR, isr); | ||
56 | DEF_PTREG(REG_CCR, ccr); | ||
57 | DEF_PTREG(REG_CCCR, cccr); | ||
58 | DEF_PTREG(REG_LR, lr); | ||
59 | DEF_PTREG(REG_LCR, lcr); | ||
60 | DEF_PTREG(REG_PC, pc); | ||
61 | DEF_PTREG(REG__STATUS, __status); | ||
62 | DEF_PTREG(REG_SYSCALLNO, syscallno); | ||
63 | DEF_PTREG(REG_ORIG_GR8, orig_gr8); | ||
64 | DEF_PTREG(REG_GNER0, gner0); | ||
65 | DEF_PTREG(REG_GNER1, gner1); | ||
66 | DEF_PTREG(REG_IACC0, iacc0); | ||
67 | DEF_PTREG(REG_TBR, tbr); | ||
68 | DEF_PTREG(REG_GR0, tbr); | ||
69 | DEFINE(REG__END, sizeof(struct pt_regs)); | ||
70 | BLANK(); | ||
71 | |||
72 | DEF_0REG(REG_DCR, debug.dcr); | ||
73 | DEF_0REG(REG_IBAR0, debug.ibar[0]); | ||
74 | DEF_0REG(REG_DBAR0, debug.dbar[0]); | ||
75 | DEF_0REG(REG_DBDR00, debug.dbdr[0][0]); | ||
76 | DEF_0REG(REG_DBMR00, debug.dbmr[0][0]); | ||
77 | BLANK(); | ||
78 | |||
79 | DEF_IREG(__INT_GR0, i.gr[0]); | ||
80 | DEF_FREG(__USER_FPMEDIA, f); | ||
81 | DEF_FREG(__FPMEDIA_FR0, f.fr[0]); | ||
82 | DEF_FREG(__FPMEDIA_FNER0, f.fner[0]); | ||
83 | DEF_FREG(__FPMEDIA_MSR0, f.msr[0]); | ||
84 | DEF_FREG(__FPMEDIA_ACC0, f.acc[0]); | ||
85 | DEF_FREG(__FPMEDIA_ACCG0, f.accg[0]); | ||
86 | DEF_FREG(__FPMEDIA_FSR0, f.fsr[0]); | ||
87 | BLANK(); | ||
88 | |||
89 | DEFINE(NR_PT_REGS, sizeof(struct pt_regs) / 4); | ||
90 | DEFINE(NR_USER_INT_REGS, sizeof(struct user_int_regs) / 4); | ||
91 | DEFINE(NR_USER_FPMEDIA_REGS, sizeof(struct user_fpmedia_regs) / 4); | ||
92 | DEFINE(NR_USER_CONTEXT, sizeof(struct user_context) / 4); | ||
93 | DEFINE(FRV_FRAME0_SIZE, sizeof(struct frv_frame0)); | ||
94 | BLANK(); | ||
95 | |||
96 | /* offsets into thread_struct */ | ||
97 | OFFSET(__THREAD_FRAME, thread_struct, frame); | ||
98 | OFFSET(__THREAD_CURR, thread_struct, curr); | ||
99 | OFFSET(__THREAD_SP, thread_struct, sp); | ||
100 | OFFSET(__THREAD_FP, thread_struct, fp); | ||
101 | OFFSET(__THREAD_LR, thread_struct, lr); | ||
102 | OFFSET(__THREAD_PC, thread_struct, pc); | ||
103 | OFFSET(__THREAD_GR16, thread_struct, gr[0]); | ||
104 | OFFSET(__THREAD_SCHED_LR, thread_struct, sched_lr); | ||
105 | OFFSET(__THREAD_FRAME0, thread_struct, frame0); | ||
106 | OFFSET(__THREAD_USER, thread_struct, user); | ||
107 | BLANK(); | ||
108 | |||
109 | /* offsets into frv_debug_status */ | ||
110 | OFFSET(DEBUG_BPSR, frv_debug_status, bpsr); | ||
111 | OFFSET(DEBUG_DCR, frv_debug_status, dcr); | ||
112 | OFFSET(DEBUG_BRR, frv_debug_status, brr); | ||
113 | OFFSET(DEBUG_NMAR, frv_debug_status, nmar); | ||
114 | BLANK(); | ||
115 | } | ||