asm-offsets.c 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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_FLAGS, thread_info, flags);
  97. OFFSET(TI_TP_VALUE, thread_info, tp_value);
  98. OFFSET(TI_CPU, thread_info, cpu);
  99. OFFSET(TI_PRE_COUNT, thread_info, preempt_count);
  100. OFFSET(TI_ADDR_LIMIT, thread_info, addr_limit);
  101. OFFSET(TI_REGS, thread_info, regs);
  102. DEFINE(KERNEL_STACK_SIZE, THREAD_SIZE);
  103. DEFINE(KERNEL_STACK_MASK, THREAD_MASK);
  104. BLANK();
  105. }
  106. void output_thread_defines(void)
  107. {
  108. COMMENT("SCORE specific thread_struct offsets.");
  109. OFFSET(THREAD_REG0, task_struct, thread.reg0);
  110. OFFSET(THREAD_REG2, task_struct, thread.reg2);
  111. OFFSET(THREAD_REG3, task_struct, thread.reg3);
  112. OFFSET(THREAD_REG12, task_struct, thread.reg12);
  113. OFFSET(THREAD_REG13, task_struct, thread.reg13);
  114. OFFSET(THREAD_REG14, task_struct, thread.reg14);
  115. OFFSET(THREAD_REG15, task_struct, thread.reg15);
  116. OFFSET(THREAD_REG16, task_struct, thread.reg16);
  117. OFFSET(THREAD_REG17, task_struct, thread.reg17);
  118. OFFSET(THREAD_REG18, task_struct, thread.reg18);
  119. OFFSET(THREAD_REG19, task_struct, thread.reg19);
  120. OFFSET(THREAD_REG20, task_struct, thread.reg20);
  121. OFFSET(THREAD_REG21, task_struct, thread.reg21);
  122. OFFSET(THREAD_REG29, task_struct, thread.reg29);
  123. OFFSET(THREAD_PSR, task_struct, thread.cp0_psr);
  124. OFFSET(THREAD_EMA, task_struct, thread.cp0_ema);
  125. OFFSET(THREAD_BADUADDR, task_struct, thread.cp0_baduaddr);
  126. OFFSET(THREAD_ECODE, task_struct, thread.error_code);
  127. OFFSET(THREAD_TRAPNO, task_struct, thread.trap_no);
  128. BLANK();
  129. }
  130. void output_mm_defines(void)
  131. {
  132. COMMENT("Size of struct page");
  133. DEFINE(STRUCT_PAGE_SIZE, sizeof(struct page));
  134. BLANK();
  135. COMMENT("Linux mm_struct offsets.");
  136. OFFSET(MM_USERS, mm_struct, mm_users);
  137. OFFSET(MM_PGD, mm_struct, pgd);
  138. OFFSET(MM_CONTEXT, mm_struct, context);
  139. BLANK();
  140. DEFINE(_PAGE_SIZE, PAGE_SIZE);
  141. DEFINE(_PAGE_SHIFT, PAGE_SHIFT);
  142. BLANK();
  143. DEFINE(_PGD_T_SIZE, sizeof(pgd_t));
  144. DEFINE(_PTE_T_SIZE, sizeof(pte_t));
  145. BLANK();
  146. DEFINE(_PGD_ORDER, PGD_ORDER);
  147. DEFINE(_PTE_ORDER, PTE_ORDER);
  148. BLANK();
  149. DEFINE(_PGDIR_SHIFT, PGDIR_SHIFT);
  150. BLANK();
  151. DEFINE(_PTRS_PER_PGD, PTRS_PER_PGD);
  152. DEFINE(_PTRS_PER_PTE, PTRS_PER_PTE);
  153. BLANK();
  154. }
  155. void output_sc_defines(void)
  156. {
  157. COMMENT("Linux sigcontext offsets.");
  158. OFFSET(SC_REGS, sigcontext, sc_regs);
  159. OFFSET(SC_MDCEH, sigcontext, sc_mdceh);
  160. OFFSET(SC_MDCEL, sigcontext, sc_mdcel);
  161. OFFSET(SC_PC, sigcontext, sc_pc);
  162. OFFSET(SC_PSR, sigcontext, sc_psr);
  163. OFFSET(SC_ECR, sigcontext, sc_ecr);
  164. OFFSET(SC_EMA, sigcontext, sc_ema);
  165. BLANK();
  166. }
  167. void output_signal_defined(void)
  168. {
  169. COMMENT("Linux signal numbers.");
  170. DEFINE(_SIGHUP, SIGHUP);
  171. DEFINE(_SIGINT, SIGINT);
  172. DEFINE(_SIGQUIT, SIGQUIT);
  173. DEFINE(_SIGILL, SIGILL);
  174. DEFINE(_SIGTRAP, SIGTRAP);
  175. DEFINE(_SIGIOT, SIGIOT);
  176. DEFINE(_SIGABRT, SIGABRT);
  177. DEFINE(_SIGFPE, SIGFPE);
  178. DEFINE(_SIGKILL, SIGKILL);
  179. DEFINE(_SIGBUS, SIGBUS);
  180. DEFINE(_SIGSEGV, SIGSEGV);
  181. DEFINE(_SIGSYS, SIGSYS);
  182. DEFINE(_SIGPIPE, SIGPIPE);
  183. DEFINE(_SIGALRM, SIGALRM);
  184. DEFINE(_SIGTERM, SIGTERM);
  185. DEFINE(_SIGUSR1, SIGUSR1);
  186. DEFINE(_SIGUSR2, SIGUSR2);
  187. DEFINE(_SIGCHLD, SIGCHLD);
  188. DEFINE(_SIGPWR, SIGPWR);
  189. DEFINE(_SIGWINCH, SIGWINCH);
  190. DEFINE(_SIGURG, SIGURG);
  191. DEFINE(_SIGIO, SIGIO);
  192. DEFINE(_SIGSTOP, SIGSTOP);
  193. DEFINE(_SIGTSTP, SIGTSTP);
  194. DEFINE(_SIGCONT, SIGCONT);
  195. DEFINE(_SIGTTIN, SIGTTIN);
  196. DEFINE(_SIGTTOU, SIGTTOU);
  197. DEFINE(_SIGVTALRM, SIGVTALRM);
  198. DEFINE(_SIGPROF, SIGPROF);
  199. DEFINE(_SIGXCPU, SIGXCPU);
  200. DEFINE(_SIGXFSZ, SIGXFSZ);
  201. BLANK();
  202. }