| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |  | 
| Herbert Xu | 6c2bb98 | 2006-05-16 22:09:29 +1000 | [diff] [blame] | 7 | #include <linux/crypto.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | #include <linux/sched.h> | 
|  | 9 | #include <linux/signal.h> | 
|  | 10 | #include <linux/personality.h> | 
|  | 11 | #include <linux/suspend.h> | 
|  | 12 | #include <asm/ucontext.h> | 
|  | 13 | #include "sigframe.h" | 
| Jeremy Fitzhardinge | 9ce8c2e | 2007-05-02 19:27:16 +0200 | [diff] [blame] | 14 | #include <asm/pgtable.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <asm/fixmap.h> | 
|  | 16 | #include <asm/processor.h> | 
|  | 17 | #include <asm/thread_info.h> | 
| Ingo Molnar | e6e5494 | 2006-06-27 02:53:50 -0700 | [diff] [blame] | 18 | #include <asm/elf.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 19 |  | 
|  | 20 | #define DEFINE(sym, val) \ | 
|  | 21 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) | 
|  | 22 |  | 
|  | 23 | #define BLANK() asm volatile("\n->" : : ) | 
|  | 24 |  | 
|  | 25 | #define OFFSET(sym, str, mem) \ | 
|  | 26 | DEFINE(sym, offsetof(struct str, mem)); | 
|  | 27 |  | 
| Adrian Bunk | 2714221 | 2007-05-02 19:27:08 +0200 | [diff] [blame] | 28 | /* workaround for a warning with -Wmissing-prototypes */ | 
|  | 29 | void foo(void); | 
|  | 30 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | void foo(void) | 
|  | 32 | { | 
|  | 33 | OFFSET(SIGCONTEXT_eax, sigcontext, eax); | 
|  | 34 | OFFSET(SIGCONTEXT_ebx, sigcontext, ebx); | 
|  | 35 | OFFSET(SIGCONTEXT_ecx, sigcontext, ecx); | 
|  | 36 | OFFSET(SIGCONTEXT_edx, sigcontext, edx); | 
|  | 37 | OFFSET(SIGCONTEXT_esi, sigcontext, esi); | 
|  | 38 | OFFSET(SIGCONTEXT_edi, sigcontext, edi); | 
|  | 39 | OFFSET(SIGCONTEXT_ebp, sigcontext, ebp); | 
|  | 40 | OFFSET(SIGCONTEXT_esp, sigcontext, esp); | 
|  | 41 | OFFSET(SIGCONTEXT_eip, sigcontext, eip); | 
|  | 42 | BLANK(); | 
|  | 43 |  | 
|  | 44 | OFFSET(CPUINFO_x86, cpuinfo_x86, x86); | 
|  | 45 | OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor); | 
|  | 46 | OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model); | 
|  | 47 | OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask); | 
|  | 48 | OFFSET(CPUINFO_hard_math, cpuinfo_x86, hard_math); | 
|  | 49 | OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level); | 
|  | 50 | OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability); | 
|  | 51 | OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id); | 
|  | 52 | BLANK(); | 
|  | 53 |  | 
|  | 54 | OFFSET(TI_task, thread_info, task); | 
|  | 55 | OFFSET(TI_exec_domain, thread_info, exec_domain); | 
|  | 56 | OFFSET(TI_flags, thread_info, flags); | 
|  | 57 | OFFSET(TI_status, thread_info, status); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | OFFSET(TI_preempt_count, thread_info, preempt_count); | 
|  | 59 | OFFSET(TI_addr_limit, thread_info, addr_limit); | 
|  | 60 | OFFSET(TI_restart_block, thread_info, restart_block); | 
| Ingo Molnar | e6e5494 | 2006-06-27 02:53:50 -0700 | [diff] [blame] | 61 | OFFSET(TI_sysenter_return, thread_info, sysenter_return); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | BLANK(); | 
|  | 63 |  | 
| Stas Sergeev | be44d2a | 2006-12-07 02:14:01 +0100 | [diff] [blame] | 64 | OFFSET(GDS_size, Xgt_desc_struct, size); | 
|  | 65 | OFFSET(GDS_address, Xgt_desc_struct, address); | 
|  | 66 | OFFSET(GDS_pad, Xgt_desc_struct, pad); | 
|  | 67 | BLANK(); | 
|  | 68 |  | 
| Jeremy Fitzhardinge | eb5b7b9 | 2006-12-07 02:14:02 +0100 | [diff] [blame] | 69 | OFFSET(PT_EBX, pt_regs, ebx); | 
|  | 70 | OFFSET(PT_ECX, pt_regs, ecx); | 
|  | 71 | OFFSET(PT_EDX, pt_regs, edx); | 
|  | 72 | OFFSET(PT_ESI, pt_regs, esi); | 
|  | 73 | OFFSET(PT_EDI, pt_regs, edi); | 
|  | 74 | OFFSET(PT_EBP, pt_regs, ebp); | 
|  | 75 | OFFSET(PT_EAX, pt_regs, eax); | 
|  | 76 | OFFSET(PT_DS,  pt_regs, xds); | 
|  | 77 | OFFSET(PT_ES,  pt_regs, xes); | 
| Jeremy Fitzhardinge | 464d1a7 | 2007-02-13 13:26:20 +0100 | [diff] [blame] | 78 | OFFSET(PT_FS,  pt_regs, xfs); | 
| Jeremy Fitzhardinge | eb5b7b9 | 2006-12-07 02:14:02 +0100 | [diff] [blame] | 79 | OFFSET(PT_ORIG_EAX, pt_regs, orig_eax); | 
|  | 80 | OFFSET(PT_EIP, pt_regs, eip); | 
|  | 81 | OFFSET(PT_CS,  pt_regs, xcs); | 
|  | 82 | OFFSET(PT_EFLAGS, pt_regs, eflags); | 
|  | 83 | OFFSET(PT_OLDESP, pt_regs, esp); | 
|  | 84 | OFFSET(PT_OLDSS,  pt_regs, xss); | 
|  | 85 | BLANK(); | 
|  | 86 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | OFFSET(EXEC_DOMAIN_handler, exec_domain, handler); | 
|  | 88 | OFFSET(RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext); | 
|  | 89 | BLANK(); | 
|  | 90 |  | 
|  | 91 | OFFSET(pbe_address, pbe, address); | 
|  | 92 | OFFSET(pbe_orig_address, pbe, orig_address); | 
|  | 93 | OFFSET(pbe_next, pbe, next); | 
|  | 94 |  | 
|  | 95 | /* Offset from the sysenter stack to tss.esp0 */ | 
| Rusty Russell | a75c54f | 2007-05-02 19:27:13 +0200 | [diff] [blame] | 96 | DEFINE(TSS_sysenter_esp0, offsetof(struct tss_struct, x86_tss.esp0) - | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | sizeof(struct tss_struct)); | 
|  | 98 |  | 
|  | 99 | DEFINE(PAGE_SIZE_asm, PAGE_SIZE); | 
| Jeremy Fitzhardinge | 9ce8c2e | 2007-05-02 19:27:16 +0200 | [diff] [blame] | 100 | DEFINE(PAGE_SHIFT_asm, PAGE_SHIFT); | 
|  | 101 | DEFINE(PTRS_PER_PTE, PTRS_PER_PTE); | 
|  | 102 | DEFINE(PTRS_PER_PMD, PTRS_PER_PMD); | 
|  | 103 | DEFINE(PTRS_PER_PGD, PTRS_PER_PGD); | 
|  | 104 |  | 
| Andrew Morton | 1b523fb | 2007-05-02 19:27:09 +0200 | [diff] [blame] | 105 | DEFINE(VDSO_PRELINK_asm, VDSO_PRELINK); | 
| Herbert Xu | 6c2bb98 | 2006-05-16 22:09:29 +1000 | [diff] [blame] | 106 |  | 
|  | 107 | OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx); | 
| Jeremy Fitzhardinge | b2938f8 | 2006-12-07 02:14:03 +0100 | [diff] [blame] | 108 |  | 
| Rusty Russell | d3561b7 | 2006-12-07 02:14:07 +0100 | [diff] [blame] | 109 | #ifdef CONFIG_PARAVIRT | 
|  | 110 | BLANK(); | 
|  | 111 | OFFSET(PARAVIRT_enabled, paravirt_ops, paravirt_enabled); | 
|  | 112 | OFFSET(PARAVIRT_irq_disable, paravirt_ops, irq_disable); | 
|  | 113 | OFFSET(PARAVIRT_irq_enable, paravirt_ops, irq_enable); | 
|  | 114 | OFFSET(PARAVIRT_irq_enable_sysexit, paravirt_ops, irq_enable_sysexit); | 
|  | 115 | OFFSET(PARAVIRT_iret, paravirt_ops, iret); | 
|  | 116 | OFFSET(PARAVIRT_read_cr0, paravirt_ops, read_cr0); | 
|  | 117 | #endif | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | } |