user.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* user.h: FR-V core file format stuff
  2. *
  3. * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #ifndef _ASM_USER_H
  12. #define _ASM_USER_H
  13. #include <asm/page.h>
  14. #include <asm/registers.h>
  15. /* Core file format: The core file is written in such a way that gdb
  16. * can understand it and provide useful information to the user (under
  17. * linux we use the 'trad-core' bfd). There are quite a number of
  18. * obstacles to being able to view the contents of the floating point
  19. * registers, and until these are solved you will not be able to view
  20. * the contents of them. Actually, you can read in the core file and
  21. * look at the contents of the user struct to find out what the
  22. * floating point registers contain.
  23. *
  24. * The actual file contents are as follows:
  25. * UPAGE:
  26. * 1 page consisting of a user struct that tells gdb what is present
  27. * in the file. Directly after this is a copy of the task_struct,
  28. * which is currently not used by gdb, but it may come in useful at
  29. * some point. All of the registers are stored as part of the
  30. * upage. The upage should always be only one page.
  31. *
  32. * DATA:
  33. * The data area is stored. We use current->end_text to
  34. * current->brk to pick up all of the user variables, plus any
  35. * memory that may have been malloced. No attempt is made to
  36. * determine if a page is demand-zero or if a page is totally
  37. * unused, we just cover the entire range. All of the addresses are
  38. * rounded in such a way that an integral number of pages is
  39. * written.
  40. *
  41. * STACK:
  42. * We need the stack information in order to get a meaningful
  43. * backtrace. We need to write the data from (esp) to
  44. * current->start_stack, so we round each of these off in order to
  45. * be able to write an integer number of pages. The minimum core
  46. * file size is 3 pages, or 12288 bytes.
  47. */
  48. /* When the kernel dumps core, it starts by dumping the user struct -
  49. * this will be used by gdb to figure out where the data and stack segments
  50. * are within the file, and what virtual addresses to use.
  51. */
  52. struct user {
  53. /* We start with the registers, to mimic the way that "memory" is returned
  54. * from the ptrace(3,...) function. */
  55. struct user_context regs;
  56. /* The rest of this junk is to help gdb figure out what goes where */
  57. unsigned long u_tsize; /* Text segment size (pages). */
  58. unsigned long u_dsize; /* Data segment size (pages). */
  59. unsigned long u_ssize; /* Stack segment size (pages). */
  60. unsigned long start_code; /* Starting virtual address of text. */
  61. unsigned long start_stack; /* Starting virtual address of stack area.
  62. * This is actually the bottom of the stack,
  63. * the top of the stack is always found in the
  64. * esp register. */
  65. long int signal; /* Signal that caused the core dump. */
  66. unsigned long magic; /* To uniquely identify a core file */
  67. char u_comm[32]; /* User command that was responsible */
  68. };
  69. #define NBPG PAGE_SIZE
  70. #define UPAGES 1
  71. #define HOST_TEXT_START_ADDR (u.start_code)
  72. #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
  73. #endif