asm-offsets.c 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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. #include <linux/kbuild.h>
  26. #include <linux/interrupt.h>
  27. #include <linux/mm.h>
  28. #include <linux/sched.h>
  29. #include <asm-generic/cmpxchg-local.h>
  30. void output_ptreg_defines(void)
  31. {
  32. COMMENT("SCORE pt_regs offsets.");
  33. OFFSET(PT_R0, pt_regs, regs[0]);
  34. OFFSET(PT_R1, pt_regs, regs[1]);
  35. OFFSET(PT_R2, pt_regs, regs[2]);
  36. OFFSET(PT_R3, pt_regs, regs[3]);
  37. OFFSET(PT_R4, pt_regs, regs[4]);
  38. OFFSET(PT_R5, pt_regs, regs[5]);
  39. OFFSET(PT_R6, pt_regs, regs[6]);
  40. OFFSET(PT_R7, pt_regs, regs[7]);
  41. OFFSET(PT_R8, pt_regs, regs[8]);
  42. OFFSET(PT_R9, pt_regs, regs[9]);
  43. OFFSET(PT_R10, pt_regs, regs[10]);
  44. OFFSET(PT_R11, pt_regs, regs[11]);
  45. OFFSET(PT_R12, pt_regs, regs[12]);
  46. OFFSET(PT_R13, pt_regs, regs[13]);
  47. OFFSET(PT_R14, pt_regs, regs[14]);
  48. OFFSET(PT_R15, pt_regs, regs[15]);
  49. OFFSET(PT_R16, pt_regs, regs[16]);
  50. OFFSET(PT_R17, pt_regs, regs[17]);
  51. OFFSET(PT_R18, pt_regs, regs[18]);
  52. OFFSET(PT_R19, pt_regs, regs[19]);
  53. OFFSET(PT_R20, pt_regs, regs[20]);
  54. OFFSET(PT_R21, pt_regs, regs[21]);
  55. OFFSET(PT_R22, pt_regs, regs[22]);
  56. OFFSET(PT_R23, pt_regs, regs[23]);
  57. OFFSET(PT_R24, pt_regs, regs[24]);
  58. OFFSET(PT_R25, pt_regs, regs[25]);
  59. OFFSET(PT_R26, pt_regs, regs[26]);
  60. OFFSET(PT_R27, pt_regs, regs[27]);
  61. OFFSET(PT_R28, pt_regs, regs[28]);
  62. OFFSET(PT_R29, pt_regs, regs[29]);
  63. OFFSET(PT_R30, pt_regs, regs[30]);
  64. OFFSET(PT_R31, pt_regs, regs[31]);
  65. OFFSET(PT_ORIG_R4, pt_regs, orig_r4);
  66. OFFSET(PT_ORIG_R7, pt_regs, orig_r7);
  67. OFFSET(PT_CEL, pt_regs, cel);
  68. OFFSET(PT_CEH, pt_regs, ceh);
  69. OFFSET(PT_SR0, pt_regs, sr0);
  70. OFFSET(PT_SR1, pt_regs, sr1);
  71. OFFSET(PT_SR2, pt_regs, sr2);
  72. OFFSET(PT_EPC, pt_regs, cp0_epc);
  73. OFFSET(PT_EMA, pt_regs, cp0_ema);
  74. OFFSET(PT_PSR, pt_regs, cp0_psr);
  75. OFFSET(PT_ECR, pt_regs, cp0_ecr);
  76. OFFSET(PT_CONDITION, pt_regs, cp0_condition);
  77. OFFSET(PT_IS_SYSCALL, pt_regs, is_syscall);
  78. DEFINE(PT_SIZE, sizeof(struct pt_regs));
  79. BLANK();
  80. }
  81. void output_task_defines(void)
  82. {
  83. COMMENT("SCORE task_struct offsets.");
  84. OFFSET(TASK_STATE, task_struct, state);
  85. OFFSET(TASK_THREAD_INFO, task_struct, stack);
  86. OFFSET(TASK_FLAGS, task_struct, flags);
  87. OFFSET(TASK_MM, task_struct, mm);
  88. OFFSET(TASK_PID, task_struct, pid);
  89. DEFINE(TASK_STRUCT_SIZE, sizeof(struct task_struct));
  90. BLANK();
  91. }
  92. void output_thread_info_defines(void)
  93. {
  94. COMMENT("SCORE thread_info offsets.");
  95. OFFSET(TI_TASK, thread_info, task);
  96. OFFSET(TI_EXEC_DOMAIN, thread_info, exec_domain);
  97. OFFSET(TI_FLAGS, thread_info, flags);
  98. OFFSET(TI_TP_VALUE, thread_info, tp_value);
  99. OFFSET(TI_CPU, thread_info, cpu);
  100. OFFSET(TI_PRE_COUNT, thread_info, preempt_count);
  101. OFFSET(TI_ADDR_LIMIT, thread_info, addr_limit);
  102. OFFSET(TI_RESTART_BLOCK, thread_info, restart_block);
  103. OFFSET(TI_REGS, thread_info, regs);
  104. DEFINE(KERNEL_STACK_SIZE, THREAD_SIZE);
  105. DEFINE(KERNEL_STACK_MASK, THREAD_MASK);
  106. BLANK();
  107. }
  108. void output_thread_defines(void)
  109. {
  110. COMMENT("SCORE specific thread_struct offsets.");
  111. OFFSET(THREAD_REG0, task_struct, thread.reg0);
  112. OFFSET(THREAD_REG2, task_struct, thread.reg2);
  113. OFFSET(THREAD_REG3, task_struct, thread.reg3);
  114. OFFSET(THREAD_REG12, task_struct, thread.reg12);
  115. OFFSET(THREAD_REG13, task_struct, thread.reg13);
  116. OFFSET(THREAD_REG14, task_struct, thread.reg14);
  117. OFFSET(THREAD_REG15, task_struct, thread.reg15);
  118. OFFSET(THREAD_REG16, task_struct, thread.reg16);
  119. OFFSET(THREAD_REG17, task_struct, thread.reg17);
  120. OFFSET(THREAD_REG18, task_struct, thread.reg18);
  121. OFFSET(THREAD_REG19, task_struct, thread.reg19);
  122. OFFSET(THREAD_REG20, task_struct, thread.reg20);
  123. OFFSET(THREAD_REG21, task_struct, thread.reg21);
  124. OFFSET(THREAD_REG29, task_struct, thread.reg29);
  125. OFFSET(THREAD_PSR, task_struct, thread.cp0_psr);
  126. OFFSET(THREAD_EMA, task_struct, thread.cp0_ema);
  127. OFFSET(THREAD_BADUADDR, task_struct, thread.cp0_baduaddr);
  128. OFFSET(THREAD_ECODE, task_struct, thread.error_code);
  129. OFFSET(THREAD_TRAPNO, task_struct, thread.trap_no);
  130. BLANK();
  131. }
  132. void output_mm_defines(void)
  133. {
  134. COMMENT("Size of struct page");
  135. DEFINE(STRUCT_PAGE_SIZE, sizeof(struct page));
  136. BLANK();
  137. COMMENT("Linux mm_struct offsets.");
  138. OFFSET(MM_USERS, mm_struct, mm_users);
  139. OFFSET(MM_PGD, mm_struct, pgd);
  140. OFFSET(MM_CONTEXT, mm_struct, context);
  141. BLANK();
  142. DEFINE(_PAGE_SIZE, PAGE_SIZE);
  143. DEFINE(_PAGE_SHIFT, PAGE_SHIFT);
  144. BLANK();
  145. DEFINE(_PGD_T_SIZE, sizeof(pgd_t));
  146. DEFINE(_PTE_T_SIZE, sizeof(pte_t));
  147. BLANK();
  148. DEFINE(_PGD_ORDER, PGD_ORDER);
  149. DEFINE(_PTE_ORDER, PTE_ORDER);
  150. BLANK();
  151. DEFINE(_PGDIR_SHIFT, PGDIR_SHIFT);
  152. BLANK();
  153. DEFINE(_PTRS_PER_PGD, PTRS_PER_PGD);
  154. DEFINE(_PTRS_PER_PTE, PTRS_PER_PTE);
  155. BLANK();
  156. }
  157. void output_sc_defines(void)
  158. {
  159. COMMENT("Linux sigcontext offsets.");
  160. OFFSET(SC_REGS, sigcontext, sc_regs);
  161. OFFSET(SC_MDCEH, sigcontext, sc_mdceh);
  162. OFFSET(SC_MDCEL, sigcontext, sc_mdcel);
  163. OFFSET(SC_PC, sigcontext, sc_pc);
  164. OFFSET(SC_PSR, sigcontext, sc_psr);
  165. OFFSET(SC_ECR, sigcontext, sc_ecr);
  166. OFFSET(SC_EMA, sigcontext, sc_ema);
  167. BLANK();
  168. }
  169. void output_signal_defined(void)
  170. {
  171. COMMENT("Linux signal numbers.");
  172. DEFINE(_SIGHUP, SIGHUP);
  173. DEFINE(_SIGINT, SIGINT);
  174. DEFINE(_SIGQUIT, SIGQUIT);
  175. DEFINE(_SIGILL, SIGILL);
  176. DEFINE(_SIGTRAP, SIGTRAP);
  177. DEFINE(_SIGIOT, SIGIOT);
  178. DEFINE(_SIGABRT, SIGABRT);
  179. DEFINE(_SIGFPE, SIGFPE);
  180. DEFINE(_SIGKILL, SIGKILL);
  181. DEFINE(_SIGBUS, SIGBUS);
  182. DEFINE(_SIGSEGV, SIGSEGV);
  183. DEFINE(_SIGSYS, SIGSYS);
  184. DEFINE(_SIGPIPE, SIGPIPE);
  185. DEFINE(_SIGALRM, SIGALRM);
  186. DEFINE(_SIGTERM, SIGTERM);
  187. DEFINE(_SIGUSR1, SIGUSR1);
  188. DEFINE(_SIGUSR2, SIGUSR2);
  189. DEFINE(_SIGCHLD, SIGCHLD);
  190. DEFINE(_SIGPWR, SIGPWR);
  191. DEFINE(_SIGWINCH, SIGWINCH);
  192. DEFINE(_SIGURG, SIGURG);
  193. DEFINE(_SIGIO, SIGIO);
  194. DEFINE(_SIGSTOP, SIGSTOP);
  195. DEFINE(_SIGTSTP, SIGTSTP);
  196. DEFINE(_SIGCONT, SIGCONT);
  197. DEFINE(_SIGTTIN, SIGTTIN);
  198. DEFINE(_SIGTTOU, SIGTTOU);
  199. DEFINE(_SIGVTALRM, SIGVTALRM);
  200. DEFINE(_SIGPROF, SIGPROF);
  201. DEFINE(_SIGXCPU, SIGXCPU);
  202. DEFINE(_SIGXFSZ, SIGXFSZ);
  203. BLANK();
  204. }