blob: a87b57ec0cb3f233a343ab0f7397961b06abfdd9 [file] [log] [blame]
ibm.com!masbocka766efd2004-08-19 13:39:10 +00001/* 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
7This file is part of libunwind.
8
9Permission is hereby granted, free of charge, to any person obtaining
10a copy of this software and associated documentation files (the
11"Software"), to deal in the Software without restriction, including
12without limitation the rights to use, copy, modify, merge, publish,
13distribute, sublicense, and/or sell copies of the Software, and to
14permit persons to whom the Software is furnished to do so, subject to
15the following conditions:
16
17The above copyright notice and this permission notice shall be
18included in all copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26WITH 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)
32extern "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
50typedef uint64_t unw_word_t;
Arun Sharma11ea1272006-07-26 22:12:10 -060051typedef int64_t unw_sword_t;
ibm.com!masbocka766efd2004-08-19 13:39:10 +000052
53typedef long double unw_tdep_fpreg_t;
54
55typedef 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 }
87x86_64_regnum_t;
88
89#define UNW_TDEP_NUM_EH_REGS 2 /* XXX Not sure what this means */
90
91typedef struct unw_tdep_save_loc
92 {
93 /* Additional target-dependent info on a save location. */
94 }
95unw_tdep_save_loc_t;
96
97/* On x86_64, we can directly use ucontext_t as the unwind context. */
98typedef 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
108typedef struct
109 {
mostang.com!davidm27f7d7d2005-05-03 09:13:17 +0000110 /* no x86-64-specific auxiliary proc-info */
ibm.com!masbocka766efd2004-08-19 13:39:10 +0000111 }
112unw_tdep_proc_info_t;
113
114#include "libunwind-common.h"
115
116#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
117extern int unw_tdep_is_fpreg (int);
118
119#if defined(__cplusplus) || defined(c_plusplus)
120}
121#endif
122
123#endif /* LIBUNWIND_H */