1 // SPDX-License-Identifier: GPL-2.0 2 #ifndef __LINUX_KBUILD_H 3 # error "Please do not build this file directly, build asm-offsets.c instead" 4 #endif 5 6 #include <asm/ia32.h> 7 8 #if defined(CONFIG_KVM_GUEST) && defined(CONFIG_PARAVIRT_SPINLOCKS) 9 #include <asm/kvm_para.h> 10 #endif 11 12 int main(void) 13 { 14 #ifdef CONFIG_PARAVIRT 15 #ifdef CONFIG_PARAVIRT_XXL 16 OFFSET(PV_CPU_usergs_sysret64, paravirt_patch_template, 17 cpu.usergs_sysret64); 18 OFFSET(PV_CPU_swapgs, paravirt_patch_template, cpu.swapgs); 19 #ifdef CONFIG_DEBUG_ENTRY 20 OFFSET(PV_IRQ_save_fl, paravirt_patch_template, irq.save_fl); 21 #endif 22 #endif 23 BLANK(); 24 #endif 25 26 #if defined(CONFIG_KVM_GUEST) && defined(CONFIG_PARAVIRT_SPINLOCKS) 27 OFFSET(KVM_STEAL_TIME_preempted, kvm_steal_time, preempted); 28 BLANK(); 29 #endif 30 31 #define ENTRY(entry) OFFSET(pt_regs_ ## entry, pt_regs, entry) 32 ENTRY(bx); 33 ENTRY(cx); 34 ENTRY(dx); 35 ENTRY(sp); 36 ENTRY(bp); 37 ENTRY(si); 38 ENTRY(di); 39 ENTRY(r8); 40 ENTRY(r9); 41 ENTRY(r10); 42 ENTRY(r11); 43 ENTRY(r12); 44 ENTRY(r13); 45 ENTRY(r14); 46 ENTRY(r15); 47 ENTRY(flags); 48 BLANK(); 49 #undef ENTRY 50 51 #define ENTRY(entry) OFFSET(saved_context_ ## entry, saved_context, entry) 52 ENTRY(cr0); 53 ENTRY(cr2); 54 ENTRY(cr3); 55 ENTRY(cr4); 56 ENTRY(gdt_desc); 57 BLANK(); 58 #undef ENTRY 59 60 OFFSET(TSS_ist, tss_struct, x86_tss.ist); 61 DEFINE(DB_STACK_OFFSET, offsetof(struct cea_exception_stacks, DB_stack) - 62 offsetof(struct cea_exception_stacks, DB1_stack)); 63 BLANK(); 64 65 #ifdef CONFIG_STACKPROTECTOR 66 DEFINE(stack_canary_offset, offsetof(struct fixed_percpu_data, stack_canary)); 67 BLANK(); 68 #endif 69 return 0; 70 } 71