Jesper Nilsson | 0365f70 | 2008-10-21 22:10:27 +0200 | [diff] [blame] | 1 | #include <linux/sched.h> |
| 2 | #include <asm/thread_info.h> |
Jesper Nilsson | 0365f70 | 2008-10-21 22:10:27 +0200 | [diff] [blame] | 3 | |
| 4 | /* |
| 5 | * Generate definitions needed by assembly language modules. |
| 6 | * This code generates raw asm output which is post-processed to extract |
| 7 | * and format the required data. |
| 8 | */ |
| 9 | |
| 10 | #define DEFINE(sym, val) \ |
| 11 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) |
| 12 | |
| 13 | #define BLANK() asm volatile("\n->" : : ) |
| 14 | |
| 15 | #if !defined(CONFIG_ETRAX_ARCH_V10) && !defined(CONFIG_ETRAX_ARCH_V32) |
| 16 | #error One of ARCH v10 and ARCH v32 must be true! |
| 17 | #endif |
| 18 | |
| 19 | int main(void) |
| 20 | { |
| 21 | #define ENTRY(entry) DEFINE(PT_ ## entry, offsetof(struct pt_regs, entry)) |
| 22 | ENTRY(orig_r10); |
| 23 | ENTRY(r13); |
| 24 | ENTRY(r12); |
| 25 | ENTRY(r11); |
| 26 | ENTRY(r10); |
| 27 | ENTRY(r9); |
| 28 | #ifdef CONFIG_ETRAX_ARCH_V32 |
| 29 | ENTRY(acr); |
| 30 | ENTRY(srs); |
| 31 | #endif |
| 32 | ENTRY(mof); |
| 33 | #ifdef CONFIG_ETRAX_ARCH_V10 |
| 34 | ENTRY(dccr); |
| 35 | #else |
| 36 | ENTRY(ccs); |
| 37 | #endif |
| 38 | ENTRY(srp); |
| 39 | BLANK(); |
| 40 | #undef ENTRY |
| 41 | #define ENTRY(entry) DEFINE(TI_ ## entry, offsetof(struct thread_info, entry)) |
| 42 | ENTRY(task); |
| 43 | ENTRY(flags); |
| 44 | ENTRY(preempt_count); |
| 45 | BLANK(); |
| 46 | #undef ENTRY |
| 47 | #define ENTRY(entry) DEFINE(THREAD_ ## entry, offsetof(struct thread_struct, entry)) |
| 48 | ENTRY(ksp); |
| 49 | ENTRY(usp); |
| 50 | #ifdef CONFIG_ETRAX_ARCH_V10 |
| 51 | ENTRY(dccr); |
| 52 | #else |
| 53 | ENTRY(ccs); |
| 54 | #endif |
| 55 | BLANK(); |
| 56 | #undef ENTRY |
| 57 | #define ENTRY(entry) DEFINE(TASK_ ## entry, offsetof(struct task_struct, entry)) |
| 58 | ENTRY(pid); |
| 59 | BLANK(); |
| 60 | DEFINE(LCLONE_VM, CLONE_VM); |
| 61 | DEFINE(LCLONE_UNTRACED, CLONE_UNTRACED); |
| 62 | return 0; |
| 63 | } |