1 // SPDX-License-Identifier: GPL-2.0-only !! 1 // SPDX-License-Identifier: GPL-2.0 2 /* 2 /* 3 * Based on arch/arm/kernel/asm-offsets.c !! 3 * This program is used to generate definitions needed by >> 4 * assembly language modules. 4 * 5 * 5 * Copyright (C) 1995-2003 Russell King !! 6 * We use the technique used in the OSF Mach kernel code: 6 * 2001-2002 Keith Owens !! 7 * generate asm statements containing #defines, 7 * Copyright (C) 2012 ARM Ltd. !! 8 * compile this file to assembler, and then extract the >> 9 * #defines from the assembly-language output. 8 */ 10 */ 9 11 10 #include <linux/arm_sdei.h> !! 12 #define ASM_OFFSETS_C >> 13 >> 14 #include <linux/stddef.h> 11 #include <linux/sched.h> 15 #include <linux/sched.h> 12 #include <linux/ftrace.h> !! 16 #include <linux/kernel_stat.h> 13 #include <linux/kexec.h> << 14 #include <linux/mm.h> << 15 #include <linux/dma-mapping.h> << 16 #include <linux/kvm_host.h> << 17 #include <linux/preempt.h> << 18 #include <linux/suspend.h> << 19 #include <asm/cpufeature.h> << 20 #include <asm/fixmap.h> << 21 #include <asm/thread_info.h> << 22 #include <asm/memory.h> << 23 #include <asm/signal32.h> << 24 #include <asm/smp_plat.h> << 25 #include <asm/suspend.h> << 26 #include <linux/kbuild.h> 17 #include <linux/kbuild.h> 27 #include <linux/arm-smccc.h> !! 18 #include <asm/bootinfo.h> >> 19 #include <asm/irq.h> >> 20 #include <asm/amigahw.h> >> 21 #include <linux/font.h> 28 22 29 int main(void) 23 int main(void) 30 { 24 { 31 DEFINE(TSK_ACTIVE_MM, offsetof(struc !! 25 /* offsets into the task struct */ 32 BLANK(); !! 26 DEFINE(TASK_THREAD, offsetof(struct task_struct, thread)); 33 DEFINE(TSK_TI_CPU, offsetof(struc !! 27 DEFINE(TASK_MM, offsetof(struct task_struct, mm)); 34 DEFINE(TSK_TI_FLAGS, offsetof(struc !! 28 DEFINE(TASK_STACK, offsetof(struct task_struct, stack)); 35 DEFINE(TSK_TI_PREEMPT, offsetof(struc !! 29 36 #ifdef CONFIG_ARM64_SW_TTBR0_PAN !! 30 /* offsets into the thread struct */ 37 DEFINE(TSK_TI_TTBR0, offsetof(struc !! 31 DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp)); 38 #endif !! 32 DEFINE(THREAD_USP, offsetof(struct thread_struct, usp)); 39 #ifdef CONFIG_SHADOW_CALL_STACK !! 33 DEFINE(THREAD_SR, offsetof(struct thread_struct, sr)); 40 DEFINE(TSK_TI_SCS_BASE, offsetof(struc !! 34 DEFINE(THREAD_FC, offsetof(struct thread_struct, fc)); 41 DEFINE(TSK_TI_SCS_SP, offsetof(struc !! 35 DEFINE(THREAD_CRP, offsetof(struct thread_struct, crp)); 42 #endif !! 36 DEFINE(THREAD_ESP0, offsetof(struct thread_struct, esp0)); 43 DEFINE(TSK_STACK, offsetof(struc !! 37 DEFINE(THREAD_FPREG, offsetof(struct thread_struct, fp)); 44 #ifdef CONFIG_STACKPROTECTOR !! 38 DEFINE(THREAD_FPCNTL, offsetof(struct thread_struct, fpcntl)); 45 DEFINE(TSK_STACK_CANARY, offsetof(struc !! 39 DEFINE(THREAD_FPSTATE, offsetof(struct thread_struct, fpstate)); 46 #endif !! 40 47 BLANK(); !! 41 /* offsets into the thread_info struct */ 48 DEFINE(THREAD_CPU_CONTEXT, offsetof(struc !! 42 DEFINE(TINFO_PREEMPT, offsetof(struct thread_info, preempt_count)); 49 DEFINE(THREAD_SCTLR_USER, offsetof(struc !! 43 DEFINE(TINFO_FLAGS, offsetof(struct thread_info, flags)); 50 #ifdef CONFIG_ARM64_PTR_AUTH !! 44 51 DEFINE(THREAD_KEYS_USER, offsetof(struc !! 45 /* offsets into the pt_regs */ 52 #endif !! 46 DEFINE(PT_OFF_D0, offsetof(struct pt_regs, d0)); 53 #ifdef CONFIG_ARM64_PTR_AUTH_KERNEL !! 47 DEFINE(PT_OFF_ORIG_D0, offsetof(struct pt_regs, orig_d0)); 54 DEFINE(THREAD_KEYS_KERNEL, offsetof(struc !! 48 DEFINE(PT_OFF_D1, offsetof(struct pt_regs, d1)); 55 #endif !! 49 DEFINE(PT_OFF_D2, offsetof(struct pt_regs, d2)); 56 #ifdef CONFIG_ARM64_MTE !! 50 DEFINE(PT_OFF_D3, offsetof(struct pt_regs, d3)); 57 DEFINE(THREAD_MTE_CTRL, offsetof(struc !! 51 DEFINE(PT_OFF_D4, offsetof(struct pt_regs, d4)); 58 #endif !! 52 DEFINE(PT_OFF_D5, offsetof(struct pt_regs, d5)); 59 BLANK(); !! 53 DEFINE(PT_OFF_A0, offsetof(struct pt_regs, a0)); 60 DEFINE(S_X0, offsetof(struc !! 54 DEFINE(PT_OFF_A1, offsetof(struct pt_regs, a1)); 61 DEFINE(S_X2, offsetof(struc !! 55 DEFINE(PT_OFF_A2, offsetof(struct pt_regs, a2)); 62 DEFINE(S_X4, offsetof(struc !! 56 DEFINE(PT_OFF_PC, offsetof(struct pt_regs, pc)); 63 DEFINE(S_X6, offsetof(struc !! 57 DEFINE(PT_OFF_SR, offsetof(struct pt_regs, sr)); 64 DEFINE(S_X8, offsetof(struc !! 58 65 DEFINE(S_X10, offsetof(struc !! 59 /* bitfields are a bit difficult */ 66 DEFINE(S_X12, offsetof(struc !! 60 #ifdef CONFIG_COLDFIRE 67 DEFINE(S_X14, offsetof(struc !! 61 DEFINE(PT_OFF_FORMATVEC, offsetof(struct pt_regs, sr) - 2); 68 DEFINE(S_X16, offsetof(struc !! 62 #else 69 DEFINE(S_X18, offsetof(struc !! 63 DEFINE(PT_OFF_FORMATVEC, offsetof(struct pt_regs, pc) + 4); 70 DEFINE(S_X20, offsetof(struc << 71 DEFINE(S_X22, offsetof(struc << 72 DEFINE(S_X24, offsetof(struc << 73 DEFINE(S_X26, offsetof(struc << 74 DEFINE(S_X28, offsetof(struc << 75 DEFINE(S_FP, offsetof(struc << 76 DEFINE(S_LR, offsetof(struc << 77 DEFINE(S_SP, offsetof(struc << 78 DEFINE(S_PC, offsetof(struc << 79 DEFINE(S_PSTATE, offsetof(struc << 80 DEFINE(S_SYSCALLNO, offsetof(struc << 81 DEFINE(S_SDEI_TTBR1, offsetof(struc << 82 DEFINE(S_PMR_SAVE, offsetof(struc << 83 DEFINE(S_STACKFRAME, offsetof(struc << 84 DEFINE(PT_REGS_SIZE, sizeof(struct << 85 BLANK(); << 86 #ifdef CONFIG_DYNAMIC_FTRACE_WITH_ARGS << 87 DEFINE(FREGS_X0, offsetof(struc << 88 DEFINE(FREGS_X2, offsetof(struc << 89 DEFINE(FREGS_X4, offsetof(struc << 90 DEFINE(FREGS_X6, offsetof(struc << 91 DEFINE(FREGS_X8, offsetof(struc << 92 DEFINE(FREGS_FP, offsetof(struc << 93 DEFINE(FREGS_LR, offsetof(struc << 94 DEFINE(FREGS_SP, offsetof(struc << 95 DEFINE(FREGS_PC, offsetof(struc << 96 #ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS << 97 DEFINE(FREGS_DIRECT_TRAMP, offsetof(struc << 98 #endif << 99 DEFINE(FREGS_SIZE, sizeof(struct << 100 BLANK(); << 101 #endif << 102 #ifdef CONFIG_COMPAT << 103 DEFINE(COMPAT_SIGFRAME_REGS_OFFSET, << 104 DEFINE(COMPAT_RT_SIGFRAME_REGS_OFFSET, << 105 BLANK(); << 106 #endif << 107 DEFINE(MM_CONTEXT_ID, offsetof(struc << 108 BLANK(); << 109 DEFINE(VMA_VM_MM, offsetof(struc << 110 DEFINE(VMA_VM_FLAGS, offsetof(struc << 111 BLANK(); << 112 DEFINE(VM_EXEC, VM_EXEC); << 113 BLANK(); << 114 DEFINE(PAGE_SZ, PAGE_SIZE); << 115 BLANK(); << 116 DEFINE(DMA_TO_DEVICE, DMA_TO_DEVICE) << 117 DEFINE(DMA_FROM_DEVICE, DMA_FROM_DEVIC << 118 BLANK(); << 119 DEFINE(PREEMPT_DISABLE_OFFSET, PREEMPT_DISAB << 120 BLANK(); << 121 DEFINE(CPU_BOOT_TASK, offsetof(struc << 122 BLANK(); << 123 DEFINE(FTR_OVR_VAL_OFFSET, offsetof(struc << 124 DEFINE(FTR_OVR_MASK_OFFSET, offsetof(struc << 125 BLANK(); << 126 #ifdef CONFIG_KVM << 127 DEFINE(VCPU_CONTEXT, offsetof(struc << 128 DEFINE(VCPU_FAULT_DISR, offsetof(struc << 129 DEFINE(VCPU_HCR_EL2, offsetof(struc << 130 DEFINE(CPU_USER_PT_REGS, offsetof(struc << 131 DEFINE(CPU_ELR_EL2, offsetof(struc << 132 DEFINE(CPU_RGSR_EL1, offsetof(struc << 133 DEFINE(CPU_GCR_EL1, offsetof(struc << 134 DEFINE(CPU_APIAKEYLO_EL1, offsetof(struc << 135 DEFINE(CPU_APIBKEYLO_EL1, offsetof(struc << 136 DEFINE(CPU_APDAKEYLO_EL1, offsetof(struc << 137 DEFINE(CPU_APDBKEYLO_EL1, offsetof(struc << 138 DEFINE(CPU_APGAKEYLO_EL1, offsetof(struc << 139 DEFINE(HOST_CONTEXT_VCPU, offsetof(struc << 140 DEFINE(HOST_DATA_CONTEXT, offsetof(struc << 141 DEFINE(NVHE_INIT_MAIR_EL2, offsetof(struc << 142 DEFINE(NVHE_INIT_TCR_EL2, offsetof(struc << 143 DEFINE(NVHE_INIT_TPIDR_EL2, offsetof(struc << 144 DEFINE(NVHE_INIT_STACK_HYP_VA, offset << 145 DEFINE(NVHE_INIT_PGD_PA, offsetof(struc << 146 DEFINE(NVHE_INIT_HCR_EL2, offsetof(struc << 147 DEFINE(NVHE_INIT_VTTBR, offsetof(struc << 148 DEFINE(NVHE_INIT_VTCR, offsetof(struc << 149 DEFINE(NVHE_INIT_TMP, offsetof(struc << 150 #endif << 151 #ifdef CONFIG_CPU_PM << 152 DEFINE(CPU_CTX_SP, offsetof(struc << 153 DEFINE(MPIDR_HASH_MASK, offsetof(struc << 154 DEFINE(MPIDR_HASH_SHIFTS, offsetof(struc << 155 DEFINE(SLEEP_STACK_DATA_SYSTEM_REGS, offset << 156 DEFINE(SLEEP_STACK_DATA_CALLEE_REGS, offset << 157 #endif << 158 DEFINE(ARM_SMCCC_RES_X0_OFFS, offset << 159 DEFINE(ARM_SMCCC_RES_X2_OFFS, offset << 160 DEFINE(ARM_SMCCC_QUIRK_ID_OFFS, offset << 161 DEFINE(ARM_SMCCC_QUIRK_STATE_OFFS, offset << 162 DEFINE(ARM_SMCCC_1_2_REGS_X0_OFFS, offset << 163 DEFINE(ARM_SMCCC_1_2_REGS_X2_OFFS, offset << 164 DEFINE(ARM_SMCCC_1_2_REGS_X4_OFFS, offset << 165 DEFINE(ARM_SMCCC_1_2_REGS_X6_OFFS, offset << 166 DEFINE(ARM_SMCCC_1_2_REGS_X8_OFFS, offset << 167 DEFINE(ARM_SMCCC_1_2_REGS_X10_OFFS, offset << 168 DEFINE(ARM_SMCCC_1_2_REGS_X12_OFFS, offset << 169 DEFINE(ARM_SMCCC_1_2_REGS_X14_OFFS, offset << 170 DEFINE(ARM_SMCCC_1_2_REGS_X16_OFFS, offset << 171 BLANK(); << 172 DEFINE(HIBERN_PBE_ORIG, offsetof(struc << 173 DEFINE(HIBERN_PBE_ADDR, offsetof(struc << 174 DEFINE(HIBERN_PBE_NEXT, offsetof(struc << 175 DEFINE(ARM64_FTR_SYSVAL, offsetof(struc << 176 BLANK(); << 177 #ifdef CONFIG_UNMAP_KERNEL_AT_EL0 << 178 DEFINE(TRAMP_VALIAS, TRAMP_VALIAS); << 179 #endif << 180 #ifdef CONFIG_ARM_SDE_INTERFACE << 181 DEFINE(SDEI_EVENT_INTREGS, offsetof(struc << 182 DEFINE(SDEI_EVENT_PRIORITY, offsetof(struc << 183 #endif << 184 #ifdef CONFIG_ARM64_PTR_AUTH << 185 DEFINE(PTRAUTH_USER_KEY_APIA, offset << 186 #ifdef CONFIG_ARM64_PTR_AUTH_KERNEL << 187 DEFINE(PTRAUTH_KERNEL_KEY_APIA, offset << 188 #endif << 189 BLANK(); << 190 #endif << 191 #ifdef CONFIG_KEXEC_CORE << 192 DEFINE(KIMAGE_ARCH_DTB_MEM, offset << 193 DEFINE(KIMAGE_ARCH_EL2_VECTORS, offset << 194 DEFINE(KIMAGE_ARCH_ZERO_PAGE, offset << 195 DEFINE(KIMAGE_ARCH_PHYS_OFFSET, offset << 196 DEFINE(KIMAGE_ARCH_TTBR1, offset << 197 DEFINE(KIMAGE_HEAD, offset << 198 DEFINE(KIMAGE_START, offset << 199 BLANK(); << 200 #endif << 201 #ifdef CONFIG_FUNCTION_TRACER << 202 DEFINE(FTRACE_OPS_FUNC, offset << 203 #endif << 204 BLANK(); << 205 #ifdef CONFIG_FUNCTION_GRAPH_TRACER << 206 DEFINE(FGRET_REGS_X0, offset << 207 DEFINE(FGRET_REGS_X1, offset << 208 DEFINE(FGRET_REGS_X2, offset << 209 DEFINE(FGRET_REGS_X3, offset << 210 DEFINE(FGRET_REGS_X4, offset << 211 DEFINE(FGRET_REGS_X5, offset << 212 DEFINE(FGRET_REGS_X6, offset << 213 DEFINE(FGRET_REGS_X7, offset << 214 DEFINE(FGRET_REGS_FP, offset << 215 DEFINE(FGRET_REGS_SIZE, sizeof << 216 #endif 64 #endif 217 #ifdef CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS !! 65 218 DEFINE(FTRACE_OPS_DIRECT_CALL, offset !! 66 /* offsets into the irq_cpustat_t struct */ >> 67 DEFINE(CPUSTAT_SOFTIRQ_PENDING, offsetof(irq_cpustat_t, __softirq_pending)); >> 68 >> 69 /* signal defines */ >> 70 DEFINE(LSIGSEGV, SIGSEGV); >> 71 DEFINE(LSEGV_MAPERR, SEGV_MAPERR); >> 72 DEFINE(LSIGTRAP, SIGTRAP); >> 73 DEFINE(LTRAP_TRACE, TRAP_TRACE); >> 74 >> 75 #ifdef CONFIG_MMU >> 76 /* offsets into the bi_record struct */ >> 77 DEFINE(BIR_TAG, offsetof(struct bi_record, tag)); >> 78 DEFINE(BIR_SIZE, offsetof(struct bi_record, size)); >> 79 DEFINE(BIR_DATA, offsetof(struct bi_record, data)); >> 80 >> 81 /* offsets into the font_desc struct */ >> 82 DEFINE(FONT_DESC_IDX, offsetof(struct font_desc, idx)); >> 83 DEFINE(FONT_DESC_NAME, offsetof(struct font_desc, name)); >> 84 DEFINE(FONT_DESC_WIDTH, offsetof(struct font_desc, width)); >> 85 DEFINE(FONT_DESC_HEIGHT, offsetof(struct font_desc, height)); >> 86 DEFINE(FONT_DESC_DATA, offsetof(struct font_desc, data)); >> 87 DEFINE(FONT_DESC_PREF, offsetof(struct font_desc, pref)); >> 88 >> 89 /* offsets into the custom struct */ >> 90 DEFINE(CUSTOMBASE, &amiga_custom); >> 91 DEFINE(C_INTENAR, offsetof(struct CUSTOM, intenar)); >> 92 DEFINE(C_INTREQR, offsetof(struct CUSTOM, intreqr)); >> 93 DEFINE(C_INTENA, offsetof(struct CUSTOM, intena)); >> 94 DEFINE(C_INTREQ, offsetof(struct CUSTOM, intreq)); >> 95 DEFINE(C_SERDATR, offsetof(struct CUSTOM, serdatr)); >> 96 DEFINE(C_SERDAT, offsetof(struct CUSTOM, serdat)); >> 97 DEFINE(C_SERPER, offsetof(struct CUSTOM, serper)); >> 98 DEFINE(CIAABASE, &ciaa); >> 99 DEFINE(CIABBASE, &ciab); >> 100 DEFINE(C_PRA, offsetof(struct CIA, pra)); >> 101 DEFINE(ZTWOBASE, zTwoBase); >> 102 >> 103 /* enum m68k_fixup_type */ >> 104 DEFINE(M68K_FIXUP_MEMOFFSET, m68k_fixup_memoffset); 219 #endif 105 #endif 220 return 0; !! 106 >> 107 return 0; 221 } 108 } 222 109
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.