PageRenderTime 42ms CodeModel.GetById 12ms app.highlight 11ms RepoModel.GetById 0ms app.codeStats 1ms

/arch/score/kernel/asm-offsets.c

https://bitbucket.org/thekraven/iscream_thunderc-2.6.35
C | 216 lines | 180 code | 12 blank | 24 comment | 0 complexity | ed0c89b51b9080b18ed58be5a95da95d MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  1/*
  2 * arch/score/kernel/asm-offsets.c
  3 *
  4 * Score Processor version.
  5 *
  6 * Copyright (C) 2009 Sunplus Core Technology Co., Ltd.
  7 *  Chen Liqin <liqin.chen@sunplusct.com>
  8 *  Lennox Wu <lennox.wu@sunplusct.com>
  9 *
 10 * This program is free software; you can redistribute it and/or modify
 11 * it under the terms of the GNU General Public License as published by
 12 * the Free Software Foundation; either version 2 of the License, or
 13 * (at your option) any later version.
 14 *
 15 * This program is distributed in the hope that it will be useful,
 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 18 * GNU General Public License for more details.
 19 *
 20 * You should have received a copy of the GNU General Public License
 21 * along with this program; if not, see the file COPYING, or write
 22 * to the Free Software Foundation, Inc.,
 23 * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 24 */
 25
 26#include <linux/kbuild.h>
 27#include <linux/interrupt.h>
 28#include <linux/mm.h>
 29#include <linux/sched.h>
 30
 31#include <asm-generic/cmpxchg-local.h>
 32
 33void output_ptreg_defines(void)
 34{
 35	COMMENT("SCORE pt_regs offsets.");
 36	OFFSET(PT_R0, pt_regs, regs[0]);
 37	OFFSET(PT_R1, pt_regs, regs[1]);
 38	OFFSET(PT_R2, pt_regs, regs[2]);
 39	OFFSET(PT_R3, pt_regs, regs[3]);
 40	OFFSET(PT_R4, pt_regs, regs[4]);
 41	OFFSET(PT_R5, pt_regs, regs[5]);
 42	OFFSET(PT_R6, pt_regs, regs[6]);
 43	OFFSET(PT_R7, pt_regs, regs[7]);
 44	OFFSET(PT_R8, pt_regs, regs[8]);
 45	OFFSET(PT_R9, pt_regs, regs[9]);
 46	OFFSET(PT_R10, pt_regs, regs[10]);
 47	OFFSET(PT_R11, pt_regs, regs[11]);
 48	OFFSET(PT_R12, pt_regs, regs[12]);
 49	OFFSET(PT_R13, pt_regs, regs[13]);
 50	OFFSET(PT_R14, pt_regs, regs[14]);
 51	OFFSET(PT_R15, pt_regs, regs[15]);
 52	OFFSET(PT_R16, pt_regs, regs[16]);
 53	OFFSET(PT_R17, pt_regs, regs[17]);
 54	OFFSET(PT_R18, pt_regs, regs[18]);
 55	OFFSET(PT_R19, pt_regs, regs[19]);
 56	OFFSET(PT_R20, pt_regs, regs[20]);
 57	OFFSET(PT_R21, pt_regs, regs[21]);
 58	OFFSET(PT_R22, pt_regs, regs[22]);
 59	OFFSET(PT_R23, pt_regs, regs[23]);
 60	OFFSET(PT_R24, pt_regs, regs[24]);
 61	OFFSET(PT_R25, pt_regs, regs[25]);
 62	OFFSET(PT_R26, pt_regs, regs[26]);
 63	OFFSET(PT_R27, pt_regs, regs[27]);
 64	OFFSET(PT_R28, pt_regs, regs[28]);
 65	OFFSET(PT_R29, pt_regs, regs[29]);
 66	OFFSET(PT_R30, pt_regs, regs[30]);
 67	OFFSET(PT_R31, pt_regs, regs[31]);
 68
 69	OFFSET(PT_ORIG_R4, pt_regs, orig_r4);
 70	OFFSET(PT_ORIG_R7, pt_regs, orig_r7);
 71	OFFSET(PT_CEL, pt_regs, cel);
 72	OFFSET(PT_CEH, pt_regs, ceh);
 73	OFFSET(PT_SR0, pt_regs, sr0);
 74	OFFSET(PT_SR1, pt_regs, sr1);
 75	OFFSET(PT_SR2, pt_regs, sr2);
 76	OFFSET(PT_EPC, pt_regs, cp0_epc);
 77	OFFSET(PT_EMA, pt_regs, cp0_ema);
 78	OFFSET(PT_PSR, pt_regs, cp0_psr);
 79	OFFSET(PT_ECR, pt_regs, cp0_ecr);
 80	OFFSET(PT_CONDITION, pt_regs, cp0_condition);
 81	OFFSET(PT_IS_SYSCALL, pt_regs, is_syscall);
 82
 83	DEFINE(PT_SIZE, sizeof(struct pt_regs));
 84	BLANK();
 85}
 86
 87void output_task_defines(void)
 88{
 89	COMMENT("SCORE task_struct offsets.");
 90	OFFSET(TASK_STATE, task_struct, state);
 91	OFFSET(TASK_THREAD_INFO, task_struct, stack);
 92	OFFSET(TASK_FLAGS, task_struct, flags);
 93	OFFSET(TASK_MM, task_struct, mm);
 94	OFFSET(TASK_PID, task_struct, pid);
 95	DEFINE(TASK_STRUCT_SIZE, sizeof(struct task_struct));
 96	BLANK();
 97}
 98
 99void output_thread_info_defines(void)
100{
101	COMMENT("SCORE thread_info offsets.");
102	OFFSET(TI_TASK, thread_info, task);
103	OFFSET(TI_EXEC_DOMAIN, thread_info, exec_domain);
104	OFFSET(TI_FLAGS, thread_info, flags);
105	OFFSET(TI_TP_VALUE, thread_info, tp_value);
106	OFFSET(TI_CPU, thread_info, cpu);
107	OFFSET(TI_PRE_COUNT, thread_info, preempt_count);
108	OFFSET(TI_ADDR_LIMIT, thread_info, addr_limit);
109	OFFSET(TI_RESTART_BLOCK, thread_info, restart_block);
110	OFFSET(TI_REGS, thread_info, regs);
111	DEFINE(KERNEL_STACK_SIZE, THREAD_SIZE);
112	DEFINE(KERNEL_STACK_MASK, THREAD_MASK);
113	BLANK();
114}
115
116void output_thread_defines(void)
117{
118	COMMENT("SCORE specific thread_struct offsets.");
119	OFFSET(THREAD_REG0, task_struct, thread.reg0);
120	OFFSET(THREAD_REG2, task_struct, thread.reg2);
121	OFFSET(THREAD_REG3, task_struct, thread.reg3);
122	OFFSET(THREAD_REG12, task_struct, thread.reg12);
123	OFFSET(THREAD_REG13, task_struct, thread.reg13);
124	OFFSET(THREAD_REG14, task_struct, thread.reg14);
125	OFFSET(THREAD_REG15, task_struct, thread.reg15);
126	OFFSET(THREAD_REG16, task_struct, thread.reg16);
127	OFFSET(THREAD_REG17, task_struct, thread.reg17);
128	OFFSET(THREAD_REG18, task_struct, thread.reg18);
129	OFFSET(THREAD_REG19, task_struct, thread.reg19);
130	OFFSET(THREAD_REG20, task_struct, thread.reg20);
131	OFFSET(THREAD_REG21, task_struct, thread.reg21);
132	OFFSET(THREAD_REG29, task_struct, thread.reg29);
133
134	OFFSET(THREAD_PSR, task_struct, thread.cp0_psr);
135	OFFSET(THREAD_EMA, task_struct, thread.cp0_ema);
136	OFFSET(THREAD_BADUADDR, task_struct, thread.cp0_baduaddr);
137	OFFSET(THREAD_ECODE, task_struct, thread.error_code);
138	OFFSET(THREAD_TRAPNO, task_struct, thread.trap_no);
139	BLANK();
140}
141
142void output_mm_defines(void)
143{
144	COMMENT("Size of struct page");
145	DEFINE(STRUCT_PAGE_SIZE, sizeof(struct page));
146	BLANK();
147	COMMENT("Linux mm_struct offsets.");
148	OFFSET(MM_USERS, mm_struct, mm_users);
149	OFFSET(MM_PGD, mm_struct, pgd);
150	OFFSET(MM_CONTEXT, mm_struct, context);
151	BLANK();
152	DEFINE(_PAGE_SIZE, PAGE_SIZE);
153	DEFINE(_PAGE_SHIFT, PAGE_SHIFT);
154	BLANK();
155	DEFINE(_PGD_T_SIZE, sizeof(pgd_t));
156	DEFINE(_PTE_T_SIZE, sizeof(pte_t));
157	BLANK();
158	DEFINE(_PGD_ORDER, PGD_ORDER);
159	DEFINE(_PTE_ORDER, PTE_ORDER);
160	BLANK();
161	DEFINE(_PGDIR_SHIFT, PGDIR_SHIFT);
162	BLANK();
163	DEFINE(_PTRS_PER_PGD, PTRS_PER_PGD);
164	DEFINE(_PTRS_PER_PTE, PTRS_PER_PTE);
165	BLANK();
166}
167
168void output_sc_defines(void)
169{
170	COMMENT("Linux sigcontext offsets.");
171	OFFSET(SC_REGS, sigcontext, sc_regs);
172	OFFSET(SC_MDCEH, sigcontext, sc_mdceh);
173	OFFSET(SC_MDCEL, sigcontext, sc_mdcel);
174	OFFSET(SC_PC, sigcontext, sc_pc);
175	OFFSET(SC_PSR, sigcontext, sc_psr);
176	OFFSET(SC_ECR, sigcontext, sc_ecr);
177	OFFSET(SC_EMA, sigcontext, sc_ema);
178	BLANK();
179}
180
181void output_signal_defined(void)
182{
183	COMMENT("Linux signal numbers.");
184	DEFINE(_SIGHUP, SIGHUP);
185	DEFINE(_SIGINT, SIGINT);
186	DEFINE(_SIGQUIT, SIGQUIT);
187	DEFINE(_SIGILL, SIGILL);
188	DEFINE(_SIGTRAP, SIGTRAP);
189	DEFINE(_SIGIOT, SIGIOT);
190	DEFINE(_SIGABRT, SIGABRT);
191	DEFINE(_SIGFPE, SIGFPE);
192	DEFINE(_SIGKILL, SIGKILL);
193	DEFINE(_SIGBUS, SIGBUS);
194	DEFINE(_SIGSEGV, SIGSEGV);
195	DEFINE(_SIGSYS, SIGSYS);
196	DEFINE(_SIGPIPE, SIGPIPE);
197	DEFINE(_SIGALRM, SIGALRM);
198	DEFINE(_SIGTERM, SIGTERM);
199	DEFINE(_SIGUSR1, SIGUSR1);
200	DEFINE(_SIGUSR2, SIGUSR2);
201	DEFINE(_SIGCHLD, SIGCHLD);
202	DEFINE(_SIGPWR, SIGPWR);
203	DEFINE(_SIGWINCH, SIGWINCH);
204	DEFINE(_SIGURG, SIGURG);
205	DEFINE(_SIGIO, SIGIO);
206	DEFINE(_SIGSTOP, SIGSTOP);
207	DEFINE(_SIGTSTP, SIGTSTP);
208	DEFINE(_SIGCONT, SIGCONT);
209	DEFINE(_SIGTTIN, SIGTTIN);
210	DEFINE(_SIGTTOU, SIGTTOU);
211	DEFINE(_SIGVTALRM, SIGVTALRM);
212	DEFINE(_SIGPROF, SIGPROF);
213	DEFINE(_SIGXCPU, SIGXCPU);
214	DEFINE(_SIGXFSZ, SIGXFSZ);
215	BLANK();
216}