summaryrefslogtreecommitdiff
path: root/libgcc/config/c6x/unwind-c6x.h
blob: 258a035b831a880a5c1e5b9d8d26d4d86205fd8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* Header file for the C6X EABI unwinder
   Copyright (C) 2011-2014 Free Software Foundation, Inc.

   This file is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
   Free Software Foundation; either version 3, or (at your option) any
   later version.

   This file is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details.

   Under Section 7 of GPL version 3, you are granted additional
   permissions described in the GCC Runtime Library Exception, version
   3.1, as published by the Free Software Foundation.

   You should have received a copy of the GNU General Public License and
   a copy of the GCC Runtime Library Exception along with this program;
   see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
   <http://www.gnu.org/licenses/>.  */

/* Language-independent unwinder header public defines.  This contains both
   ABI defined objects, and GNU support routines.  */

#ifndef UNWIND_C6X_H
#define UNWIND_C6X_H

/* Not really the ARM EABI, but pretty close.  */
#include "unwind-arm-common.h"

#define UNWIND_STACK_REG 31
/* Use A0 as a scratch register within the personality routine.  */
#define UNWIND_POINTER_REG 0

#ifdef __cplusplus
extern "C" {
#endif
  _Unwind_Reason_Code __gnu_unwind_24bit (_Unwind_Context *, _uw, int);

  /* Decode an EH table reference to a typeinfo object.  */
  static inline _Unwind_Word
  _Unwind_decode_typeinfo_ptr (_Unwind_Ptr base, _Unwind_Word ptr)
    {
      _Unwind_Word tmp;

      tmp = *(_Unwind_Word *) ptr;
      /* Zero values are always NULL.  */
      if (!tmp)
	return 0;

      /* SB-relative indirect.  Propagate the bottom 2 bits, which can
	 contain referenceness information in gnu unwinding tables.  */
      tmp += base;
      tmp = *(_Unwind_Word *) (tmp & ~(_Unwind_Word)3) | (tmp & 3);
      return tmp;
    }

#define _Unwind_GetIP(context) \
  (_Unwind_GetGR (context, 33))


#define _Unwind_SetIP(context, val) \
  _Unwind_SetGR (context, 33, val)

#ifdef __cplusplus
}   /* extern "C" */
#endif

#endif /* defined UNWIND_ARM_H */