user.h 3.4 KB

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