1 // SPDX-License-Identifier: GPL-2.0-or-later !! 1 // SPDX-License-Identifier: GPL-2.0 2 /* !! 2 /* 3 * Generate definitions needed by assembly lan !! 3 * This program is used to generate definitions needed by 4 * This code generates raw asm output which is !! 4 * assembly language modules. 5 * and format the required data. << 6 * 5 * 7 * Copyright (C) 2000-2001 John Marvin <jsm !! 6 * We use the technique used in the OSF Mach kernel code: 8 * Copyright (C) 2000 David Huggins-Daines !! 7 * generate asm statements containing #defines, 9 * Copyright (C) 2000 Sam Creasey <sammy@sa !! 8 * compile this file to assembler, and then extract the 10 * Copyright (C) 2000 Grant Grundler <grund !! 9 * #defines from the assembly-language output. 11 * Copyright (C) 2001 Paul Bame <bame at pa !! 10 * 12 * Copyright (C) 2001 Richard Hirst <rhirst !! 11 * On sparc, thread_info data is static and TI_XXX offsets are computed by hand. 13 * Copyright (C) 2002 Randolph Chung <tausq << 14 * Copyright (C) 2003 James Bottomley <jejb << 15 */ 12 */ 16 13 17 #include <linux/types.h> << 18 #include <linux/sched.h> 14 #include <linux/sched.h> 19 #include <linux/thread_info.h> !! 15 #include <linux/mm_types.h> 20 #include <linux/ptrace.h> !! 16 // #include <linux/mm.h> 21 #include <linux/hardirq.h> << 22 #include <linux/kbuild.h> 17 #include <linux/kbuild.h> 23 #include <linux/pgtable.h> << 24 << 25 #include <asm/assembly.h> << 26 #include <asm/ptrace.h> << 27 #include <asm/processor.h> << 28 #include <asm/pdc.h> << 29 #include <uapi/asm/sigcontext.h> << 30 #include <asm/ucontext.h> << 31 #include <asm/rt_sigframe.h> << 32 #include <linux/uaccess.h> << 33 #include "signal32.h" << 34 18 35 /* Add FRAME_SIZE to the size x and align it t !! 19 #include <asm/hibernate.h> 36 * that use align_frame will include space for << 37 */ << 38 #define align_frame(x,y) (((x)+FRAME_SIZE+(y)- << 39 20 40 int main(void) !! 21 #ifdef CONFIG_SPARC32 >> 22 static int __used sparc32_foo(void) 41 { 23 { 42 DEFINE(TASK_TI_FLAGS, offsetof(struct !! 24 DEFINE(AOFF_thread_fork_kpsr, 43 #ifdef CONFIG_SMP !! 25 offsetof(struct thread_struct, fork_kpsr)); 44 DEFINE(TASK_TI_CPU, offsetof(struct ta !! 26 return 0; 45 #endif !! 27 } 46 DEFINE(TASK_STACK, offsetof(struct tas << 47 DEFINE(TASK_PAGEFAULT_DISABLED, offset << 48 BLANK(); << 49 DEFINE(TASK_REGS, offsetof(struct task << 50 DEFINE(TASK_PT_PSW, offsetof(struct ta << 51 DEFINE(TASK_PT_GR1, offsetof(struct ta << 52 DEFINE(TASK_PT_GR2, offsetof(struct ta << 53 DEFINE(TASK_PT_GR3, offsetof(struct ta << 54 DEFINE(TASK_PT_GR4, offsetof(struct ta << 55 DEFINE(TASK_PT_GR5, offsetof(struct ta << 56 DEFINE(TASK_PT_GR6, offsetof(struct ta << 57 DEFINE(TASK_PT_GR7, offsetof(struct ta << 58 DEFINE(TASK_PT_GR8, offsetof(struct ta << 59 DEFINE(TASK_PT_GR9, offsetof(struct ta << 60 DEFINE(TASK_PT_GR10, offsetof(struct t << 61 DEFINE(TASK_PT_GR11, offsetof(struct t << 62 DEFINE(TASK_PT_GR12, offsetof(struct t << 63 DEFINE(TASK_PT_GR13, offsetof(struct t << 64 DEFINE(TASK_PT_GR14, offsetof(struct t << 65 DEFINE(TASK_PT_GR15, offsetof(struct t << 66 DEFINE(TASK_PT_GR16, offsetof(struct t << 67 DEFINE(TASK_PT_GR17, offsetof(struct t << 68 DEFINE(TASK_PT_GR18, offsetof(struct t << 69 DEFINE(TASK_PT_GR19, offsetof(struct t << 70 DEFINE(TASK_PT_GR20, offsetof(struct t << 71 DEFINE(TASK_PT_GR21, offsetof(struct t << 72 DEFINE(TASK_PT_GR22, offsetof(struct t << 73 DEFINE(TASK_PT_GR23, offsetof(struct t << 74 DEFINE(TASK_PT_GR24, offsetof(struct t << 75 DEFINE(TASK_PT_GR25, offsetof(struct t << 76 DEFINE(TASK_PT_GR26, offsetof(struct t << 77 DEFINE(TASK_PT_GR27, offsetof(struct t << 78 DEFINE(TASK_PT_GR28, offsetof(struct t << 79 DEFINE(TASK_PT_GR29, offsetof(struct t << 80 DEFINE(TASK_PT_GR30, offsetof(struct t << 81 DEFINE(TASK_PT_GR31, offsetof(struct t << 82 DEFINE(TASK_PT_FR0, offsetof(struct ta << 83 DEFINE(TASK_PT_FR1, offsetof(struct ta << 84 DEFINE(TASK_PT_FR2, offsetof(struct ta << 85 DEFINE(TASK_PT_FR3, offsetof(struct ta << 86 DEFINE(TASK_PT_FR4, offsetof(struct ta << 87 DEFINE(TASK_PT_FR5, offsetof(struct ta << 88 DEFINE(TASK_PT_FR6, offsetof(struct ta << 89 DEFINE(TASK_PT_FR7, offsetof(struct ta << 90 DEFINE(TASK_PT_FR8, offsetof(struct ta << 91 DEFINE(TASK_PT_FR9, offsetof(struct ta << 92 DEFINE(TASK_PT_FR10, offsetof(struct t << 93 DEFINE(TASK_PT_FR11, offsetof(struct t << 94 DEFINE(TASK_PT_FR12, offsetof(struct t << 95 DEFINE(TASK_PT_FR13, offsetof(struct t << 96 DEFINE(TASK_PT_FR14, offsetof(struct t << 97 DEFINE(TASK_PT_FR15, offsetof(struct t << 98 DEFINE(TASK_PT_FR16, offsetof(struct t << 99 DEFINE(TASK_PT_FR17, offsetof(struct t << 100 DEFINE(TASK_PT_FR18, offsetof(struct t << 101 DEFINE(TASK_PT_FR19, offsetof(struct t << 102 DEFINE(TASK_PT_FR20, offsetof(struct t << 103 DEFINE(TASK_PT_FR21, offsetof(struct t << 104 DEFINE(TASK_PT_FR22, offsetof(struct t << 105 DEFINE(TASK_PT_FR23, offsetof(struct t << 106 DEFINE(TASK_PT_FR24, offsetof(struct t << 107 DEFINE(TASK_PT_FR25, offsetof(struct t << 108 DEFINE(TASK_PT_FR26, offsetof(struct t << 109 DEFINE(TASK_PT_FR27, offsetof(struct t << 110 DEFINE(TASK_PT_FR28, offsetof(struct t << 111 DEFINE(TASK_PT_FR29, offsetof(struct t << 112 DEFINE(TASK_PT_FR30, offsetof(struct t << 113 DEFINE(TASK_PT_FR31, offsetof(struct t << 114 DEFINE(TASK_PT_SR0, offsetof(struct ta << 115 DEFINE(TASK_PT_SR1, offsetof(struct ta << 116 DEFINE(TASK_PT_SR2, offsetof(struct ta << 117 DEFINE(TASK_PT_SR3, offsetof(struct ta << 118 DEFINE(TASK_PT_SR4, offsetof(struct ta << 119 DEFINE(TASK_PT_SR5, offsetof(struct ta << 120 DEFINE(TASK_PT_SR6, offsetof(struct ta << 121 DEFINE(TASK_PT_SR7, offsetof(struct ta << 122 DEFINE(TASK_PT_IASQ0, offsetof(struct << 123 DEFINE(TASK_PT_IASQ1, offsetof(struct << 124 DEFINE(TASK_PT_IAOQ0, offsetof(struct << 125 DEFINE(TASK_PT_IAOQ1, offsetof(struct << 126 DEFINE(TASK_PT_CR27, offsetof(struct t << 127 DEFINE(TASK_PT_ORIG_R28, offsetof(stru << 128 DEFINE(TASK_PT_KSP, offsetof(struct ta << 129 DEFINE(TASK_PT_KPC, offsetof(struct ta << 130 DEFINE(TASK_PT_SAR, offsetof(struct ta << 131 DEFINE(TASK_PT_IIR, offsetof(struct ta << 132 DEFINE(TASK_PT_ISR, offsetof(struct ta << 133 DEFINE(TASK_PT_IOR, offsetof(struct ta << 134 BLANK(); << 135 DEFINE(PT_PSW, offsetof(struct pt_regs << 136 DEFINE(PT_GR1, offsetof(struct pt_regs << 137 DEFINE(PT_GR2, offsetof(struct pt_regs << 138 DEFINE(PT_GR3, offsetof(struct pt_regs << 139 DEFINE(PT_GR4, offsetof(struct pt_regs << 140 DEFINE(PT_GR5, offsetof(struct pt_regs << 141 DEFINE(PT_GR6, offsetof(struct pt_regs << 142 DEFINE(PT_GR7, offsetof(struct pt_regs << 143 DEFINE(PT_GR8, offsetof(struct pt_regs << 144 DEFINE(PT_GR9, offsetof(struct pt_regs << 145 DEFINE(PT_GR10, offsetof(struct pt_reg << 146 DEFINE(PT_GR11, offsetof(struct pt_reg << 147 DEFINE(PT_GR12, offsetof(struct pt_reg << 148 DEFINE(PT_GR13, offsetof(struct pt_reg << 149 DEFINE(PT_GR14, offsetof(struct pt_reg << 150 DEFINE(PT_GR15, offsetof(struct pt_reg << 151 DEFINE(PT_GR16, offsetof(struct pt_reg << 152 DEFINE(PT_GR17, offsetof(struct pt_reg << 153 DEFINE(PT_GR18, offsetof(struct pt_reg << 154 DEFINE(PT_GR19, offsetof(struct pt_reg << 155 DEFINE(PT_GR20, offsetof(struct pt_reg << 156 DEFINE(PT_GR21, offsetof(struct pt_reg << 157 DEFINE(PT_GR22, offsetof(struct pt_reg << 158 DEFINE(PT_GR23, offsetof(struct pt_reg << 159 DEFINE(PT_GR24, offsetof(struct pt_reg << 160 DEFINE(PT_GR25, offsetof(struct pt_reg << 161 DEFINE(PT_GR26, offsetof(struct pt_reg << 162 DEFINE(PT_GR27, offsetof(struct pt_reg << 163 DEFINE(PT_GR28, offsetof(struct pt_reg << 164 DEFINE(PT_GR29, offsetof(struct pt_reg << 165 DEFINE(PT_GR30, offsetof(struct pt_reg << 166 DEFINE(PT_GR31, offsetof(struct pt_reg << 167 DEFINE(PT_FR0, offsetof(struct pt_regs << 168 DEFINE(PT_FR1, offsetof(struct pt_regs << 169 DEFINE(PT_FR2, offsetof(struct pt_regs << 170 DEFINE(PT_FR3, offsetof(struct pt_regs << 171 DEFINE(PT_FR4, offsetof(struct pt_regs << 172 DEFINE(PT_FR5, offsetof(struct pt_regs << 173 DEFINE(PT_FR6, offsetof(struct pt_regs << 174 DEFINE(PT_FR7, offsetof(struct pt_regs << 175 DEFINE(PT_FR8, offsetof(struct pt_regs << 176 DEFINE(PT_FR9, offsetof(struct pt_regs << 177 DEFINE(PT_FR10, offsetof(struct pt_reg << 178 DEFINE(PT_FR11, offsetof(struct pt_reg << 179 DEFINE(PT_FR12, offsetof(struct pt_reg << 180 DEFINE(PT_FR13, offsetof(struct pt_reg << 181 DEFINE(PT_FR14, offsetof(struct pt_reg << 182 DEFINE(PT_FR15, offsetof(struct pt_reg << 183 DEFINE(PT_FR16, offsetof(struct pt_reg << 184 DEFINE(PT_FR17, offsetof(struct pt_reg << 185 DEFINE(PT_FR18, offsetof(struct pt_reg << 186 DEFINE(PT_FR19, offsetof(struct pt_reg << 187 DEFINE(PT_FR20, offsetof(struct pt_reg << 188 DEFINE(PT_FR21, offsetof(struct pt_reg << 189 DEFINE(PT_FR22, offsetof(struct pt_reg << 190 DEFINE(PT_FR23, offsetof(struct pt_reg << 191 DEFINE(PT_FR24, offsetof(struct pt_reg << 192 DEFINE(PT_FR25, offsetof(struct pt_reg << 193 DEFINE(PT_FR26, offsetof(struct pt_reg << 194 DEFINE(PT_FR27, offsetof(struct pt_reg << 195 DEFINE(PT_FR28, offsetof(struct pt_reg << 196 DEFINE(PT_FR29, offsetof(struct pt_reg << 197 DEFINE(PT_FR30, offsetof(struct pt_reg << 198 DEFINE(PT_FR31, offsetof(struct pt_reg << 199 DEFINE(PT_SR0, offsetof(struct pt_regs << 200 DEFINE(PT_SR1, offsetof(struct pt_regs << 201 DEFINE(PT_SR2, offsetof(struct pt_regs << 202 DEFINE(PT_SR3, offsetof(struct pt_regs << 203 DEFINE(PT_SR4, offsetof(struct pt_regs << 204 DEFINE(PT_SR5, offsetof(struct pt_regs << 205 DEFINE(PT_SR6, offsetof(struct pt_regs << 206 DEFINE(PT_SR7, offsetof(struct pt_regs << 207 DEFINE(PT_IASQ0, offsetof(struct pt_re << 208 DEFINE(PT_IASQ1, offsetof(struct pt_re << 209 DEFINE(PT_IAOQ0, offsetof(struct pt_re << 210 DEFINE(PT_IAOQ1, offsetof(struct pt_re << 211 DEFINE(PT_CR27, offsetof(struct pt_reg << 212 DEFINE(PT_ORIG_R28, offsetof(struct pt << 213 DEFINE(PT_KSP, offsetof(struct pt_regs << 214 DEFINE(PT_KPC, offsetof(struct pt_regs << 215 DEFINE(PT_SAR, offsetof(struct pt_regs << 216 DEFINE(PT_IIR, offsetof(struct pt_regs << 217 DEFINE(PT_ISR, offsetof(struct pt_regs << 218 DEFINE(PT_IOR, offsetof(struct pt_regs << 219 /* PT_SZ_ALGN includes space for a sta << 220 DEFINE(PT_SZ_ALGN, align_frame(sizeof( << 221 BLANK(); << 222 DEFINE(TI_FLAGS, offsetof(struct threa << 223 DEFINE(TI_PRE_COUNT, offsetof(struct t << 224 BLANK(); << 225 DEFINE(ASM_SIGFRAME_SIZE, PARISC_RT_SI << 226 DEFINE(SIGFRAME_CONTEXT_REGS, offsetof << 227 #ifdef CONFIG_64BIT << 228 DEFINE(ASM_SIGFRAME_SIZE32, PARISC_RT_ << 229 DEFINE(SIGFRAME_CONTEXT_REGS32, offset << 230 #else 28 #else 231 DEFINE(ASM_SIGFRAME_SIZE32, PARISC_RT_ !! 29 static int __used sparc64_foo(void) 232 DEFINE(SIGFRAME_CONTEXT_REGS32, offset !! 30 { 233 #endif !! 31 #ifdef CONFIG_HIBERNATION 234 BLANK(); << 235 DEFINE(ICACHE_BASE, offsetof(struct pd << 236 DEFINE(ICACHE_STRIDE, offsetof(struct << 237 DEFINE(ICACHE_COUNT, offsetof(struct p << 238 DEFINE(ICACHE_LOOP, offsetof(struct pd << 239 DEFINE(DCACHE_BASE, offsetof(struct pd << 240 DEFINE(DCACHE_STRIDE, offsetof(struct << 241 DEFINE(DCACHE_COUNT, offsetof(struct p << 242 DEFINE(DCACHE_LOOP, offsetof(struct pd << 243 DEFINE(ITLB_SID_BASE, offsetof(struct << 244 DEFINE(ITLB_SID_STRIDE, offsetof(struc << 245 DEFINE(ITLB_SID_COUNT, offsetof(struct << 246 DEFINE(ITLB_OFF_BASE, offsetof(struct << 247 DEFINE(ITLB_OFF_STRIDE, offsetof(struc << 248 DEFINE(ITLB_OFF_COUNT, offsetof(struct << 249 DEFINE(ITLB_LOOP, offsetof(struct pdc_ << 250 DEFINE(DTLB_SID_BASE, offsetof(struct << 251 DEFINE(DTLB_SID_STRIDE, offsetof(struc << 252 DEFINE(DTLB_SID_COUNT, offsetof(struct << 253 DEFINE(DTLB_OFF_BASE, offsetof(struct << 254 DEFINE(DTLB_OFF_STRIDE, offsetof(struc << 255 DEFINE(DTLB_OFF_COUNT, offsetof(struct << 256 DEFINE(DTLB_LOOP, offsetof(struct pdc_ << 257 BLANK(); << 258 DEFINE(TIF_BLOCKSTEP_PA_BIT, 31-TIF_BL << 259 DEFINE(TIF_SINGLESTEP_PA_BIT, 31-TIF_S << 260 BLANK(); << 261 DEFINE(ASM_PMD_SHIFT, PMD_SHIFT); << 262 DEFINE(ASM_PGDIR_SHIFT, PGDIR_SHIFT); << 263 DEFINE(ASM_BITS_PER_PGD, BITS_PER_PGD) << 264 DEFINE(ASM_BITS_PER_PMD, BITS_PER_PMD) << 265 DEFINE(ASM_BITS_PER_PTE, BITS_PER_PTE) << 266 DEFINE(ASM_PMD_ENTRY, ((PAGE_OFFSET & << 267 DEFINE(ASM_PGD_ENTRY, PAGE_OFFSET >> P << 268 DEFINE(ASM_PGD_ENTRY_SIZE, PGD_ENTRY_S << 269 DEFINE(ASM_PMD_ENTRY_SIZE, PMD_ENTRY_S << 270 DEFINE(ASM_PTE_ENTRY_SIZE, PTE_ENTRY_S << 271 DEFINE(ASM_PFN_PTE_SHIFT, PFN_PTE_SHIF << 272 DEFINE(ASM_PT_INITIAL, PT_INITIAL); << 273 BLANK(); 32 BLANK(); 274 /* HUGEPAGE_SIZE is only used in vmlin !! 33 OFFSET(SC_REG_FP, saved_context, fp); 275 * and kernel data on physical huge pa !! 34 OFFSET(SC_REG_CWP, saved_context, cwp); 276 #ifdef CONFIG_HUGETLB_PAGE !! 35 OFFSET(SC_REG_WSTATE, saved_context, wstate); 277 DEFINE(HUGEPAGE_SIZE, 1UL << REAL_HPAG !! 36 278 #elif !defined(CONFIG_64BIT) !! 37 OFFSET(SC_REG_TICK, saved_context, tick); 279 DEFINE(HUGEPAGE_SIZE, 4*1024*1024); !! 38 OFFSET(SC_REG_PSTATE, saved_context, pstate); 280 #else !! 39 281 DEFINE(HUGEPAGE_SIZE, PAGE_SIZE); !! 40 OFFSET(SC_REG_G4, saved_context, g4); >> 41 OFFSET(SC_REG_G5, saved_context, g5); >> 42 OFFSET(SC_REG_G6, saved_context, g6); 282 #endif 43 #endif >> 44 return 0; >> 45 } >> 46 #endif >> 47 >> 48 static int __used foo(void) >> 49 { 283 BLANK(); 50 BLANK(); 284 DEFINE(ASM_PDC_RESULT_SIZE, NUM_PDC_RE !! 51 DEFINE(AOFF_task_thread, offsetof(struct task_struct, thread)); 285 BLANK(); 52 BLANK(); >> 53 DEFINE(AOFF_mm_context, offsetof(struct mm_struct, context)); >> 54 BLANK(); >> 55 DEFINE(VMA_VM_MM, offsetof(struct vm_area_struct, vm_mm)); >> 56 >> 57 /* DEFINE(NUM_USER_SEGMENTS, TASK_SIZE>>28); */ 286 return 0; 58 return 0; 287 } 59 } >> 60 288 61
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.