~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mips/tools/offset.c

Version: ~ [ linux-6.4-rc3 ] ~ [ linux-6.3.4 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.30 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.113 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.180 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.243 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.283 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.315 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * offset.c: Calculate pt_regs and task_struct offsets.
  3  *
  4  * Copyright (C) 1996 David S. Miller
  5  * Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Ralf Baechle
  6  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
  7  *
  8  * Kevin Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
  9  * Copyright (C) 2000 MIPS Technologies, Inc.
 10  */
 11 #include <linux/config.h>
 12 #include <linux/types.h>
 13 #include <linux/sched.h>
 14 #include <linux/mm.h>
 15 
 16 #include <asm/ptrace.h>
 17 #include <asm/processor.h>
 18 
 19 #define text(t) __asm__("\n@@@" t)
 20 #define _offset(type, member) (&(((type *)NULL)->member))
 21 
 22 #define offset(string, ptr, member) \
 23         __asm__("\n@@@" string "%0" : : "i" (_offset(ptr, member)))
 24 #define constant(string, member) \
 25         __asm__("\n@@@" string "%x0" : : "ri" (member))
 26 #define size(string, size) \
 27         __asm__("\n@@@" string "%0" : : "i" (sizeof(size)))
 28 #define linefeed text("")
 29 
 30 text("/* DO NOT TOUCH, AUTOGENERATED BY OFFSET.C */");
 31 linefeed;
 32 text("#ifndef _MIPS_OFFSET_H");
 33 text("#define _MIPS_OFFSET_H");
 34 linefeed;
 35 
 36 void output_ptreg_defines(void)
 37 {
 38         text("/* MIPS pt_regs offsets. */");
 39         offset("#define PT_R0     ", struct pt_regs, regs[0]);
 40         offset("#define PT_R1     ", struct pt_regs, regs[1]);
 41         offset("#define PT_R2     ", struct pt_regs, regs[2]);
 42         offset("#define PT_R3     ", struct pt_regs, regs[3]);
 43         offset("#define PT_R4     ", struct pt_regs, regs[4]);
 44         offset("#define PT_R5     ", struct pt_regs, regs[5]);
 45         offset("#define PT_R6     ", struct pt_regs, regs[6]);
 46         offset("#define PT_R7     ", struct pt_regs, regs[7]);
 47         offset("#define PT_R8     ", struct pt_regs, regs[8]);
 48         offset("#define PT_R9     ", struct pt_regs, regs[9]);
 49         offset("#define PT_R10    ", struct pt_regs, regs[10]);
 50         offset("#define PT_R11    ", struct pt_regs, regs[11]);
 51         offset("#define PT_R12    ", struct pt_regs, regs[12]);
 52         offset("#define PT_R13    ", struct pt_regs, regs[13]);
 53         offset("#define PT_R14    ", struct pt_regs, regs[14]);
 54         offset("#define PT_R15    ", struct pt_regs, regs[15]);
 55         offset("#define PT_R16    ", struct pt_regs, regs[16]);
 56         offset("#define PT_R17    ", struct pt_regs, regs[17]);
 57         offset("#define PT_R18    ", struct pt_regs, regs[18]);
 58         offset("#define PT_R19    ", struct pt_regs, regs[19]);
 59         offset("#define PT_R20    ", struct pt_regs, regs[20]);
 60         offset("#define PT_R21    ", struct pt_regs, regs[21]);
 61         offset("#define PT_R22    ", struct pt_regs, regs[22]);
 62         offset("#define PT_R23    ", struct pt_regs, regs[23]);
 63         offset("#define PT_R24    ", struct pt_regs, regs[24]);
 64         offset("#define PT_R25    ", struct pt_regs, regs[25]);
 65         offset("#define PT_R26    ", struct pt_regs, regs[26]);
 66         offset("#define PT_R27    ", struct pt_regs, regs[27]);
 67         offset("#define PT_R28    ", struct pt_regs, regs[28]);
 68         offset("#define PT_R29    ", struct pt_regs, regs[29]);
 69         offset("#define PT_R30    ", struct pt_regs, regs[30]);
 70         offset("#define PT_R31    ", struct pt_regs, regs[31]);
 71         offset("#define PT_LO     ", struct pt_regs, lo);
 72         offset("#define PT_HI     ", struct pt_regs, hi);
 73         offset("#define PT_EPC    ", struct pt_regs, cp0_epc);
 74         offset("#define PT_BVADDR ", struct pt_regs, cp0_badvaddr);
 75         offset("#define PT_STATUS ", struct pt_regs, cp0_status);
 76         offset("#define PT_CAUSE  ", struct pt_regs, cp0_cause);
 77         size("#define PT_SIZE   ", struct pt_regs);
 78         linefeed;
 79 }
 80 
 81 void output_task_defines(void)
 82 {
 83         text("/* MIPS task_struct offsets. */");
 84         offset("#define TASK_STATE         ", struct task_struct, state);
 85         offset("#define TASK_FLAGS         ", struct task_struct, flags);
 86         constant("  #define _PT_TRACESYS        ", PT_TRACESYS);
 87         offset("#define TASK_SIGPENDING    ", struct task_struct, sigpending);
 88         offset("#define TASK_NEED_RESCHED  ", struct task_struct, need_resched);
 89         offset("#define TASK_PTRACE        ", struct task_struct, ptrace);
 90         offset("#define TASK_COUNTER       ", struct task_struct, counter);
 91         offset("#define TASK_NICE          ", struct task_struct, nice);
 92         offset("#define TASK_MM            ", struct task_struct, mm);
 93         offset("#define TASK_PROCESSOR     ", struct task_struct, processor);
 94         offset("#define TASK_PID           ", struct task_struct, pid);
 95         size(  "#define TASK_STRUCT_SIZE   ", struct task_struct);
 96         linefeed;
 97 
 98         text("/* MIPS task_struct allocation info. */");
 99         constant("#define _THREAD_ORDER    ", THREAD_ORDER);
100         constant("#define _THREAD_SIZE     ", THREAD_SIZE);
101         constant("#define _THREAD_MASK     ", THREAD_MASK);
102         linefeed;
103 }
104 
105 void output_thread_defines(void)
106 {
107         text("/* MIPS specific thread_struct offsets. */");
108         offset("#define THREAD_REG16   ", struct task_struct, thread.reg16);
109         offset("#define THREAD_REG17   ", struct task_struct, thread.reg17);
110         offset("#define THREAD_REG18   ", struct task_struct, thread.reg18);
111         offset("#define THREAD_REG19   ", struct task_struct, thread.reg19);
112         offset("#define THREAD_REG20   ", struct task_struct, thread.reg20);
113         offset("#define THREAD_REG21   ", struct task_struct, thread.reg21);
114         offset("#define THREAD_REG22   ", struct task_struct, thread.reg22);
115         offset("#define THREAD_REG23   ", struct task_struct, thread.reg23);
116         offset("#define THREAD_REG29   ", struct task_struct, thread.reg29);
117         offset("#define THREAD_REG30   ", struct task_struct, thread.reg30);
118         offset("#define THREAD_REG31   ", struct task_struct, thread.reg31);
119         offset("#define THREAD_STATUS  ", struct task_struct, \
120                thread.cp0_status);
121         offset("#define THREAD_FPU     ", struct task_struct, thread.fpu);
122         offset("#define THREAD_BVADDR  ", struct task_struct, \
123                thread.cp0_badvaddr);
124         offset("#define THREAD_BUADDR  ", struct task_struct, \
125                thread.cp0_baduaddr);
126         offset("#define THREAD_ECODE   ", struct task_struct, \
127                thread.error_code);
128         offset("#define THREAD_TRAPNO  ", struct task_struct, thread.trap_no);
129         offset("#define THREAD_MFLAGS  ", struct task_struct, thread.mflags);
130         offset("#define THREAD_CURDS   ", struct task_struct, \
131                thread.current_ds);
132         offset("#define THREAD_TRAMP   ", struct task_struct, \
133                thread.irix_trampoline);
134         offset("#define THREAD_OLDCTX  ", struct task_struct, \
135                thread.irix_oldctx);
136         linefeed;
137 }
138 
139 void output_mm_defines(void)
140 {
141         text("/* Linux mm_struct offsets. */");
142         offset("#define MM_USERS      ", struct mm_struct, mm_users);
143         offset("#define MM_PGD        ", struct mm_struct, pgd);
144         offset("#define MM_CONTEXT    ", struct mm_struct, context);
145         linefeed;
146         constant("#define _PAGE_SIZE     ", PAGE_SIZE);
147         constant("#define _PAGE_SHIFT    ", PAGE_SHIFT);
148         linefeed;
149         constant("#define _PGD_T_SIZE    ", sizeof(pgd_t));
150         constant("#define _PMD_T_SIZE    ", sizeof(pmd_t));
151         constant("#define _PTE_T_SIZE    ", sizeof(pte_t));
152         linefeed;
153         constant("#define _PGD_T_LOG2    ", PGD_T_LOG2);
154         constant("#define _PMD_T_LOG2    ", PMD_T_LOG2);
155         constant("#define _PTE_T_LOG2    ", PTE_T_LOG2);
156         linefeed;
157         constant("#define _PMD_SHIFT     ", PMD_SHIFT);
158         constant("#define _PGDIR_SHIFT   ", PGDIR_SHIFT);
159         linefeed;
160         constant("#define _PGD_ORDER     ", PGD_ORDER);
161 #ifdef PMD_ORDER
162         constant("#define _PMD_ORDER     ", PMD_ORDER);
163 #endif
164         constant("#define _PTE_ORDER     ", PTE_ORDER);
165         linefeed;
166         constant("#define _PTRS_PER_PGD  ", PTRS_PER_PGD);
167         constant("#define _PTRS_PER_PMD  ", PTRS_PER_PMD);
168         constant("#define _PTRS_PER_PTE  ", PTRS_PER_PTE);
169         linefeed;
170 }
171 
172 void output_sc_defines(void)
173 {
174         text("/* Linux sigcontext offsets. */");
175         offset("#define SC_REGS       ", struct sigcontext, sc_regs);
176         offset("#define SC_FPREGS     ", struct sigcontext, sc_fpregs);
177         offset("#define SC_MDHI       ", struct sigcontext, sc_mdhi);
178         offset("#define SC_MDLO       ", struct sigcontext, sc_mdlo);
179         offset("#define SC_PC         ", struct sigcontext, sc_pc);
180         offset("#define SC_STATUS     ", struct sigcontext, sc_status);
181         offset("#define SC_FPC_CSR    ", struct sigcontext, sc_fpc_csr);
182         offset("#define SC_FPC_EIR    ", struct sigcontext, sc_fpc_eir);
183         offset("#define SC_CAUSE      ", struct sigcontext, sc_cause);
184         offset("#define SC_BADVADDR   ", struct sigcontext, sc_badvaddr);
185         linefeed;
186 
187 #ifdef CONFIG_MIPS64
188         text("/* Linux 32-bit sigcontext offsets. */");
189         offset("#define SC32_FPREGS     ", struct sigcontext32, sc_fpregs);
190         offset("#define SC32_FPC_CSR    ", struct sigcontext32, sc_fpc_csr);
191         offset("#define SC32_FPC_EIR    ", struct sigcontext32, sc_fpc_eir);
192         linefeed;
193 #endif
194 }
195 
196 void output_signal_defined(void)
197 {
198         text("/* Linux signal numbers. */");
199         constant("#define _SIGHUP     ", SIGHUP);
200         constant("#define _SIGINT     ", SIGINT);
201         constant("#define _SIGQUIT    ", SIGQUIT);
202         constant("#define _SIGILL     ", SIGILL);
203         constant("#define _SIGTRAP    ", SIGTRAP);
204         constant("#define _SIGIOT     ", SIGIOT);
205         constant("#define _SIGABRT    ", SIGABRT);
206         constant("#define _SIGEMT     ", SIGEMT);
207         constant("#define _SIGFPE     ", SIGFPE);
208         constant("#define _SIGKILL    ", SIGKILL);
209         constant("#define _SIGBUS     ", SIGBUS);
210         constant("#define _SIGSEGV    ", SIGSEGV);
211         constant("#define _SIGSYS     ", SIGSYS);
212         constant("#define _SIGPIPE    ", SIGPIPE);
213         constant("#define _SIGALRM    ", SIGALRM);
214         constant("#define _SIGTERM    ", SIGTERM);
215         constant("#define _SIGUSR1    ", SIGUSR1);
216         constant("#define _SIGUSR2    ", SIGUSR2);
217         constant("#define _SIGCHLD    ", SIGCHLD);
218         constant("#define _SIGPWR     ", SIGPWR);
219         constant("#define _SIGWINCH   ", SIGWINCH);
220         constant("#define _SIGURG     ", SIGURG);
221         constant("#define _SIGIO      ", SIGIO);
222         constant("#define _SIGSTOP    ", SIGSTOP);
223         constant("#define _SIGTSTP    ", SIGTSTP);
224         constant("#define _SIGCONT    ", SIGCONT);
225         constant("#define _SIGTTIN    ", SIGTTIN);
226         constant("#define _SIGTTOU    ", SIGTTOU);
227         constant("#define _SIGVTALRM  ", SIGVTALRM);
228         constant("#define _SIGPROF    ", SIGPROF);
229         constant("#define _SIGXCPU    ", SIGXCPU);
230         constant("#define _SIGXFSZ    ", SIGXFSZ);
231 }
232 
233 text("#endif /* !(_MIPS_OFFSET_H) */");
234 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp