1 /* libunwind - a platform-independent unwind library
2 Copyright (C) 2006-2007 IBM
4 Corey Ashford <cjashfor@us.ibm.com>
5 Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> <joseflavio@gmail.com>
7 Copied from libunwind-x86_64.h, modified slightly for building
8 frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
9 Will be replaced when libunwind is ready on ppc64 platform.
11 This file is part of libunwind.
13 Permission is hereby granted, free of charge, to any person obtaining
14 a copy of this software and associated documentation files (the
15 "Software"), to deal in the Software without restriction, including
16 without limitation the rights to use, copy, modify, merge, publish,
17 distribute, sublicense, and/or sell copies of the Software, and to
18 permit persons to whom the Software is furnished to do so, subject to
19 the following conditions:
21 The above copyright notice and this permission notice shall be
22 included in all copies or substantial portions of the Software.
24 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
35 #if defined(__cplusplus) || defined(c_plusplus)
42 #define UNW_TARGET ppc64
43 #define UNW_TARGET_PPC64 1
45 #define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
48 * This needs to be big enough to accommodate "struct cursor", while
49 * leaving some slack for future expansion. Changing this value will
50 * require recompiling all users of this library. Stack allocation is
51 * relatively cheap and unwind-state copying is relatively rare, so we want
52 * to err on making it rather too big than too small.
54 * To simplify this whole process, we are at least initially taking the
55 * tack that UNW_PPC64_* map straight across to the .eh_frame column register
56 * numbers. These register numbers come from gcc's source in
57 * gcc/config/rs6000/rs6000.h
59 * UNW_TDEP_CURSOR_LEN is in terms of unw_word_t size. Since we have 115
60 * elements in the loc array, each sized 2 * unw_word_t, plus the rest of
61 * the cursor struct, this puts us at about 2 * 115 + 40 = 270. Let's
62 * round that up to 280.
65 #define UNW_TDEP_CURSOR_LEN 280
68 typedef uint32_t unw_word_t
;
69 typedef int32_t unw_sword_t
;
71 typedef uint64_t unw_word_t
;
72 typedef int64_t unw_sword_t
;
75 typedef long double unw_tdep_fpreg_t
;
78 * Vector register (in PowerPC64 used for AltiVec registers)
87 UNW_PPC64_R1
, /* called STACK_POINTER in gcc */
97 UNW_PPC64_R11
, /* called STATIC_CHAIN in gcc */
117 UNW_PPC64_R31
, /* called HARD_FRAME_POINTER in gcc */
151 /* Note that there doesn't appear to be an .eh_frame register column
152 for the FPSCR register. I don't know why this is. Since .eh_frame
153 info is what this implementation uses for unwinding, we have no way
154 to unwind this register, and so we will not expose an FPSCR register
155 number in the libunwind API.
160 UNW_PPC64_ARG_POINTER
= 67,
167 /* CR5 .. CR7 are currently unused */
207 UNW_PPC64_VRSAVE
= 109,
208 UNW_PPC64_VSCR
= 110,
209 UNW_PPC64_SPE_ACC
= 111,
210 UNW_PPC64_SPEFSCR
= 112,
212 /* frame info (read-only) */
213 UNW_PPC64_FRAME_POINTER
,
217 UNW_TDEP_LAST_REG
= UNW_PPC64_NIP
,
219 UNW_TDEP_IP
= UNW_PPC64_NIP
,
220 UNW_TDEP_SP
= UNW_PPC64_R1
,
221 UNW_TDEP_EH
= UNW_PPC64_R12
233 * According to David Edelsohn, GNU gcc uses R3, R4, R5, and maybe R6 for
234 * passing parameters to exception handlers.
237 #define UNW_TDEP_NUM_EH_REGS 4
239 typedef struct unw_tdep_save_loc
241 /* Additional target-dependent info on a save location. */
245 /* On ppc64, we can directly use ucontext_t as the unwind context. */
246 typedef ucontext_t unw_tdep_context_t
;
248 /* XXX this is not ideal: an application should not be prevented from
249 using the "getcontext" name just because it's using libunwind. We
250 can't just use __getcontext() either, because that isn't exported
252 #define unw_tdep_getcontext(uc) (getcontext (uc), 0)
254 #include "libunwind-dynamic.h"
258 /* no ppc64-specific auxiliary proc-info */
260 unw_tdep_proc_info_t
;
262 #include "libunwind-common.h"
264 #define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
265 extern int unw_tdep_is_fpreg (int);
267 #if defined(__cplusplus) || defined(c_plusplus)
271 #endif /* LIBUNWIND_H */