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 ppc32
43 #define UNW_TARGET_PPC32 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_PPC32_* 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
;
80 UNW_PPC32_R1
, /* called STACK_POINTER in gcc */
90 UNW_PPC32_R11
, /* called STATIC_CHAIN in gcc */
110 UNW_PPC32_R31
, /* called HARD_FRAME_POINTER in gcc */
114 /* Fixed-Point Status and Control Register */
116 /* Condition Register */
118 /* Machine State Register */
119 //UNW_PPC32_MSR = 35,
120 /* MQ or SPR0, not part of generic Power, part of MPC601 */
124 /* Floating Pointer Status and Control Register */
125 UNW_PPC32_FPSCR
= 37,
160 UNW_TDEP_LAST_REG
= UNW_PPC32_F31
,
162 UNW_TDEP_IP
= UNW_PPC32_LR
,
163 UNW_TDEP_SP
= UNW_PPC32_R1
,
164 UNW_TDEP_EH
= UNW_PPC32_R12
169 * According to David Edelsohn, GNU gcc uses R3, R4, R5, and maybe R6 for
170 * passing parameters to exception handlers.
173 #define UNW_TDEP_NUM_EH_REGS 4
175 typedef struct unw_tdep_save_loc
177 /* Additional target-dependent info on a save location. */
181 /* On ppc, we can directly use ucontext_t as the unwind context. */
182 typedef ucontext_t unw_tdep_context_t
;
184 /* XXX this is not ideal: an application should not be prevented from
185 using the "getcontext" name just because it's using libunwind. We
186 can't just use __getcontext() either, because that isn't exported
188 #define unw_tdep_getcontext(uc) (getcontext (uc), 0)
190 #include "libunwind-dynamic.h"
194 /* no ppc32-specific auxiliary proc-info */
196 unw_tdep_proc_info_t
;
198 #include "libunwind-common.h"
200 #define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
201 extern int unw_tdep_is_fpreg (int);
203 #if defined(__cplusplus) || defined(c_plusplus)
207 #endif /* LIBUNWIND_H */