blob: fb08fe16856fa569c3d130934e5e8eaf3af2f375 [file] [log] [blame]
mostang.com!davidm26f6cf72003-01-21 08:08:32 +00001/* 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
mostang.com!davidm337c0ad2003-03-28 07:43:22 +000029#if defined(__cplusplus) || defined(c_plusplus)
30extern "C" {
31#endif
32
mostang.com!davidm58e0e102003-03-19 19:25:18 +000033#include <inttypes.h>
mostang.com!davidm26f6cf72003-01-21 08:08:32 +000034#include <ucontext.h>
35
36#define UNW_TARGET x86
37#define UNW_TARGET_X86 1
38
hp.com!davidm79f981a2003-04-21 23:14:14 +000039#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
40
mostang.com!davidm26f6cf72003-01-21 08:08:32 +000041/* This needs to be big enough to accommodate "struct cursor", while
42 leaving some slack for future expansion. Changing this value will
43 require recompiling all users of this library. Stack allocation is
44 relatively cheap and unwind-state copying is relatively rare, so we
45 want to err on making it rather too big than too small. */
46#define UNW_TDEP_CURSOR_LEN 127
47
48typedef uint32_t unw_tdep_word_t;
49
mostang.com!davidm45ce48f2003-03-06 06:14:36 +000050typedef long double unw_tdep_fpreg_t;
51
mostang.com!davidm26f6cf72003-01-21 08:08:32 +000052typedef enum
53 {
hp.com!davidm34085ca2003-11-22 06:11:18 +000054 /* Note: general registers are expected to start with index 0.
mostang.com!davidm26f6cf72003-01-21 08:08:32 +000055 This convention facilitates architecture-independent
56 implementation of the C++ exception handling ABI. See
57 _Unwind_SetGR() and _Unwind_GetGR() for details. */
58 UNW_X86_EAX,
59 UNW_X86_EBX,
60 UNW_X86_ECX,
61 UNW_X86_EDX,
62 UNW_X86_ESI,
63 UNW_X86_EDI,
64 UNW_X86_EBP,
65 UNW_X86_EIP,
66 UNW_X86_ESP,
67
68 UNW_TDEP_LAST_REG = UNW_X86_ESP,
69
70 UNW_TDEP_IP = UNW_X86_EIP,
mostang.com!davidm45ce48f2003-03-06 06:14:36 +000071 UNW_TDEP_SP = UNW_X86_ESP,
72 UNW_TDEP_EH = UNW_X86_EAX
mostang.com!davidm26f6cf72003-01-21 08:08:32 +000073 }
74x86_regnum_t;
75
mostang.com!davidm45ce48f2003-03-06 06:14:36 +000076#define UNW_TDEP_NUM_EH_REGS 2 /* eax and ebx are exception args */
77
mostang.com!davidm26f6cf72003-01-21 08:08:32 +000078typedef struct unw_tdep_save_loc
79 {
80 /* Additional target-dependent info on a save location. */
81 }
82unw_tdep_save_loc_t;
83
84/* On x86, we can directly use ucontext_t as the unwind context. */
85typedef ucontext_t unw_tdep_context_t;
86
87/* XXX this is not ideal: an application should not be prevented from
88 using the "getcontext" name just because it's using libunwind. We
89 can't just use __getcontext() either, because that isn't exported
90 by glibc... */
91#define unw_tdep_getcontext(uc) (getcontext (uc), 0)
92
93/* XXX fixme: */
94#define unw_tdep_is_fpreg(r) ((unsigned) ((r) - UNW_X86_FR) < 128)
95
96#include "libunwind-common.h"
97
mostang.com!davidm337c0ad2003-03-28 07:43:22 +000098#if defined(__cplusplus) || defined(c_plusplus)
99}
100#endif
101
mostang.com!davidm26f6cf72003-01-21 08:08:32 +0000102#endif /* LIBUNWIND_H */