libunwind-hppa.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /* libunwind - a platform-independent unwind library
  2. Copyright (C) 2003-2004 Hewlett-Packard Co
  3. This file is part of libunwind.
  4. Permission is hereby granted, free of charge, to any person obtaining
  5. a copy of this software and associated documentation files (the
  6. "Software"), to deal in the Software without restriction, including
  7. without limitation the rights to use, copy, modify, merge, publish,
  8. distribute, sublicense, and/or sell copies of the Software, and to
  9. permit persons to whom the Software is furnished to do so, subject to
  10. the following conditions:
  11. The above copyright notice and this permission notice shall be
  12. included in all copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  14. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  15. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  16. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  17. LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  18. OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  19. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  20. #ifndef LIBUNWIND_H
  21. #define LIBUNWIND_H
  22. #if defined(__cplusplus) || defined(c_plusplus)
  23. extern "C" {
  24. #endif
  25. #include <inttypes.h>
  26. #include <ucontext.h>
  27. #define UNW_TARGET hppa
  28. #define UNW_TARGET_HPPA 1
  29. #define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
  30. /* This needs to be big enough to accommodate "struct cursor", while
  31. leaving some slack for future expansion. Changing this value will
  32. require recompiling all users of this library. Stack allocation is
  33. relatively cheap and unwind-state copying is relatively rare, so we
  34. want to err on making it rather too big than too small. */
  35. #define UNW_TDEP_CURSOR_LEN 511
  36. typedef uint32_t unw_word_t;
  37. typedef int32_t unw_sword_t;
  38. typedef union
  39. {
  40. struct { unw_word_t bits[2]; } raw;
  41. double val;
  42. }
  43. unw_tdep_fpreg_t;
  44. typedef enum
  45. {
  46. /* Note: general registers are expected to start with index 0.
  47. This convention facilitates architecture-independent
  48. implementation of the C++ exception handling ABI. See
  49. _Unwind_SetGR() and _Unwind_GetGR() for details. */
  50. UNW_HPPA_GR = 0,
  51. UNW_HPPA_RP = 2, /* return pointer */
  52. UNW_HPPA_FP = 3, /* frame pointer */
  53. UNW_HPPA_SP = UNW_HPPA_GR + 30,
  54. UNW_HPPA_FR = UNW_HPPA_GR + 32,
  55. UNW_HPPA_IP = UNW_HPPA_FR + 32, /* instruction pointer */
  56. /* other "preserved" registers (fpsr etc.)... */
  57. /* PA-RISC has 4 exception-argument registers but they're not
  58. contiguous. To deal with this, we define 4 pseudo
  59. exception-handling registers which we then alias to the actual
  60. physical register. */
  61. UNW_HPPA_EH0 = UNW_HPPA_IP + 1, /* alias for UNW_HPPA_GR + 20 */
  62. UNW_HPPA_EH1 = UNW_HPPA_EH0 + 1, /* alias for UNW_HPPA_GR + 21 */
  63. UNW_HPPA_EH2 = UNW_HPPA_EH1 + 1, /* alias for UNW_HPPA_GR + 22 */
  64. UNW_HPPA_EH3 = UNW_HPPA_EH2 + 1, /* alias for UNW_HPPA_GR + 31 */
  65. /* frame info (read-only) */
  66. UNW_HPPA_CFA,
  67. UNW_TDEP_LAST_REG = UNW_HPPA_IP,
  68. UNW_TDEP_IP = UNW_HPPA_IP,
  69. UNW_TDEP_SP = UNW_HPPA_SP,
  70. UNW_TDEP_EH = UNW_HPPA_EH0
  71. }
  72. hppa_regnum_t;
  73. #define UNW_TDEP_NUM_EH_REGS 4
  74. typedef struct unw_tdep_save_loc
  75. {
  76. /* Additional target-dependent info on a save location. */
  77. }
  78. unw_tdep_save_loc_t;
  79. /* On PA-RISC, we can directly use ucontext_t as the unwind context. */
  80. typedef ucontext_t unw_tdep_context_t;
  81. #define unw_tdep_is_fpreg(r) ((unsigned) ((r) - UNW_HPPA_FR) < 32)
  82. #include "libunwind-dynamic.h"
  83. typedef struct
  84. {
  85. /* no PA-RISC-specific auxiliary proc-info */
  86. }
  87. unw_tdep_proc_info_t;
  88. #include "libunwind-common.h"
  89. #define unw_tdep_getcontext UNW_ARCH_OBJ (getcontext)
  90. extern int unw_tdep_getcontext (unw_tdep_context_t *);
  91. #if defined(__cplusplus) || defined(c_plusplus)
  92. }
  93. #endif
  94. #endif /* LIBUNWIND_H */