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
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 <sys/types.h>
36#include <inttypes.h>
37#include <ucontext.h>
38
39#define UNW_TARGET x86_64
40#define UNW_TARGET_X86_64 1
41
42#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
43
44/* This needs to be big enough to accommodate "struct cursor", while
45 leaving some slack for future expansion. Changing this value will
46 require recompiling all users of this library. Stack allocation is
47 relatively cheap and unwind-state copying is relatively rare, so we
48 want to err on making it rather too big than too small. */
49#define UNW_TDEP_CURSOR_LEN 127
50
51typedef uint64_t unw_word_t;
52typedef int64_t unw_sword_t;
53
54typedef long double unw_tdep_fpreg_t;
55
56typedef enum
57 {
58 UNW_X86_64_RAX,
59 UNW_X86_64_RDX,
60 UNW_X86_64_RCX,
61 UNW_X86_64_RBX,
62 UNW_X86_64_RSI,
63 UNW_X86_64_RDI,
64 UNW_X86_64_RBP,
65 UNW_X86_64_RSP,
66 UNW_X86_64_R8,
67 UNW_X86_64_R9,
68 UNW_X86_64_R10,
69 UNW_X86_64_R11,
70 UNW_X86_64_R12,
71 UNW_X86_64_R13,
72 UNW_X86_64_R14,
73 UNW_X86_64_R15,
74 UNW_X86_64_RIP,
75#ifdef CONFIG_MSABI_SUPPORT
76 UNW_X86_64_XMM0,
77 UNW_X86_64_XMM1,
78 UNW_X86_64_XMM2,
79 UNW_X86_64_XMM3,
80 UNW_X86_64_XMM4,
81 UNW_X86_64_XMM5,
82 UNW_X86_64_XMM6,
83 UNW_X86_64_XMM7,
84 UNW_X86_64_XMM8,
85 UNW_X86_64_XMM9,
86 UNW_X86_64_XMM10,
87 UNW_X86_64_XMM11,
88 UNW_X86_64_XMM12,
89 UNW_X86_64_XMM13,
90 UNW_X86_64_XMM14,
91 UNW_X86_64_XMM15,
92 UNW_TDEP_LAST_REG = UNW_X86_64_XMM15,
93#else
94 UNW_TDEP_LAST_REG = UNW_X86_64_RIP,
95#endif
96
97 /* XXX Add other regs here */
98
99 /* frame info (read-only) */
100 UNW_X86_64_CFA,
101
102 UNW_TDEP_IP = UNW_X86_64_RIP,
103 UNW_TDEP_SP = UNW_X86_64_RSP,
104 UNW_TDEP_BP = UNW_X86_64_RBP,
105 UNW_TDEP_EH = UNW_X86_64_RAX
106 }
107x86_64_regnum_t;
108
109#define UNW_TDEP_NUM_EH_REGS 2 /* XXX Not sure what this means */
110
111typedef struct unw_tdep_save_loc
112 {
113 /* Additional target-dependent info on a save location. */
114 char unused;
115 }
116unw_tdep_save_loc_t;
117
118/* On x86_64, we can directly use ucontext_t as the unwind context. */
119typedef ucontext_t unw_tdep_context_t;
120
121typedef struct
122 {
123 /* no x86-64-specific auxiliary proc-info */
124 char unused;
125 }
126unw_tdep_proc_info_t;
127
128#include "libunwind-dynamic.h"
129#include "libunwind-common.h"
130
131#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext)
132#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
133
134extern int unw_tdep_getcontext (unw_tdep_context_t *);
135extern int unw_tdep_is_fpreg (int);
136
137#if defined(__cplusplus) || defined(c_plusplus)
138}
139#endif
140
141#endif /* LIBUNWIND_H */
142

source code of include/x86_64-linux-gnu/libunwind-x86_64.h