sigcontextinfo.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* Copyright (C) 1999 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. Contributed by Philip Blundell <philb@gnu.org>, 1999.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. /* Definition of `struct sigcontext' for Linux/ARM
  17. Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
  18. This file is part of the GNU C Library.
  19. The GNU C Library is free software; you can redistribute it and/or
  20. modify it under the terms of the GNU Lesser General Public
  21. License as published by the Free Software Foundation; either
  22. version 2.1 of the License, or (at your option) any later version.
  23. The GNU C Library is distributed in the hope that it will be useful,
  24. but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  26. Lesser General Public License for more details.
  27. You should have received a copy of the GNU Lesser General Public
  28. License along with the GNU C Library; if not, write to the Free
  29. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  30. 02111-1307 USA. */
  31. /* The format of struct sigcontext changed between 2.0 and 2.1 kernels.
  32. Fortunately 2.0 puts a magic number in the first word and this is not
  33. a legal value for `trap_no', so we can tell them apart. */
  34. /* Early 2.2 and 2.3 kernels do not have the `fault_address' member in
  35. the sigcontext structure. Unfortunately there is no reliable way
  36. to test for its presence and this word will contain garbage for too-old
  37. kernels. Versions 2.2.14 and 2.3.35 (plus later versions) are known to
  38. include this element. */
  39. #ifndef __ARMSIGCTX_H
  40. #define __ARMSIGCTX_H 1
  41. #include <asm/ptrace.h>
  42. union k_sigcontext
  43. {
  44. struct
  45. {
  46. unsigned long int trap_no;
  47. unsigned long int error_code;
  48. unsigned long int oldmask;
  49. unsigned long int arm_r0;
  50. unsigned long int arm_r1;
  51. unsigned long int arm_r2;
  52. unsigned long int arm_r3;
  53. unsigned long int arm_r4;
  54. unsigned long int arm_r5;
  55. unsigned long int arm_r6;
  56. unsigned long int arm_r7;
  57. unsigned long int arm_r8;
  58. unsigned long int arm_r9;
  59. unsigned long int arm_r10;
  60. unsigned long int arm_fp;
  61. unsigned long int arm_ip;
  62. unsigned long int arm_sp;
  63. unsigned long int arm_lr;
  64. unsigned long int arm_pc;
  65. unsigned long int arm_cpsr;
  66. unsigned long fault_address;
  67. } v21;
  68. struct
  69. {
  70. unsigned long int magic;
  71. struct pt_regs reg;
  72. unsigned long int trap_no;
  73. unsigned long int error_code;
  74. unsigned long int oldmask;
  75. } v20;
  76. };
  77. #define SIGCONTEXT_2_0_MAGIC 0x4B534154
  78. #endif /* bits/armsigctx.h */
  79. #define SIGCONTEXT int _a2, int _a3, int _a4, union k_sigcontext
  80. #define SIGCONTEXT_EXTRA_ARGS _a2, _a3, _a4,
  81. #define GET_PC(ctx) ((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
  82. ctx.v20.reg.ARM_pc : ctx.v21.arm_pc))
  83. #define GET_FRAME(ctx) \
  84. ADVANCE_STACK_FRAME((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
  85. ctx.v20.reg.ARM_fp : ctx.v21.arm_fp))
  86. #define GET_STACK(ctx) ((void *)((ctx.v20.magic == SIGCONTEXT_2_0_MAGIC) ? \
  87. ctx.v20.reg.ARM_sp : ctx.v21.arm_sp))
  88. #define ADVANCE_STACK_FRAME(frm) \
  89. ((struct layout *)frm - 1)
  90. #define CALL_SIGHANDLER(handler, signo, ctx) \
  91. (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))