Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Jan Beulich | b82fef8 | 2011-02-09 08:24:34 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Generate definitions needed by assembly language modules. |
| 4 | * This code generates raw asm output which is post-processed to extract |
| 5 | * and format the required data. |
| 6 | */ |
| 7 | #define COMPILE_OFFSETS |
| 8 | |
| 9 | #include <linux/crypto.h> |
| 10 | #include <linux/sched.h> |
| 11 | #include <linux/stddef.h> |
| 12 | #include <linux/hardirq.h> |
| 13 | #include <linux/suspend.h> |
| 14 | #include <linux/kbuild.h> |
| 15 | #include <asm/processor.h> |
| 16 | #include <asm/thread_info.h> |
| 17 | #include <asm/sigframe.h> |
| 18 | #include <asm/bootparam.h> |
| 19 | #include <asm/suspend.h> |
Peter Zijlstra | 6fd166a | 2017-12-04 15:07:59 +0100 | [diff] [blame] | 20 | #include <asm/tlbflush.h> |
Jan Beulich | b82fef8 | 2011-02-09 08:24:34 +0000 | [diff] [blame] | 21 | |
| 22 | #ifdef CONFIG_XEN |
| 23 | #include <xen/interface/xen.h> |
| 24 | #endif |
| 25 | |
Thomas Gleixner | 8d0d37c | 2007-10-11 11:12:08 +0200 | [diff] [blame] | 26 | #ifdef CONFIG_X86_32 |
| 27 | # include "asm-offsets_32.c" |
| 28 | #else |
| 29 | # include "asm-offsets_64.c" |
Rusty Russell | 6db7016 | 2007-07-19 01:49:26 -0700 | [diff] [blame] | 30 | #endif |
Jan Beulich | b82fef8 | 2011-02-09 08:24:34 +0000 | [diff] [blame] | 31 | |
Borislav Petkov | ad3bc25 | 2018-12-05 00:34:56 +0100 | [diff] [blame] | 32 | static void __used common(void) |
| 33 | { |
Jan Beulich | b82fef8 | 2011-02-09 08:24:34 +0000 | [diff] [blame] | 34 | BLANK(); |
Brian Gerst | 0100301 | 2016-08-13 12:38:19 -0400 | [diff] [blame] | 35 | OFFSET(TASK_threadsp, task_struct, thread.sp); |
Linus Torvalds | 050e9ba | 2018-06-14 12:21:18 +0900 | [diff] [blame] | 36 | #ifdef CONFIG_STACKPROTECTOR |
Brian Gerst | 0100301 | 2016-08-13 12:38:19 -0400 | [diff] [blame] | 37 | OFFSET(TASK_stack_canary, task_struct, stack_canary); |
| 38 | #endif |
| 39 | |
| 40 | BLANK(); |
Jan Beulich | b82fef8 | 2011-02-09 08:24:34 +0000 | [diff] [blame] | 41 | OFFSET(pbe_address, pbe, address); |
| 42 | OFFSET(pbe_orig_address, pbe, orig_address); |
| 43 | OFFSET(pbe_next, pbe, next); |
| 44 | |
Brian Gerst | 4d178f9 | 2015-04-12 09:14:45 -0400 | [diff] [blame] | 45 | #if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION) |
| 46 | BLANK(); |
Ingo Molnar | 8fcb346 | 2015-09-05 09:32:41 +0200 | [diff] [blame] | 47 | OFFSET(IA32_SIGCONTEXT_ax, sigcontext_32, ax); |
| 48 | OFFSET(IA32_SIGCONTEXT_bx, sigcontext_32, bx); |
| 49 | OFFSET(IA32_SIGCONTEXT_cx, sigcontext_32, cx); |
| 50 | OFFSET(IA32_SIGCONTEXT_dx, sigcontext_32, dx); |
| 51 | OFFSET(IA32_SIGCONTEXT_si, sigcontext_32, si); |
| 52 | OFFSET(IA32_SIGCONTEXT_di, sigcontext_32, di); |
| 53 | OFFSET(IA32_SIGCONTEXT_bp, sigcontext_32, bp); |
| 54 | OFFSET(IA32_SIGCONTEXT_sp, sigcontext_32, sp); |
| 55 | OFFSET(IA32_SIGCONTEXT_ip, sigcontext_32, ip); |
Brian Gerst | 4d178f9 | 2015-04-12 09:14:45 -0400 | [diff] [blame] | 56 | |
| 57 | BLANK(); |
Brian Gerst | 4d178f9 | 2015-04-12 09:14:45 -0400 | [diff] [blame] | 58 | OFFSET(IA32_RT_SIGFRAME_sigcontext, rt_sigframe_ia32, uc.uc_mcontext); |
| 59 | #endif |
| 60 | |
Jan Beulich | b82fef8 | 2011-02-09 08:24:34 +0000 | [diff] [blame] | 61 | #ifdef CONFIG_XEN |
| 62 | BLANK(); |
| 63 | OFFSET(XEN_vcpu_info_mask, vcpu_info, evtchn_upcall_mask); |
| 64 | OFFSET(XEN_vcpu_info_pending, vcpu_info, evtchn_upcall_pending); |
Peter Zijlstra | 55aeddd | 2019-07-11 13:40:55 +0200 | [diff] [blame] | 65 | OFFSET(XEN_vcpu_info_arch_cr2, vcpu_info, arch.cr2); |
Jan Beulich | b82fef8 | 2011-02-09 08:24:34 +0000 | [diff] [blame] | 66 | #endif |
| 67 | |
| 68 | BLANK(); |
| 69 | OFFSET(BP_scratch, boot_params, scratch); |
David Howells | de8cb45 | 2017-02-06 11:22:43 +0000 | [diff] [blame] | 70 | OFFSET(BP_secure_boot, boot_params, secure_boot); |
Jan Beulich | b82fef8 | 2011-02-09 08:24:34 +0000 | [diff] [blame] | 71 | OFFSET(BP_loadflags, boot_params, hdr.loadflags); |
| 72 | OFFSET(BP_hardware_subarch, boot_params, hdr.hardware_subarch); |
| 73 | OFFSET(BP_version, boot_params, hdr.version); |
| 74 | OFFSET(BP_kernel_alignment, boot_params, hdr.kernel_alignment); |
Yinghai Lu | 974f221 | 2016-04-28 17:09:04 -0700 | [diff] [blame] | 75 | OFFSET(BP_init_size, boot_params, hdr.init_size); |
Matt Fleming | 291f363 | 2011-12-12 21:27:52 +0000 | [diff] [blame] | 76 | OFFSET(BP_pref_address, boot_params, hdr.pref_address); |
Al Viro | 6783eaa2 | 2012-08-02 23:05:11 +0400 | [diff] [blame] | 77 | |
| 78 | BLANK(); |
| 79 | DEFINE(PTREGS_SIZE, sizeof(struct pt_regs)); |
Andy Lutomirski | 1a79797 | 2017-12-04 15:07:12 +0100 | [diff] [blame] | 80 | |
Peter Zijlstra | 6fd166a | 2017-12-04 15:07:59 +0100 | [diff] [blame] | 81 | /* TLB state for the entry code */ |
| 82 | OFFSET(TLB_STATE_user_pcid_flush_mask, tlb_state, user_pcid_flush_mask); |
| 83 | |
Andy Lutomirski | 72f5e08 | 2017-12-04 15:07:20 +0100 | [diff] [blame] | 84 | /* Layout info for cpu_entry_area */ |
Dave Hansen | 4fe2d8b | 2017-12-04 17:25:07 -0800 | [diff] [blame] | 85 | OFFSET(CPU_ENTRY_AREA_entry_stack, cpu_entry_area, entry_stack_page); |
| 86 | DEFINE(SIZEOF_entry_stack, sizeof(struct entry_stack)); |
Joerg Roedel | 45d7b25 | 2018-07-18 11:40:44 +0200 | [diff] [blame] | 87 | DEFINE(MASK_entry_stack, (~(sizeof(struct entry_stack) - 1))); |
Joerg Roedel | 9e97b73 | 2018-07-18 11:40:38 +0200 | [diff] [blame] | 88 | |
Andy Lutomirski | 98f05b5 | 2018-09-03 15:59:43 -0700 | [diff] [blame] | 89 | /* Offset for fields in tss_struct */ |
Joerg Roedel | 9e97b73 | 2018-07-18 11:40:38 +0200 | [diff] [blame] | 90 | OFFSET(TSS_sp0, tss_struct, x86_tss.sp0); |
| 91 | OFFSET(TSS_sp1, tss_struct, x86_tss.sp1); |
Andy Lutomirski | 98f05b5 | 2018-09-03 15:59:43 -0700 | [diff] [blame] | 92 | OFFSET(TSS_sp2, tss_struct, x86_tss.sp2); |
Jan Beulich | b82fef8 | 2011-02-09 08:24:34 +0000 | [diff] [blame] | 93 | } |