user.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* Copyright (C) 1998, 1999, 2000, 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, see
  13. <http://www.gnu.org/licenses/>. */
  14. #ifndef _SYS_USER_H
  15. #define _SYS_USER_H 1
  16. #include <unistd.h>
  17. #include <asm/ptrace.h>
  18. /* asm/ptrace.h polutes the namespace. */
  19. #undef PTRACE_GETREGS
  20. #undef PTRACE_SETREGS
  21. #undef PTRACE_GETFPREGS
  22. #undef PTRACE_SETFPREGS
  23. #undef PTRACE_GETFDPIC
  24. #undef PTRACE_GETFDPIC_EXEC
  25. #undef PTRACE_GETFDPIC_INTERP
  26. #undef PTRACE_GETDSPREGS
  27. #undef PTRACE_SETDSPREGS
  28. /*
  29. * Core file format: The core file is written in such a way that gdb
  30. * can understand it and provide useful information to the user (under
  31. * linux we use the `trad-core' bfd). The file contents are as follows:
  32. *
  33. * upage: 1 page consisting of a user struct that tells gdb
  34. * what is present in the file. Directly after this is a
  35. * copy of the task_struct, which is currently not used by gdb,
  36. * but it may come in handy at some point. All of the registers
  37. * are stored as part of the upage. The upage should always be
  38. * only one page long.
  39. * data: The data segment follows next. We use current->end_text to
  40. * current->brk to pick up all of the user variables, plus any memory
  41. * that may have been sbrk'ed. No attempt is made to determine if a
  42. * page is demand-zero or if a page is totally unused, we just cover
  43. * the entire range. All of the addresses are rounded in such a way
  44. * that an integral number of pages is written.
  45. * stack: We need the stack information in order to get a meaningful
  46. * backtrace. We need to write the data from usp to
  47. * current->start_stack, so we round each of these in order to be able
  48. * to write an integer number of pages.
  49. */
  50. struct user_fpu_struct {
  51. unsigned long fp_regs[16];
  52. unsigned long xfp_regs[16];
  53. unsigned long fpscr;
  54. unsigned long fpul;
  55. };
  56. struct user {
  57. struct pt_regs regs; /* entire machine state */
  58. struct user_fpu_struct fpu; /* Math Co-processor registers */
  59. int u_fpvalid; /* True if math co-processor being used */
  60. size_t u_tsize; /* text size (pages) */
  61. size_t u_dsize; /* data size (pages) */
  62. size_t u_ssize; /* stack size (pages) */
  63. unsigned long start_code; /* text starting address */
  64. unsigned long start_data; /* data starting address */
  65. unsigned long start_stack; /* stack starting address */
  66. long int signal; /* signal causing core dump */
  67. struct regs * u_ar0; /* help gdb find registers */
  68. struct user_fpu_struct* u_fpstate; /* Math Co-processor pointer */
  69. unsigned long magic; /* identifies a core file */
  70. char u_comm[32]; /* user command name */
  71. };
  72. #define NBPG getpagesize()
  73. #define UPAGES 1
  74. #define HOST_TEXT_START_ADDR (u.start_code)
  75. #define HOST_DATA_START_ADDR (u.start_data)
  76. #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
  77. #endif /* sys/user.h */