mostang.com!davidm | 26f6cf7 | 2003-01-21 08:08:32 +0000 | [diff] [blame] | 1 | /* libunwind - a platform-independent unwind library |
| 2 | Copyright (C) 2002-2003 Hewlett-Packard Co |
| 3 | Contributed by David Mosberger-Tang <davidm@hpl.hp.com> |
| 4 | |
| 5 | This file is part of libunwind. |
| 6 | |
| 7 | Permission is hereby granted, free of charge, to any person obtaining |
| 8 | a copy of this software and associated documentation files (the |
| 9 | "Software"), to deal in the Software without restriction, including |
| 10 | without limitation the rights to use, copy, modify, merge, publish, |
| 11 | distribute, sublicense, and/or sell copies of the Software, and to |
| 12 | permit persons to whom the Software is furnished to do so, subject to |
| 13 | the following conditions: |
| 14 | |
| 15 | The above copyright notice and this permission notice shall be |
| 16 | included in all copies or substantial portions of the Software. |
| 17 | |
| 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
| 22 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
| 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
| 24 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
| 25 | |
| 26 | #ifndef LIBUNWIND_H |
| 27 | #define LIBUNWIND_H |
| 28 | |
| 29 | #include <stdint.h> |
| 30 | #include <ucontext.h> |
| 31 | |
| 32 | #define UNW_TARGET x86 |
| 33 | #define UNW_TARGET_X86 1 |
| 34 | |
| 35 | /* This needs to be big enough to accommodate "struct cursor", while |
| 36 | leaving some slack for future expansion. Changing this value will |
| 37 | require recompiling all users of this library. Stack allocation is |
| 38 | relatively cheap and unwind-state copying is relatively rare, so we |
| 39 | want to err on making it rather too big than too small. */ |
| 40 | #define UNW_TDEP_CURSOR_LEN 127 |
| 41 | |
| 42 | typedef uint32_t unw_tdep_word_t; |
| 43 | |
mostang.com!davidm | 45ce48f | 2003-03-06 06:14:36 +0000 | [diff] [blame^] | 44 | typedef long double unw_tdep_fpreg_t; |
| 45 | |
mostang.com!davidm | 26f6cf7 | 2003-01-21 08:08:32 +0000 | [diff] [blame] | 46 | typedef enum |
| 47 | { |
| 48 | /* Note: general registers are excepted to start with index 0. |
| 49 | This convention facilitates architecture-independent |
| 50 | implementation of the C++ exception handling ABI. See |
| 51 | _Unwind_SetGR() and _Unwind_GetGR() for details. */ |
| 52 | UNW_X86_EAX, |
| 53 | UNW_X86_EBX, |
| 54 | UNW_X86_ECX, |
| 55 | UNW_X86_EDX, |
| 56 | UNW_X86_ESI, |
| 57 | UNW_X86_EDI, |
| 58 | UNW_X86_EBP, |
| 59 | UNW_X86_EIP, |
| 60 | UNW_X86_ESP, |
| 61 | |
| 62 | UNW_TDEP_LAST_REG = UNW_X86_ESP, |
| 63 | |
| 64 | UNW_TDEP_IP = UNW_X86_EIP, |
mostang.com!davidm | 45ce48f | 2003-03-06 06:14:36 +0000 | [diff] [blame^] | 65 | UNW_TDEP_SP = UNW_X86_ESP, |
| 66 | UNW_TDEP_EH = UNW_X86_EAX |
mostang.com!davidm | 26f6cf7 | 2003-01-21 08:08:32 +0000 | [diff] [blame] | 67 | } |
| 68 | x86_regnum_t; |
| 69 | |
mostang.com!davidm | 45ce48f | 2003-03-06 06:14:36 +0000 | [diff] [blame^] | 70 | #define UNW_TDEP_NUM_EH_REGS 2 /* eax and ebx are exception args */ |
| 71 | |
mostang.com!davidm | 26f6cf7 | 2003-01-21 08:08:32 +0000 | [diff] [blame] | 72 | typedef struct unw_tdep_save_loc |
| 73 | { |
| 74 | /* Additional target-dependent info on a save location. */ |
| 75 | } |
| 76 | unw_tdep_save_loc_t; |
| 77 | |
| 78 | /* On x86, we can directly use ucontext_t as the unwind context. */ |
| 79 | typedef ucontext_t unw_tdep_context_t; |
| 80 | |
| 81 | /* XXX this is not ideal: an application should not be prevented from |
| 82 | using the "getcontext" name just because it's using libunwind. We |
| 83 | can't just use __getcontext() either, because that isn't exported |
| 84 | by glibc... */ |
| 85 | #define unw_tdep_getcontext(uc) (getcontext (uc), 0) |
| 86 | |
| 87 | /* XXX fixme: */ |
| 88 | #define unw_tdep_is_fpreg(r) ((unsigned) ((r) - UNW_X86_FR) < 128) |
| 89 | |
| 90 | #include "libunwind-common.h" |
| 91 | |
| 92 | #endif /* LIBUNWIND_H */ |