user.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. /* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public
  5. License as published by the Free Software Foundation; either
  6. version 2.1 of the License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public
  12. License along with the GNU C Library; if not, write to the Free
  13. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  14. 02111-1307 USA. */
  15. #ifndef _SYS_USER_H
  16. #define _SYS_USER_H 1
  17. /* The whole purpose of this file is for GDB and GDB only. Don't read
  18. too much into it. Don't use it for anything other than GDB unless
  19. you know what you are doing. */
  20. /* #include <asm/reg.h> */
  21. /* Instead of including the kernel header, that will vary depending on
  22. whether the 32- or the 64-bit kernel is installed, we paste its
  23. contents here. Note that the fact that the file is inline here,
  24. instead of included separately, doesn't change in any way the
  25. licensing status of a program that includes user.h. Since this is
  26. for gdb alone, and gdb is GPLed, no surprises here. */
  27. #if _MIPS_SIM == _MIPS_SIM_ABI32
  28. /*
  29. * Various register offset definitions for debuggers, core file
  30. * examiners and whatnot.
  31. *
  32. * This file is subject to the terms and conditions of the GNU General Public
  33. * License. See the file "COPYING" in the main directory of this archive
  34. * for more details.
  35. *
  36. * Copyright (C) 1995, 1999 by Ralf Baechle
  37. */
  38. #ifndef __ASM_MIPS_REG_H
  39. #define __ASM_MIPS_REG_H
  40. /*
  41. * This defines/structures correspond to the register layout on stack -
  42. * if the order here is changed, it needs to be updated in
  43. * include/asm-mips/stackframe.h
  44. */
  45. #define EF_REG0 6
  46. #define EF_REG1 7
  47. #define EF_REG2 8
  48. #define EF_REG3 9
  49. #define EF_REG4 10
  50. #define EF_REG5 11
  51. #define EF_REG6 12
  52. #define EF_REG7 13
  53. #define EF_REG8 14
  54. #define EF_REG9 15
  55. #define EF_REG10 16
  56. #define EF_REG11 17
  57. #define EF_REG12 18
  58. #define EF_REG13 19
  59. #define EF_REG14 20
  60. #define EF_REG15 21
  61. #define EF_REG16 22
  62. #define EF_REG17 23
  63. #define EF_REG18 24
  64. #define EF_REG19 25
  65. #define EF_REG20 26
  66. #define EF_REG21 27
  67. #define EF_REG22 28
  68. #define EF_REG23 29
  69. #define EF_REG24 30
  70. #define EF_REG25 31
  71. /*
  72. * k0/k1 unsaved
  73. */
  74. #define EF_REG28 34
  75. #define EF_REG29 35
  76. #define EF_REG30 36
  77. #define EF_REG31 37
  78. /*
  79. * Saved special registers
  80. */
  81. #define EF_LO 38
  82. #define EF_HI 39
  83. #define EF_CP0_EPC 40
  84. #define EF_CP0_BADVADDR 41
  85. #define EF_CP0_STATUS 42
  86. #define EF_CP0_CAUSE 43
  87. #define EF_SIZE 180 /* size in bytes */
  88. #endif /* __ASM_MIPS_REG_H */
  89. #else /* _MIPS_SIM != _MIPS_SIM_ABI32 */
  90. /*
  91. * Various register offset definitions for debuggers, core file
  92. * examiners and whatnot.
  93. *
  94. * This file is subject to the terms and conditions of the GNU General Public
  95. * License. See the file "COPYING" in the main directory of this archive
  96. * for more details.
  97. *
  98. * Copyright (C) 1995, 1999 Ralf Baechle
  99. * Copyright (C) 1995, 1999 Silicon Graphics
  100. */
  101. #ifndef _ASM_REG_H
  102. #define _ASM_REG_H
  103. /*
  104. * This defines/structures correspond to the register layout on stack -
  105. * if the order here is changed, it needs to be updated in
  106. * include/asm-mips/stackframe.h
  107. */
  108. #define EF_REG0 0
  109. #define EF_REG1 1
  110. #define EF_REG2 2
  111. #define EF_REG3 3
  112. #define EF_REG4 4
  113. #define EF_REG5 5
  114. #define EF_REG6 6
  115. #define EF_REG7 7
  116. #define EF_REG8 8
  117. #define EF_REG9 9
  118. #define EF_REG10 10
  119. #define EF_REG11 11
  120. #define EF_REG12 12
  121. #define EF_REG13 13
  122. #define EF_REG14 14
  123. #define EF_REG15 15
  124. #define EF_REG16 16
  125. #define EF_REG17 17
  126. #define EF_REG18 18
  127. #define EF_REG19 19
  128. #define EF_REG20 20
  129. #define EF_REG21 21
  130. #define EF_REG22 22
  131. #define EF_REG23 23
  132. #define EF_REG24 24
  133. #define EF_REG25 25
  134. /*
  135. * k0/k1 unsaved
  136. */
  137. #define EF_REG28 28
  138. #define EF_REG29 29
  139. #define EF_REG30 30
  140. #define EF_REG31 31
  141. /*
  142. * Saved special registers
  143. */
  144. #define EF_LO 32
  145. #define EF_HI 33
  146. #define EF_CP0_EPC 34
  147. #define EF_CP0_BADVADDR 35
  148. #define EF_CP0_STATUS 36
  149. #define EF_CP0_CAUSE 37
  150. #define EF_SIZE 304 /* size in bytes */
  151. #endif /* _ASM_REG_H */
  152. #endif /* _MIPS_SIM != _MIPS_SIM_ABI32 */
  153. #if _MIPS_SIM == _MIPS_SIM_ABI32
  154. struct user
  155. {
  156. unsigned long regs[EF_SIZE/4+64]; /* integer and fp regs */
  157. size_t u_tsize; /* text size (pages) */
  158. size_t u_dsize; /* data size (pages) */
  159. size_t u_ssize; /* stack size (pages) */
  160. unsigned long start_code; /* text starting address */
  161. unsigned long start_data; /* data starting address */
  162. unsigned long start_stack; /* stack starting address */
  163. long int signal; /* signal causing core dump */
  164. void* u_ar0; /* help gdb find registers */
  165. unsigned long magic; /* identifies a core file */
  166. char u_comm[32]; /* user command name */
  167. };
  168. #else
  169. struct user {
  170. __extension__ unsigned long regs[EF_SIZE/8+64]; /* integer and fp regs */
  171. __extension__ unsigned long u_tsize; /* text size (pages) */
  172. __extension__ unsigned long u_dsize; /* data size (pages) */
  173. __extension__ unsigned long u_ssize; /* stack size (pages) */
  174. __extension__ unsigned long long start_code; /* text starting address */
  175. __extension__ unsigned long long start_data; /* data starting address */
  176. __extension__ unsigned long long start_stack; /* stack starting address */
  177. __extension__ long long signal; /* signal causing core dump */
  178. __extension__ unsigned long long u_ar0; /* help gdb find registers */
  179. __extension__ unsigned long long magic; /* identifies a core file */
  180. char u_comm[32]; /* user command name */
  181. };
  182. #endif
  183. #define PAGE_SHIFT 12
  184. #define PAGE_SIZE (1UL << PAGE_SHIFT)
  185. #define PAGE_MASK (~(PAGE_SIZE-1))
  186. #define NBPG PAGE_SIZE
  187. #define UPAGES 1
  188. #define HOST_TEXT_START_ADDR (u.start_code)
  189. #define HOST_DATA_START_ADDR (u.start_data)
  190. #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
  191. #endif /* _SYS_USER_H */