xref: /linux/arch/x86/kernel/asm-offsets.c (revision 13d4ea097d18b419ad2a2b696063d44bf59acec0)
1b82fef82SJan Beulich /*
2b82fef82SJan Beulich  * Generate definitions needed by assembly language modules.
3b82fef82SJan Beulich  * This code generates raw asm output which is post-processed to extract
4b82fef82SJan Beulich  * and format the required data.
5b82fef82SJan Beulich  */
6b82fef82SJan Beulich #define COMPILE_OFFSETS
7b82fef82SJan Beulich 
8b82fef82SJan Beulich #include <linux/crypto.h>
9b82fef82SJan Beulich #include <linux/sched.h>
10b82fef82SJan Beulich #include <linux/stddef.h>
11b82fef82SJan Beulich #include <linux/hardirq.h>
12b82fef82SJan Beulich #include <linux/suspend.h>
13b82fef82SJan Beulich #include <linux/kbuild.h>
14b82fef82SJan Beulich #include <asm/processor.h>
15b82fef82SJan Beulich #include <asm/thread_info.h>
16b82fef82SJan Beulich #include <asm/sigframe.h>
17b82fef82SJan Beulich #include <asm/bootparam.h>
18b82fef82SJan Beulich #include <asm/suspend.h>
19b82fef82SJan Beulich 
20b82fef82SJan Beulich #ifdef CONFIG_XEN
21b82fef82SJan Beulich #include <xen/interface/xen.h>
22b82fef82SJan Beulich #endif
23b82fef82SJan Beulich 
249a163ed8SThomas Gleixner #ifdef CONFIG_X86_32
259a163ed8SThomas Gleixner # include "asm-offsets_32.c"
269a163ed8SThomas Gleixner #else
279a163ed8SThomas Gleixner # include "asm-offsets_64.c"
289a163ed8SThomas Gleixner #endif
29b82fef82SJan Beulich 
30b82fef82SJan Beulich void common(void) {
31b82fef82SJan Beulich 	BLANK();
32b82fef82SJan Beulich 	OFFSET(TI_flags, thread_info, flags);
33b82fef82SJan Beulich 	OFFSET(TI_status, thread_info, status);
34*13d4ea09SAndy Lutomirski 
35*13d4ea09SAndy Lutomirski 	BLANK();
36*13d4ea09SAndy Lutomirski 	OFFSET(TASK_addr_limit, task_struct, thread.addr_limit);
37b82fef82SJan Beulich 
38b82fef82SJan Beulich 	BLANK();
39b82fef82SJan Beulich 	OFFSET(crypto_tfm_ctx_offset, crypto_tfm, __crt_ctx);
40b82fef82SJan Beulich 
41b82fef82SJan Beulich 	BLANK();
42b82fef82SJan Beulich 	OFFSET(pbe_address, pbe, address);
43b82fef82SJan Beulich 	OFFSET(pbe_orig_address, pbe, orig_address);
44b82fef82SJan Beulich 	OFFSET(pbe_next, pbe, next);
45b82fef82SJan Beulich 
464d178f94SBrian Gerst #if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
474d178f94SBrian Gerst 	BLANK();
488fcb346bSIngo Molnar 	OFFSET(IA32_SIGCONTEXT_ax, sigcontext_32, ax);
498fcb346bSIngo Molnar 	OFFSET(IA32_SIGCONTEXT_bx, sigcontext_32, bx);
508fcb346bSIngo Molnar 	OFFSET(IA32_SIGCONTEXT_cx, sigcontext_32, cx);
518fcb346bSIngo Molnar 	OFFSET(IA32_SIGCONTEXT_dx, sigcontext_32, dx);
528fcb346bSIngo Molnar 	OFFSET(IA32_SIGCONTEXT_si, sigcontext_32, si);
538fcb346bSIngo Molnar 	OFFSET(IA32_SIGCONTEXT_di, sigcontext_32, di);
548fcb346bSIngo Molnar 	OFFSET(IA32_SIGCONTEXT_bp, sigcontext_32, bp);
558fcb346bSIngo Molnar 	OFFSET(IA32_SIGCONTEXT_sp, sigcontext_32, sp);
568fcb346bSIngo Molnar 	OFFSET(IA32_SIGCONTEXT_ip, sigcontext_32, ip);
574d178f94SBrian Gerst 
584d178f94SBrian Gerst 	BLANK();
594d178f94SBrian Gerst 	OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe_ia32, uc.uc_mcontext);
604d178f94SBrian Gerst #endif
614d178f94SBrian Gerst 
62b82fef82SJan Beulich #ifdef CONFIG_PARAVIRT
63b82fef82SJan Beulich 	BLANK();
64b82fef82SJan Beulich 	OFFSET(PARAVIRT_PATCH_pv_cpu_ops, paravirt_patch_template, pv_cpu_ops);
65b82fef82SJan Beulich 	OFFSET(PARAVIRT_PATCH_pv_irq_ops, paravirt_patch_template, pv_irq_ops);
66b82fef82SJan Beulich 	OFFSET(PV_IRQ_irq_disable, pv_irq_ops, irq_disable);
67b82fef82SJan Beulich 	OFFSET(PV_IRQ_irq_enable, pv_irq_ops, irq_enable);
68b82fef82SJan Beulich 	OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
69b82fef82SJan Beulich 	OFFSET(PV_CPU_read_cr0, pv_cpu_ops, read_cr0);
70b82fef82SJan Beulich 	OFFSET(PV_MMU_read_cr2, pv_mmu_ops, read_cr2);
71b82fef82SJan Beulich #endif
72b82fef82SJan Beulich 
73b82fef82SJan Beulich #ifdef CONFIG_XEN
74b82fef82SJan Beulich 	BLANK();
75b82fef82SJan Beulich 	OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask);
76b82fef82SJan Beulich 	OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending);
77b82fef82SJan Beulich #endif
78b82fef82SJan Beulich 
79b82fef82SJan Beulich 	BLANK();
80b82fef82SJan Beulich 	OFFSET(BP_scratch, boot_params, scratch);
81b82fef82SJan Beulich 	OFFSET(BP_loadflags, boot_params, hdr.loadflags);
82b82fef82SJan Beulich 	OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch);
83b82fef82SJan Beulich 	OFFSET(BP_version, boot_params, hdr.version);
84b82fef82SJan Beulich 	OFFSET(BP_kernel_alignment, boot_params, hdr.kernel_alignment);
85974f221cSYinghai Lu 	OFFSET(BP_init_size, boot_params, hdr.init_size);
86291f3632SMatt Fleming 	OFFSET(BP_pref_address, boot_params, hdr.pref_address);
87291f3632SMatt Fleming 	OFFSET(BP_code32_start, boot_params, hdr.code32_start);
886783eaa2SAl Viro 
896783eaa2SAl Viro 	BLANK();
906783eaa2SAl Viro 	DEFINE(PTREGS_SIZE, sizeof(struct pt_regs));
91b82fef82SJan Beulich }
92