• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 s390x by Michael Munday <mike.munday@ibm.com>
6 
7 This file is part of libunwind.
8 
9 Permission is hereby granted, free of charge, to any person obtaining
10 a copy of this software and associated documentation files (the
11 "Software"), to deal in the Software without restriction, including
12 without limitation the rights to use, copy, modify, merge, publish,
13 distribute, sublicense, and/or sell copies of the Software, and to
14 permit persons to whom the Software is furnished to do so, subject to
15 the following conditions:
16 
17 The above copyright notice and this permission notice shall be
18 included in all copies or substantial portions of the Software.
19 
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 WITH 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)
32 extern "C" {
33 #endif
34 
35 #include <sys/types.h>
36 #include <inttypes.h>
37 #include <ucontext.h>
38 
39 #define UNW_TARGET              s390x
40 #define UNW_TARGET_S390X        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     384
50 
51 typedef uint64_t unw_word_t;
52 typedef int64_t unw_sword_t;
53 
54 typedef double unw_tdep_fpreg_t;
55 
56 typedef enum
57   {
58     /* general purpose registers */
59     UNW_S390X_R0,
60     UNW_S390X_R1,
61     UNW_S390X_R2,
62     UNW_S390X_R3,
63     UNW_S390X_R4,
64     UNW_S390X_R5,
65     UNW_S390X_R6,
66     UNW_S390X_R7,
67     UNW_S390X_R8,
68     UNW_S390X_R9,
69     UNW_S390X_R10,
70     UNW_S390X_R11,
71     UNW_S390X_R12,
72     UNW_S390X_R13,
73     UNW_S390X_R14,
74     UNW_S390X_R15,
75 
76     /* floating point registers */
77     UNW_S390X_F0,
78     UNW_S390X_F1,
79     UNW_S390X_F2,
80     UNW_S390X_F3,
81     UNW_S390X_F4,
82     UNW_S390X_F5,
83     UNW_S390X_F6,
84     UNW_S390X_F7,
85     UNW_S390X_F8,
86     UNW_S390X_F9,
87     UNW_S390X_F10,
88     UNW_S390X_F11,
89     UNW_S390X_F12,
90     UNW_S390X_F13,
91     UNW_S390X_F14,
92     UNW_S390X_F15,
93 
94     /* PSW */
95     UNW_S390X_IP,
96 
97     UNW_TDEP_LAST_REG = UNW_S390X_IP,
98 
99     /* TODO: access, vector registers */
100 
101     /* frame info (read-only) */
102     UNW_S390X_CFA,
103 
104     UNW_TDEP_IP = UNW_S390X_IP,
105     UNW_TDEP_SP = UNW_S390X_R15,
106 
107     /* TODO: placeholders */
108     UNW_TDEP_EH = UNW_S390X_R0,
109   }
110 s390x_regnum_t;
111 
112 #define UNW_TDEP_NUM_EH_REGS    2       /* XXX Not sure what this means */
113 
114 typedef struct unw_tdep_save_loc
115   {
116     /* Additional target-dependent info on a save location.  */
117     char unused;
118   }
119 unw_tdep_save_loc_t;
120 
121 /* On s390x, we can directly use ucontext_t as the unwind context.  */
122 typedef ucontext_t unw_tdep_context_t;
123 
124 typedef struct
125   {
126     /* no s390x-specific auxiliary proc-info */
127     char unused;
128   }
129 unw_tdep_proc_info_t;
130 
131 #include "libunwind-dynamic.h"
132 #include "libunwind-common.h"
133 
134 #define unw_tdep_getcontext             UNW_ARCH_OBJ(getcontext)
135 #define unw_tdep_is_fpreg               UNW_ARCH_OBJ(is_fpreg)
136 
137 extern int unw_tdep_getcontext (unw_tdep_context_t *);
138 extern int unw_tdep_is_fpreg (int);
139 
140 #if defined(__cplusplus) || defined(c_plusplus)
141 }
142 #endif
143 
144 #endif /* LIBUNWIND_H */
145