libunwind-x86.h revision 26f6cf761e71fee9162b0beac6a8b90fd2f2f5c0
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 5This file is part of libunwind. 6 7Permission is hereby granted, free of charge, to any person obtaining 8a copy of this software and associated documentation files (the 9"Software"), to deal in the Software without restriction, including 10without limitation the rights to use, copy, modify, merge, publish, 11distribute, sublicense, and/or sell copies of the Software, and to 12permit persons to whom the Software is furnished to do so, subject to 13the following conditions: 14 15The above copyright notice and this permission notice shall be 16included in all copies or substantial portions of the Software. 17 18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 22LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 24WITH 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 42typedef uint32_t unw_tdep_word_t; 43 44typedef enum 45 { 46 /* Note: general registers are excepted 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_X86_EAX, 51 UNW_X86_EBX, 52 UNW_X86_ECX, 53 UNW_X86_EDX, 54 UNW_X86_ESI, 55 UNW_X86_EDI, 56 UNW_X86_EBP, 57 UNW_X86_EIP, 58 UNW_X86_ESP, 59 60 UNW_TDEP_LAST_REG = UNW_X86_ESP, 61 62 UNW_TDEP_IP = UNW_X86_EIP, 63 UNW_TDEP_SP = UNW_X86_ESP 64 } 65x86_regnum_t; 66 67typedef struct unw_tdep_save_loc 68 { 69 /* Additional target-dependent info on a save location. */ 70 } 71unw_tdep_save_loc_t; 72 73/* On x86, we can directly use ucontext_t as the unwind context. */ 74typedef ucontext_t unw_tdep_context_t; 75 76/* XXX this is not ideal: an application should not be prevented from 77 using the "getcontext" name just because it's using libunwind. We 78 can't just use __getcontext() either, because that isn't exported 79 by glibc... */ 80#define unw_tdep_getcontext(uc) (getcontext (uc), 0) 81 82/* XXX fixme: */ 83#define unw_tdep_is_fpreg(r) ((unsigned) ((r) - UNW_X86_FR) < 128) 84 85#include "libunwind-common.h" 86 87#endif /* LIBUNWIND_H */ 88