Home | History | Annotate | Download | only in include
      1 /* libunwind - a platform-independent unwind library
      2    Copyright (C) 2008 CodeSourcery
      3    Copyright (C) 2012 Tommi Rantala <tt.rantala (at) gmail.com>
      4 
      5 This file is part of libunwind.
      6 
      7 Permission is hereby granted, free of charge, to any person obtaining
      8 a copy of this software and associated documentation files (the
      9 "Software"), to deal in the Software without restriction, including
     10 without limitation the rights to use, copy, modify, merge, publish,
     11 distribute, sublicense, and/or sell copies of the Software, and to
     12 permit persons to whom the Software is furnished to do so, subject to
     13 the following conditions:
     14 
     15 The above copyright notice and this permission notice shall be
     16 included in all copies or substantial portions of the Software.
     17 
     18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     19 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     20 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     21 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
     22 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
     23 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
     24 WITH 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)
     30 extern "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 
     50 typedef uint32_t unw_word_t;
     51 typedef int32_t unw_sword_t;
     52 
     53 typedef long double unw_tdep_fpreg_t;
     54 
     55 typedef 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   }
     83 sh_regnum_t;
     84 
     85 #define UNW_TDEP_NUM_EH_REGS	2
     86 
     87 typedef ucontext_t unw_tdep_context_t;
     88 
     89 #define unw_tdep_getcontext(uc)		(getcontext (uc), 0)
     90 
     91 typedef 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   }
     98 unw_tdep_save_loc_t;
     99 
    100 #include "libunwind-dynamic.h"
    101 
    102 typedef struct
    103   {
    104     /* no sh-specific auxiliary proc-info */
    105     /* ANDROID support update. */
    106     char __reserved;
    107     /* End of ANDROID update. */
    108   }
    109 unw_tdep_proc_info_t;
    110 
    111 #include "libunwind-common.h"
    112 
    113 #define unw_tdep_is_fpreg		UNW_ARCH_OBJ(is_fpreg)
    114 extern int unw_tdep_is_fpreg (int);
    115 
    116 #if defined(__cplusplus) || defined(c_plusplus)
    117 }
    118 #endif
    119 
    120 #endif /* LIBUNWIND_H */
    121