1b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0 2b82fef82SJan Beulich /* 3b82fef82SJan Beulich * Generate definitions needed by assembly language modules. 4b82fef82SJan Beulich * This code generates raw asm output which is post-processed to extract 5b82fef82SJan Beulich * and format the required data. 6b82fef82SJan Beulich */ 7b82fef82SJan Beulich #define COMPILE_OFFSETS 8b82fef82SJan Beulich 9b82fef82SJan Beulich #include <linux/crypto.h> 10*35344cf3STaehee Yoo #include <crypto/aria.h> 11b82fef82SJan Beulich #include <linux/sched.h> 12b82fef82SJan Beulich #include <linux/stddef.h> 13b82fef82SJan Beulich #include <linux/hardirq.h> 14b82fef82SJan Beulich #include <linux/suspend.h> 15b82fef82SJan Beulich #include <linux/kbuild.h> 16b82fef82SJan Beulich #include <asm/processor.h> 17b82fef82SJan Beulich #include <asm/thread_info.h> 18b82fef82SJan Beulich #include <asm/sigframe.h> 19b82fef82SJan Beulich #include <asm/bootparam.h> 20b82fef82SJan Beulich #include <asm/suspend.h> 216fd166aaSPeter Zijlstra #include <asm/tlbflush.h> 22527a534cSKirill A. Shutemov #include <asm/tdx.h> 23b82fef82SJan Beulich 24b82fef82SJan Beulich #ifdef CONFIG_XEN 25b82fef82SJan Beulich #include <xen/interface/xen.h> 26b82fef82SJan Beulich #endif 27b82fef82SJan Beulich 289a163ed8SThomas Gleixner #ifdef CONFIG_X86_32 299a163ed8SThomas Gleixner # include "asm-offsets_32.c" 309a163ed8SThomas Gleixner #else 319a163ed8SThomas Gleixner # include "asm-offsets_64.c" 329a163ed8SThomas Gleixner #endif 33b82fef82SJan Beulich 34ad3bc25aSBorislav Petkov static void __used common(void) 35ad3bc25aSBorislav Petkov { 36b82fef82SJan Beulich BLANK(); 370100301bSBrian Gerst OFFSET(TASK_threadsp, task_struct, thread.sp); 38050e9baaSLinus Torvalds #ifdef CONFIG_STACKPROTECTOR 390100301bSBrian Gerst OFFSET(TASK_stack_canary, task_struct, stack_canary); 400100301bSBrian Gerst #endif 410100301bSBrian Gerst 420100301bSBrian Gerst BLANK(); 43b82fef82SJan Beulich OFFSET(pbe_address, pbe, address); 44b82fef82SJan Beulich OFFSET(pbe_orig_address, pbe, orig_address); 45b82fef82SJan Beulich OFFSET(pbe_next, pbe, next); 46b82fef82SJan Beulich 474d178f94SBrian Gerst #if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) 484d178f94SBrian Gerst BLANK(); 498fcb346bSIngo Molnar OFFSET(IA32_SIGCONTEXT_ax, sigcontext_32, ax); 508fcb346bSIngo Molnar OFFSET(IA32_SIGCONTEXT_bx, sigcontext_32, bx); 518fcb346bSIngo Molnar OFFSET(IA32_SIGCONTEXT_cx, sigcontext_32, cx); 528fcb346bSIngo Molnar OFFSET(IA32_SIGCONTEXT_dx, sigcontext_32, dx); 538fcb346bSIngo Molnar OFFSET(IA32_SIGCONTEXT_si, sigcontext_32, si); 548fcb346bSIngo Molnar OFFSET(IA32_SIGCONTEXT_di, sigcontext_32, di); 558fcb346bSIngo Molnar OFFSET(IA32_SIGCONTEXT_bp, sigcontext_32, bp); 568fcb346bSIngo Molnar OFFSET(IA32_SIGCONTEXT_sp, sigcontext_32, sp); 578fcb346bSIngo Molnar OFFSET(IA32_SIGCONTEXT_ip, sigcontext_32, ip); 584d178f94SBrian Gerst 594d178f94SBrian Gerst BLANK(); 604d178f94SBrian Gerst OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe_ia32, uc.uc_mcontext); 614d178f94SBrian Gerst #endif 624d178f94SBrian Gerst 63b82fef82SJan Beulich #ifdef CONFIG_XEN 64b82fef82SJan Beulich BLANK(); 65b82fef82SJan Beulich OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask); 66b82fef82SJan Beulich OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending); 6755aedddbSPeter Zijlstra OFFSET(XEN_vcpu_info_arch_cr2, vcpu_info, arch.cr2); 68b82fef82SJan Beulich #endif 69b82fef82SJan Beulich 70b82fef82SJan Beulich BLANK(); 71527a534cSKirill A. Shutemov OFFSET(TDX_MODULE_rcx, tdx_module_output, rcx); 72527a534cSKirill A. Shutemov OFFSET(TDX_MODULE_rdx, tdx_module_output, rdx); 73527a534cSKirill A. Shutemov OFFSET(TDX_MODULE_r8, tdx_module_output, r8); 74527a534cSKirill A. Shutemov OFFSET(TDX_MODULE_r9, tdx_module_output, r9); 75527a534cSKirill A. Shutemov OFFSET(TDX_MODULE_r10, tdx_module_output, r10); 76527a534cSKirill A. Shutemov OFFSET(TDX_MODULE_r11, tdx_module_output, r11); 77527a534cSKirill A. Shutemov 78527a534cSKirill A. Shutemov BLANK(); 79eb94f1b6SKuppuswamy Sathyanarayanan OFFSET(TDX_HYPERCALL_r10, tdx_hypercall_args, r10); 80eb94f1b6SKuppuswamy Sathyanarayanan OFFSET(TDX_HYPERCALL_r11, tdx_hypercall_args, r11); 81eb94f1b6SKuppuswamy Sathyanarayanan OFFSET(TDX_HYPERCALL_r12, tdx_hypercall_args, r12); 82eb94f1b6SKuppuswamy Sathyanarayanan OFFSET(TDX_HYPERCALL_r13, tdx_hypercall_args, r13); 83eb94f1b6SKuppuswamy Sathyanarayanan OFFSET(TDX_HYPERCALL_r14, tdx_hypercall_args, r14); 84eb94f1b6SKuppuswamy Sathyanarayanan OFFSET(TDX_HYPERCALL_r15, tdx_hypercall_args, r15); 85eb94f1b6SKuppuswamy Sathyanarayanan 86eb94f1b6SKuppuswamy Sathyanarayanan BLANK(); 87b82fef82SJan Beulich OFFSET(BP_scratch, boot_params, scratch); 88de8cb458SDavid Howells OFFSET(BP_secure_boot, boot_params, secure_boot); 89b82fef82SJan Beulich OFFSET(BP_loadflags, boot_params, hdr.loadflags); 90b82fef82SJan Beulich OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch); 91b82fef82SJan Beulich OFFSET(BP_version, boot_params, hdr.version); 92b82fef82SJan Beulich OFFSET(BP_kernel_alignment, boot_params, hdr.kernel_alignment); 93974f221cSYinghai Lu OFFSET(BP_init_size, boot_params, hdr.init_size); 94291f3632SMatt Fleming OFFSET(BP_pref_address, boot_params, hdr.pref_address); 956783eaa2SAl Viro 966783eaa2SAl Viro BLANK(); 976783eaa2SAl Viro DEFINE(PTREGS_SIZE, sizeof(struct pt_regs)); 981a79797bSAndy Lutomirski 996fd166aaSPeter Zijlstra /* TLB state for the entry code */ 1006fd166aaSPeter Zijlstra OFFSET(TLB_STATE_user_pcid_flush_mask, tlb_state, user_pcid_flush_mask); 1016fd166aaSPeter Zijlstra 10272f5e08dSAndy Lutomirski /* Layout info for cpu_entry_area */ 1034fe2d8b1SDave Hansen OFFSET(CPU_ENTRY_AREA_entry_stack, cpu_entry_area, entry_stack_page); 1044fe2d8b1SDave Hansen DEFINE(SIZEOF_entry_stack, sizeof(struct entry_stack)); 10545d7b255SJoerg Roedel DEFINE(MASK_entry_stack, (~(sizeof(struct entry_stack) - 1))); 1069e97b73fSJoerg Roedel 10798f05b51SAndy Lutomirski /* Offset for fields in tss_struct */ 1089e97b73fSJoerg Roedel OFFSET(TSS_sp0, tss_struct, x86_tss.sp0); 1099e97b73fSJoerg Roedel OFFSET(TSS_sp1, tss_struct, x86_tss.sp1); 11098f05b51SAndy Lutomirski OFFSET(TSS_sp2, tss_struct, x86_tss.sp2); 111c063a217SThomas Gleixner OFFSET(X86_top_of_stack, pcpu_hot, top_of_stack); 1125d821386SThomas Gleixner #ifdef CONFIG_CALL_DEPTH_TRACKING 1135d821386SThomas Gleixner OFFSET(X86_call_depth, pcpu_hot, call_depth); 1145d821386SThomas Gleixner #endif 115*35344cf3STaehee Yoo #if IS_ENABLED(CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64) 116*35344cf3STaehee Yoo /* Offset for fields in aria_ctx */ 117*35344cf3STaehee Yoo BLANK(); 118*35344cf3STaehee Yoo OFFSET(ARIA_CTX_enc_key, aria_ctx, enc_key); 119*35344cf3STaehee Yoo OFFSET(ARIA_CTX_dec_key, aria_ctx, dec_key); 120*35344cf3STaehee Yoo OFFSET(ARIA_CTX_rounds, aria_ctx, rounds); 121*35344cf3STaehee Yoo #endif 122c063a217SThomas Gleixner 123b82fef82SJan Beulich } 124