user.h 3.2 KB

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