1/* libunwind - a platform-independent unwind library
2   Copyright (C) 2008 CodeSourcery
3   Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.com>
4
5This file is part of libunwind.
6
7Permission is hereby granted, free of charge, to any person obtaining
8a copy of this software and associated documentation files (the
9"Software"), to deal in the Software without restriction, including
10without limitation the rights to use, copy, modify, merge, publish,
11distribute, sublicense, and/or sell copies of the Software, and to
12permit persons to whom the Software is furnished to do so, subject to
13the following conditions:
14
15The above copyright notice and this permission notice shall be
16included in all copies or substantial portions of the Software.
17
18THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
25
26#ifndef LIBUNWIND_H
27#define LIBUNWIND_H
28
29#if defined(__cplusplus) || defined(c_plusplus)
30extern "C" {
31#endif
32
33#include <inttypes.h>
34#include <stddef.h>
35#include <ucontext.h>
36
37#define UNW_TARGET	sh
38#define UNW_TARGET_SH	1
39
40#define _U_TDEP_QP_TRUE	0	/* see libunwind-dynamic.h  */
41
42/* This needs to be big enough to accommodate "struct cursor", while
43   leaving some slack for future expansion.  Changing this value will
44   require recompiling all users of this library.  Stack allocation is
45   relatively cheap and unwind-state copying is relatively rare, so we
46   want to err on making it rather too big than too small.  */
47
48#define UNW_TDEP_CURSOR_LEN	4096
49
50typedef uint32_t unw_word_t;
51typedef int32_t unw_sword_t;
52
53typedef long double unw_tdep_fpreg_t;
54
55typedef enum
56  {
57    UNW_SH_R0,
58    UNW_SH_R1,
59    UNW_SH_R2,
60    UNW_SH_R3,
61    UNW_SH_R4,
62    UNW_SH_R5,
63    UNW_SH_R6,
64    UNW_SH_R7,
65    UNW_SH_R8,
66    UNW_SH_R9,
67    UNW_SH_R10,
68    UNW_SH_R11,
69    UNW_SH_R12,
70    UNW_SH_R13,
71    UNW_SH_R14,
72    UNW_SH_R15,
73
74    UNW_SH_PC,
75    UNW_SH_PR,
76
77    UNW_TDEP_LAST_REG = UNW_SH_PR,
78
79    UNW_TDEP_IP = UNW_SH_PR,
80    UNW_TDEP_SP = UNW_SH_R15,
81    UNW_TDEP_EH = UNW_SH_R0
82  }
83sh_regnum_t;
84
85#define UNW_TDEP_NUM_EH_REGS	2
86
87typedef ucontext_t unw_tdep_context_t;
88
89#define unw_tdep_getcontext(uc)		(getcontext (uc), 0)
90
91typedef struct unw_tdep_save_loc
92  {
93    /* Additional target-dependent info on a save location.  */
94    /* ANDROID support update. */
95    char __reserved;
96    /* End of ANDROID update. */
97  }
98unw_tdep_save_loc_t;
99
100#include "libunwind-dynamic.h"
101
102typedef struct
103  {
104    /* no sh-specific auxiliary proc-info */
105    /* ANDROID support update. */
106    char __reserved;
107    /* End of ANDROID update. */
108  }
109unw_tdep_proc_info_t;
110
111#include "libunwind-common.h"
112
113#define unw_tdep_is_fpreg		UNW_ARCH_OBJ(is_fpreg)
114extern int unw_tdep_is_fpreg (int);
115
116#if defined(__cplusplus) || defined(c_plusplus)
117}
118#endif
119
120#endif /* LIBUNWIND_H */
121