unwind_i.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* libunwind - a platform-independent unwind library
  2. Copyright (C) 2002, 2005 Hewlett-Packard Co
  3. Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
  4. Modified for x86_64 by Max Asbock <masbock@us.ibm.com>
  5. This file is part of libunwind.
  6. Permission is hereby granted, free of charge, to any person obtaining
  7. a copy of this software and associated documentation files (the
  8. "Software"), to deal in the Software without restriction, including
  9. without limitation the rights to use, copy, modify, merge, publish,
  10. distribute, sublicense, and/or sell copies of the Software, and to
  11. permit persons to whom the Software is furnished to do so, subject to
  12. the following conditions:
  13. The above copyright notice and this permission notice shall be
  14. included in all copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  16. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  18. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  19. LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  20. OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  21. WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  22. #ifndef unwind_i_h
  23. #define unwind_i_h
  24. #include <memory.h>
  25. #include <stdint.h>
  26. #include <libunwind-x86_64.h>
  27. #include "libunwind_i.h"
  28. #include <sys/ucontext.h>
  29. /* DWARF column numbers for x86_64: */
  30. #define RAX 0
  31. #define RDX 1
  32. #define RCX 2
  33. #define RBX 3
  34. #define RSI 4
  35. #define RDI 5
  36. #define RBP 6
  37. #define RSP 7
  38. #define R8 8
  39. #define R9 9
  40. #define R10 10
  41. #define R11 11
  42. #define R12 12
  43. #define R13 13
  44. #define R14 14
  45. #define R15 15
  46. #define RIP 16
  47. #define x86_64_lock UNW_OBJ(lock)
  48. #define x86_64_local_resume UNW_OBJ(local_resume)
  49. #define x86_64_local_addr_space_init UNW_OBJ(local_addr_space_init)
  50. #define setcontext UNW_ARCH_OBJ (setcontext)
  51. #if 0
  52. #define x86_64_scratch_loc UNW_OBJ(scratch_loc)
  53. #endif
  54. #define x86_64_r_uc_addr UNW_OBJ(r_uc_addr)
  55. #define x86_64_sigreturn UNW_OBJ(sigreturn)
  56. /* By-pass calls to access_mem() when known to be safe. */
  57. #ifdef UNW_LOCAL_ONLY
  58. # undef ACCESS_MEM_FAST
  59. # define ACCESS_MEM_FAST(ret,validate,cur,addr,to) \
  60. do { \
  61. if (unlikely(validate)) \
  62. (ret) = dwarf_get ((cur), DWARF_MEM_LOC ((cur), (addr)), &(to)); \
  63. else \
  64. (ret) = 0, (to) = *(unw_word_t *)(addr); \
  65. } while (0)
  66. #endif
  67. extern void x86_64_local_addr_space_init (void);
  68. extern int x86_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor,
  69. void *arg);
  70. extern int setcontext (const ucontext_t *ucp);
  71. #if 0
  72. extern dwarf_loc_t x86_64_scratch_loc (struct cursor *c, unw_regnum_t reg);
  73. #endif
  74. extern void *x86_64_r_uc_addr (ucontext_t *uc, int reg);
  75. extern NORETURN void x86_64_sigreturn (unw_cursor_t *cursor);
  76. #endif /* unwind_i_h */