1/* 2 * This program is used to generate definitions needed by 3 * assembly language modules. 4 * 5 * We use the technique used in the OSF Mach kernel code: 6 * generate asm statements containing #defines, 7 * compile this file to assembler, and then extract the 8 * #defines from the assembly-language output. 9 * 10 * This program is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU General Public License 12 * as published by the Free Software Foundation; either version 13 * 2 of the License, or (at your option) any later version. 14 */ 15 16#include <stddef.h> 17#include <linux/config.h> 18#include <linux/signal.h> 19#include <linux/sched.h> 20#include <linux/kernel.h> 21#include <linux/errno.h> 22#include <linux/string.h> 23#include <linux/types.h> 24#include <linux/ptrace.h> 25#include <linux/mman.h> 26#include <linux/mm.h> 27#include <asm/io.h> 28#include <asm/page.h> 29#include <asm/pgtable.h> 30#include <asm/processor.h> 31#include <asm/hardirq.h> 32 33#include <asm/naca.h> 34#include <asm/paca.h> 35#include <asm/iSeries/ItLpPaca.h> 36#include <asm/iSeries/ItLpQueue.h> 37#include <asm/iSeries/HvLpEvent.h> 38#include <asm/prom.h> 39#include <asm/rtas.h> 40 41#define DEFINE(sym, val) \ 42 asm volatile("\n#define\t" #sym "\t%0" : : "i" (val)) 43 44int 45main(void) 46{ 47 DEFINE(SIGPENDING, offsetof(struct task_struct, sigpending)); 48 DEFINE(THREAD, offsetof(struct task_struct, thread)); 49 DEFINE(MM, offsetof(struct task_struct, mm)); 50 DEFINE(TASK_STRUCT_SIZE, sizeof(struct task_struct)); 51 DEFINE(KSP, offsetof(struct thread_struct, ksp)); 52 53 DEFINE(PACA, offsetof(struct naca_struct, paca)); 54 DEFINE(PACA_SIZE, sizeof(struct paca_struct)); 55 56 DEFINE(DCACHEL1LINESIZE, offsetof(struct naca_struct, dCacheL1LineSize)); 57 DEFINE(DCACHEL1LOGLINESIZE, offsetof(struct naca_struct, dCacheL1LogLineSize)); 58 DEFINE(DCACHEL1LINESPERPAGE, offsetof(struct naca_struct, dCacheL1LinesPerPage)); 59 60 DEFINE(ICACHEL1LINESIZE, offsetof(struct naca_struct, iCacheL1LineSize)); 61 DEFINE(ICACHEL1LOGLINESIZE, offsetof(struct naca_struct, iCacheL1LogLineSize)); 62 DEFINE(ICACHEL1LINESPERPAGE, offsetof(struct naca_struct, iCacheL1LinesPerPage)); 63 DEFINE(SLBSIZE, offsetof(struct naca_struct, slb_size)); 64 DEFINE(PLATFORM, offsetof(struct naca_struct, platform)); 65 66 DEFINE(PACAPACAINDEX, offsetof(struct paca_struct, xPacaIndex)); 67 DEFINE(PACAPROCSTART, offsetof(struct paca_struct, xProcStart)); 68 DEFINE(PACAKSAVE, offsetof(struct paca_struct, xKsave)); 69 DEFINE(PACACURRENT, offsetof(struct paca_struct, xCurrent)); 70 DEFINE(PACASAVEDMSR, offsetof(struct paca_struct, xSavedMsr)); 71 DEFINE(PACASTABREAL, offsetof(struct paca_struct, xStab_data.real)); 72 DEFINE(PACASTABVIRT, offsetof(struct paca_struct, xStab_data.virt)); 73 DEFINE(PACASTABRR, offsetof(struct paca_struct, xStab_data.next_round_robin)); 74 DEFINE(PACAR1, offsetof(struct paca_struct, xR1)); 75 DEFINE(PACALPQUEUE, offsetof(struct paca_struct, lpQueuePtr)); 76 DEFINE(PACATOC, offsetof(struct paca_struct, xTOC)); 77 DEFINE(PACAEXCSP, offsetof(struct paca_struct, exception_sp)); 78 DEFINE(PACAHRDWINTSTACK, offsetof(struct paca_struct, xHrdIntStack)); 79 DEFINE(PACAPROCENABLED, offsetof(struct paca_struct, xProcEnabled)); 80 DEFINE(PACAHRDWINTCOUNT, offsetof(struct paca_struct, xHrdIntCount)); 81 DEFINE(PACADEFAULTDECR, offsetof(struct paca_struct, default_decr)); 82 83 DEFINE(PACAPROFMODE, offsetof(struct paca_struct, prof_mode)); 84 DEFINE(PACAPROFLEN, offsetof(struct paca_struct, prof_len)); 85 DEFINE(PACAPROFSHIFT, offsetof(struct paca_struct, prof_shift)); 86 DEFINE(PACAPROFBUFFER, offsetof(struct paca_struct, prof_buffer)); 87 DEFINE(PACAPROFSTEXT, offsetof(struct paca_struct, prof_stext)); 88 DEFINE(PACAPROFETEXT, offsetof(struct paca_struct, prof_etext)); 89 DEFINE(PACAPMC1, offsetof(struct paca_struct, pmc[0])); 90 DEFINE(PACAPMC2, offsetof(struct paca_struct, pmc[1])); 91 DEFINE(PACAPMC3, offsetof(struct paca_struct, pmc[2])); 92 DEFINE(PACAPMC4, offsetof(struct paca_struct, pmc[3])); 93 DEFINE(PACAPMC5, offsetof(struct paca_struct, pmc[4])); 94 DEFINE(PACAPMC6, offsetof(struct paca_struct, pmc[5])); 95 DEFINE(PACAPMC7, offsetof(struct paca_struct, pmc[6])); 96 DEFINE(PACAPMC8, offsetof(struct paca_struct, pmc[7])); 97 DEFINE(PACAMMCR0, offsetof(struct paca_struct, pmc[8])); 98 DEFINE(PACAMMCR1, offsetof(struct paca_struct, pmc[9])); 99 DEFINE(PACAMMCRA, offsetof(struct paca_struct, pmc[10])); 100 DEFINE(PACAPMCC1, offsetof(struct paca_struct, pmcc[0])); 101 DEFINE(PACAPMCC2, offsetof(struct paca_struct, pmcc[1])); 102 DEFINE(PACAPMCC3, offsetof(struct paca_struct, pmcc[2])); 103 DEFINE(PACAPMCC4, offsetof(struct paca_struct, pmcc[3])); 104 DEFINE(PACAPMCC5, offsetof(struct paca_struct, pmcc[4])); 105 DEFINE(PACAPMCC6, offsetof(struct paca_struct, pmcc[5])); 106 DEFINE(PACAPMCC7, offsetof(struct paca_struct, pmcc[6])); 107 DEFINE(PACAPMCC8, offsetof(struct paca_struct, pmcc[7])); 108 109 DEFINE(PACALPPACA, offsetof(struct paca_struct, xLpPaca)); 110 DEFINE(LPPACA, offsetof(struct paca_struct, xLpPaca)); 111 DEFINE(PACAREGSAV, offsetof(struct paca_struct, xRegSav)); 112 DEFINE(PACAEXC, offsetof(struct paca_struct, exception_stack)); 113 DEFINE(PACAGUARD, offsetof(struct paca_struct, guard)); 114 DEFINE(LPPACASRR0, offsetof(struct ItLpPaca, xSavedSrr0)); 115 DEFINE(LPPACASRR1, offsetof(struct ItLpPaca, xSavedSrr1)); 116 DEFINE(LPPACAANYINT, offsetof(struct ItLpPaca, xIntDword.xAnyInt)); 117 DEFINE(LPPACADECRINT, offsetof(struct ItLpPaca, xIntDword.xFields.xDecrInt)); 118 DEFINE(LPPACAPDCINT, offsetof(struct ItLpPaca, xIntDword.xFields.xPdcInt)); 119 DEFINE(LPQCUREVENTPTR, offsetof(struct ItLpQueue, xSlicCurEventPtr)); 120 DEFINE(LPQOVERFLOW, offsetof(struct ItLpQueue, xPlicOverflowIntPending)); 121 DEFINE(LPEVENTFLAGS, offsetof(struct HvLpEvent, xFlags)); 122 DEFINE(PROMENTRY, offsetof(struct prom_t, entry)); 123 124 DEFINE(RTASBASE, offsetof(struct rtas_t, base)); 125 DEFINE(RTASENTRY, offsetof(struct rtas_t, entry)); 126 DEFINE(RTASSIZE, offsetof(struct rtas_t, size)); 127 128 DEFINE(LAST_SYSCALL, offsetof(struct thread_struct, last_syscall)); 129 DEFINE(PT_REGS, offsetof(struct thread_struct, regs)); 130 DEFINE(PT_TRACESYS, PT_TRACESYS); 131 DEFINE(TASK_PTRACE, offsetof(struct task_struct, ptrace)); 132 DEFINE(NEED_RESCHED, offsetof(struct task_struct, need_resched)); 133 DEFINE(THREAD_FPR0, offsetof(struct thread_struct, fpr[0])); 134 DEFINE(THREAD_FPSCR, offsetof(struct thread_struct, fpscr)); 135 DEFINE(THREAD_FLAGS, offsetof(struct thread_struct, flags)); 136 DEFINE(PPC_FLAG_32BIT, PPC_FLAG_32BIT); 137 /* Interrupt register frame */ 138 DEFINE(TASK_UNION_SIZE, sizeof(union task_union)); 139 DEFINE(STACK_FRAME_OVERHEAD, STACK_FRAME_OVERHEAD); 140 /* 288 = # of volatile regs, int & fp, for leaf routines */ 141 /* which do not stack a frame. See the PPC64 ABI. */ 142 DEFINE(INT_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 288); 143 /* Create extra stack space for SRR0 and SRR1 when calling prom/rtas. */ 144 DEFINE(PROM_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16 + 288); 145 DEFINE(RTAS_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16 + 288); 146 DEFINE(GPR0, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[0])); 147 DEFINE(GPR1, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[1])); 148 DEFINE(GPR2, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[2])); 149 DEFINE(GPR3, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[3])); 150 DEFINE(GPR4, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[4])); 151 DEFINE(GPR5, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[5])); 152 DEFINE(GPR6, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[6])); 153 DEFINE(GPR7, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[7])); 154 DEFINE(GPR8, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[8])); 155 DEFINE(GPR9, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[9])); 156 DEFINE(GPR20, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[20])); 157 DEFINE(GPR21, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[21])); 158 DEFINE(GPR22, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[22])); 159 DEFINE(GPR23, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[23])); 160 /* Note: these symbols include _ because they overlap with special 161 * register names 162 */ 163 DEFINE(_NIP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, nip)); 164 DEFINE(_MSR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, msr)); 165 DEFINE(_CTR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, ctr)); 166 DEFINE(_LINK, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, link)); 167 DEFINE(_CCR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, ccr)); 168 DEFINE(_XER, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, xer)); 169 DEFINE(_DAR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dar)); 170 DEFINE(_DSISR, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, dsisr)); 171 DEFINE(ORIG_GPR3, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, orig_gpr3)); 172 DEFINE(RESULT, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, result)); 173 DEFINE(TRAP, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, trap)); 174 DEFINE(SOFTE, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, softe)); 175 176 /* These _only_ to be used with {PROM,RTAS}_FRAME_SIZE!!! */ 177 DEFINE(_SRR0, STACK_FRAME_OVERHEAD+sizeof(struct pt_regs)); 178 DEFINE(_SRR1, STACK_FRAME_OVERHEAD+sizeof(struct pt_regs)+8); 179 180 DEFINE(CLONE_VM, CLONE_VM); 181 182 return 0; 183} 184