blob: a7c2947b39661507e8cfcefea522519ed6a5ea4c [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 Xu6c2bb982006-05-16 22:09:29 +10007#include <linux/crypto.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07008#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 Fitzhardinge9ce8c2e2007-05-02 19:27:16 +020014#include <asm/pgtable.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <asm/fixmap.h>
16#include <asm/processor.h>
17#include <asm/thread_info.h>
Ingo Molnare6e54942006-06-27 02:53:50 -070018#include <asm/elf.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Jeremy Fitzhardinge64876732007-07-17 18:37:07 -070020#include <xen/interface/xen.h>
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#define DEFINE(sym, val) \
23 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
24
25#define BLANK() asm volatile("\n->" : : )
26
27#define OFFSET(sym, str, mem) \
28 DEFINE(sym, offsetof(struct str, mem));
29
Adrian Bunk27142212007-05-02 19:27:08 +020030/* workaround for a warning with -Wmissing-prototypes */
31void foo(void);
32
Linus Torvalds1da177e2005-04-16 15:20:36 -070033void foo(void)
34{
35 OFFSET(SIGCONTEXT_eax, sigcontext, eax);
36 OFFSET(SIGCONTEXT_ebx, sigcontext, ebx);
37 OFFSET(SIGCONTEXT_ecx, sigcontext, ecx);
38 OFFSET(SIGCONTEXT_edx, sigcontext, edx);
39 OFFSET(SIGCONTEXT_esi, sigcontext, esi);
40 OFFSET(SIGCONTEXT_edi, sigcontext, edi);
41 OFFSET(SIGCONTEXT_ebp, sigcontext, ebp);
42 OFFSET(SIGCONTEXT_esp, sigcontext, esp);
43 OFFSET(SIGCONTEXT_eip, sigcontext, eip);
44 BLANK();
45
46 OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
47 OFFSET(CPUINFO_x86_vendor, cpuinfo_x86, x86_vendor);
48 OFFSET(CPUINFO_x86_model, cpuinfo_x86, x86_model);
49 OFFSET(CPUINFO_x86_mask, cpuinfo_x86, x86_mask);
50 OFFSET(CPUINFO_hard_math, cpuinfo_x86, hard_math);
51 OFFSET(CPUINFO_cpuid_level, cpuinfo_x86, cpuid_level);
52 OFFSET(CPUINFO_x86_capability, cpuinfo_x86, x86_capability);
53 OFFSET(CPUINFO_x86_vendor_id, cpuinfo_x86, x86_vendor_id);
54 BLANK();
55
56 OFFSET(TI_task, thread_info, task);
57 OFFSET(TI_exec_domain, thread_info, exec_domain);
58 OFFSET(TI_flags, thread_info, flags);
59 OFFSET(TI_status, thread_info, status);
Linus Torvalds1da177e2005-04-16 15:20:36 -070060 OFFSET(TI_preempt_count, thread_info, preempt_count);
61 OFFSET(TI_addr_limit, thread_info, addr_limit);
62 OFFSET(TI_restart_block, thread_info, restart_block);
Ingo Molnare6e54942006-06-27 02:53:50 -070063 OFFSET(TI_sysenter_return, thread_info, sysenter_return);
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 BLANK();
65
Stas Sergeevbe44d2a2006-12-07 02:14:01 +010066 OFFSET(GDS_size, Xgt_desc_struct, size);
67 OFFSET(GDS_address, Xgt_desc_struct, address);
68 OFFSET(GDS_pad, Xgt_desc_struct, pad);
69 BLANK();
70
Jeremy Fitzhardingeeb5b7b92006-12-07 02:14:02 +010071 OFFSET(PT_EBX, pt_regs, ebx);
72 OFFSET(PT_ECX, pt_regs, ecx);
73 OFFSET(PT_EDX, pt_regs, edx);
74 OFFSET(PT_ESI, pt_regs, esi);
75 OFFSET(PT_EDI, pt_regs, edi);
76 OFFSET(PT_EBP, pt_regs, ebp);
77 OFFSET(PT_EAX, pt_regs, eax);
78 OFFSET(PT_DS, pt_regs, xds);
79 OFFSET(PT_ES, pt_regs, xes);
Jeremy Fitzhardinge464d1a72007-02-13 13:26:20 +010080 OFFSET(PT_FS, pt_regs, xfs);
Jeremy Fitzhardingeeb5b7b92006-12-07 02:14:02 +010081 OFFSET(PT_ORIG_EAX, pt_regs, orig_eax);
82 OFFSET(PT_EIP, pt_regs, eip);
83 OFFSET(PT_CS, pt_regs, xcs);
84 OFFSET(PT_EFLAGS, pt_regs, eflags);
85 OFFSET(PT_OLDESP, pt_regs, esp);
86 OFFSET(PT_OLDSS, pt_regs, xss);
87 BLANK();
88
Linus Torvalds1da177e2005-04-16 15:20:36 -070089 OFFSET(EXEC_DOMAIN_handler, exec_domain, handler);
90 OFFSET(RT_SIGFRAME_sigcontext, rt_sigframe, uc.uc_mcontext);
91 BLANK();
92
93 OFFSET(pbe_address, pbe, address);
94 OFFSET(pbe_orig_address, pbe, orig_address);
95 OFFSET(pbe_next, pbe, next);
96
97 /* Offset from the sysenter stack to tss.esp0 */
Rusty Russella75c54f2007-05-02 19:27:13 +020098 DEFINE(TSS_sysenter_esp0, offsetof(struct tss_struct, x86_tss.esp0) -
Linus Torvalds1da177e2005-04-16 15:20:36 -070099 sizeof(struct tss_struct));
100
101 DEFINE(PAGE_SIZE_asm, PAGE_SIZE);
Jeremy Fitzhardinge9ce8c2e2007-05-02 19:27:16 +0200102 DEFINE(PAGE_SHIFT_asm, PAGE_SHIFT);
103 DEFINE(PTRS_PER_PTE, PTRS_PER_PTE);
104 DEFINE(PTRS_PER_PMD, PTRS_PER_PMD);
105 DEFINE(PTRS_PER_PGD, PTRS_PER_PGD);
106
Andrew Morton1b523fb2007-05-02 19:27:09 +0200107 DEFINE(VDSO_PRELINK_asm, VDSO_PRELINK);
Herbert Xu6c2bb982006-05-16 22:09:29 +1000108
109 OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx);
Jeremy Fitzhardingeb2938f82006-12-07 02:14:03 +0100110
Rusty Russelld3561b72006-12-07 02:14:07 +0100111#ifdef CONFIG_PARAVIRT
112 BLANK();
113 OFFSET(PARAVIRT_enabled, paravirt_ops, paravirt_enabled);
114 OFFSET(PARAVIRT_irq_disable, paravirt_ops, irq_disable);
115 OFFSET(PARAVIRT_irq_enable, paravirt_ops, irq_enable);
116 OFFSET(PARAVIRT_irq_enable_sysexit, paravirt_ops, irq_enable_sysexit);
117 OFFSET(PARAVIRT_iret, paravirt_ops, iret);
118 OFFSET(PARAVIRT_read_cr0, paravirt_ops, read_cr0);
119#endif
Jeremy Fitzhardinge64876732007-07-17 18:37:07 -0700120
121#ifdef CONFIG_XEN
122 BLANK();
123 OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
124 OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
125#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126}