ibm.com!masbock | a766efd | 2004-08-19 13:39:10 +0000 | [diff] [blame] | 1 | /* libunwind - a platform-independent unwind library |
| 2 | Copyright (C) 2002-2004 Hewlett-Packard Co |
| 3 | Contributed by David Mosberger-Tang <davidm@hpl.hp.com> |
| 4 | |
| 5 | Modified for x86_64 by Max Asbock <masbock@us.ibm.com> |
| 6 | |
| 7 | This file is part of libunwind. |
| 8 | |
| 9 | Permission is hereby granted, free of charge, to any person obtaining |
| 10 | a copy of this software and associated documentation files (the |
| 11 | "Software"), to deal in the Software without restriction, including |
| 12 | without limitation the rights to use, copy, modify, merge, publish, |
| 13 | distribute, sublicense, and/or sell copies of the Software, and to |
| 14 | permit persons to whom the Software is furnished to do so, subject to |
| 15 | the following conditions: |
| 16 | |
| 17 | The above copyright notice and this permission notice shall be |
| 18 | included in all copies or substantial portions of the Software. |
| 19 | |
| 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 21 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 23 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 24 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 25 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 26 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
| 27 | |
| 28 | #ifndef LIBUNWIND_H |
| 29 | #define LIBUNWIND_H |
| 30 | |
| 31 | #if defined(__cplusplus) || defined(c_plusplus) |
| 32 | extern "C" { |
| 33 | #endif |
| 34 | |
| 35 | #include <inttypes.h> |
| 36 | #include <ucontext.h> |
| 37 | |
| 38 | #define UNW_TARGET x86_64 |
| 39 | #define UNW_TARGET_X86_64 1 |
| 40 | |
| 41 | #define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ |
| 42 | |
| 43 | /* This needs to be big enough to accommodate "struct cursor", while |
| 44 | leaving some slack for future expansion. Changing this value will |
| 45 | require recompiling all users of this library. Stack allocation is |
| 46 | relatively cheap and unwind-state copying is relatively rare, so we |
| 47 | want to err on making it rather too big than too small. */ |
| 48 | #define UNW_TDEP_CURSOR_LEN 127 |
| 49 | |
| 50 | typedef uint64_t unw_word_t; |
Arun Sharma | 11ea127 | 2006-07-26 22:12:10 -0600 | [diff] [blame^] | 51 | typedef int64_t unw_sword_t; |
ibm.com!masbock | a766efd | 2004-08-19 13:39:10 +0000 | [diff] [blame] | 52 | |
| 53 | typedef long double unw_tdep_fpreg_t; |
| 54 | |
| 55 | typedef enum |
| 56 | { |
| 57 | UNW_X86_64_RAX, |
| 58 | UNW_X86_64_RDX, |
| 59 | UNW_X86_64_RCX, |
| 60 | UNW_X86_64_RBX, |
| 61 | UNW_X86_64_RSI, |
| 62 | UNW_X86_64_RDI, |
| 63 | UNW_X86_64_RBP, |
| 64 | UNW_X86_64_RSP, |
| 65 | UNW_X86_64_R8, |
| 66 | UNW_X86_64_R9, |
| 67 | UNW_X86_64_R10, |
| 68 | UNW_X86_64_R11, |
| 69 | UNW_X86_64_R12, |
| 70 | UNW_X86_64_R13, |
| 71 | UNW_X86_64_R14, |
| 72 | UNW_X86_64_R15, |
| 73 | UNW_X86_64_RIP, |
| 74 | |
| 75 | /* XXX Add other regs here */ |
| 76 | |
| 77 | /* frame info (read-only) */ |
| 78 | UNW_X86_64_CFA, |
| 79 | |
| 80 | UNW_TDEP_LAST_REG = UNW_X86_64_RIP, |
| 81 | |
| 82 | UNW_TDEP_IP = UNW_X86_64_RIP, |
| 83 | UNW_TDEP_SP = UNW_X86_64_RSP, |
| 84 | UNW_TDEP_BP = UNW_X86_64_RBP, |
| 85 | UNW_TDEP_EH = UNW_X86_64_RAX |
| 86 | } |
| 87 | x86_64_regnum_t; |
| 88 | |
| 89 | #define UNW_TDEP_NUM_EH_REGS 2 /* XXX Not sure what this means */ |
| 90 | |
| 91 | typedef struct unw_tdep_save_loc |
| 92 | { |
| 93 | /* Additional target-dependent info on a save location. */ |
| 94 | } |
| 95 | unw_tdep_save_loc_t; |
| 96 | |
| 97 | /* On x86_64, we can directly use ucontext_t as the unwind context. */ |
| 98 | typedef ucontext_t unw_tdep_context_t; |
| 99 | |
| 100 | /* XXX this is not ideal: an application should not be prevented from |
| 101 | using the "getcontext" name just because it's using libunwind. We |
| 102 | can't just use __getcontext() either, because that isn't exported |
| 103 | by glibc... */ |
| 104 | #define unw_tdep_getcontext(uc) (getcontext (uc), 0) |
| 105 | |
| 106 | #include "libunwind-dynamic.h" |
| 107 | |
| 108 | typedef struct |
| 109 | { |
mostang.com!davidm | 27f7d7d | 2005-05-03 09:13:17 +0000 | [diff] [blame] | 110 | /* no x86-64-specific auxiliary proc-info */ |
ibm.com!masbock | a766efd | 2004-08-19 13:39:10 +0000 | [diff] [blame] | 111 | } |
| 112 | unw_tdep_proc_info_t; |
| 113 | |
| 114 | #include "libunwind-common.h" |
| 115 | |
| 116 | #define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) |
| 117 | extern int unw_tdep_is_fpreg (int); |
| 118 | |
| 119 | #if defined(__cplusplus) || defined(c_plusplus) |
| 120 | } |
| 121 | #endif |
| 122 | |
| 123 | #endif /* LIBUNWIND_H */ |