OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgcc/] [config/] [alpha/] [linux-unwind.h] - Blame information for rev 758

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 734 jeremybenn
/* DWARF2 EH unwinding support for Alpha Linux.
2
   Copyright (C) 2004, 2005, 2009, 2011 Free Software Foundation, Inc.
3
 
4
This file is part of GCC.
5
 
6
GCC is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 3, or (at your option)
9
any later version.
10
 
11
GCC is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
GNU General Public License for more details.
15
 
16
Under Section 7 of GPL version 3, you are granted additional
17
permissions described in the GCC Runtime Library Exception, version
18
3.1, as published by the Free Software Foundation.
19
 
20
You should have received a copy of the GNU General Public License and
21
a copy of the GCC Runtime Library Exception along with this program;
22
see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
23
<http://www.gnu.org/licenses/>.  */
24
 
25
/* Do code reading to identify a signal frame, and set the frame
26
   state data appropriately.  See unwind-dw2.c for the structs.  */
27
 
28
#include <signal.h>
29
#include <sys/ucontext.h>
30
 
31
#define MD_FALLBACK_FRAME_STATE_FOR alpha_fallback_frame_state
32
 
33
static _Unwind_Reason_Code
34
alpha_fallback_frame_state (struct _Unwind_Context *context,
35
                            _Unwind_FrameState *fs)
36
{
37
  unsigned int *pc = context->ra;
38
  struct sigcontext *sc;
39
  long new_cfa;
40
  int i;
41
 
42
  if (pc[0] != 0x47fe0410                /* mov $30,$16 */
43
      || pc[2] != 0x00000083)           /* callsys */
44
    return _URC_END_OF_STACK;
45
  if (context->cfa == 0)
46
    return _URC_END_OF_STACK;
47
  if (pc[1] == 0x201f0067)              /* lda $0,NR_sigreturn */
48
    sc = context->cfa;
49
  else if (pc[1] == 0x201f015f)         /* lda $0,NR_rt_sigreturn */
50
    {
51
      struct rt_sigframe {
52
        struct siginfo info;
53
        struct ucontext uc;
54
      } *rt_ = context->cfa;
55
      sc = &rt_->uc.uc_mcontext;
56
    }
57
  else
58
    return _URC_END_OF_STACK;
59
 
60
  new_cfa = sc->sc_regs[30];
61
  fs->regs.cfa_how = CFA_REG_OFFSET;
62
  fs->regs.cfa_reg = 30;
63
  fs->regs.cfa_offset = new_cfa - (long) context->cfa;
64
  for (i = 0; i < 30; ++i)
65
    {
66
      fs->regs.reg[i].how = REG_SAVED_OFFSET;
67
      fs->regs.reg[i].loc.offset
68
        = (long) &sc->sc_regs[i] - new_cfa;
69
    }
70
  for (i = 0; i < 31; ++i)
71
    {
72
      fs->regs.reg[i+32].how = REG_SAVED_OFFSET;
73
      fs->regs.reg[i+32].loc.offset
74
        = (long) &sc->sc_fpregs[i] - new_cfa;
75
    }
76
  fs->regs.reg[64].how = REG_SAVED_OFFSET;
77
  fs->regs.reg[64].loc.offset = (long)&sc->sc_pc - new_cfa;
78
  fs->retaddr_column = 64;
79
  fs->signal_frame = 1;
80
 
81
  return _URC_NO_REASON;
82
}
83
 
84
#define MD_FROB_UPDATE_CONTEXT alpha_frob_update_context
85
 
86
/* Fix up for signal handlers that don't have S flag set.  */
87
 
88
static void
89
alpha_frob_update_context (struct _Unwind_Context *context,
90
                           _Unwind_FrameState *fs ATTRIBUTE_UNUSED)
91
{
92
  unsigned int *pc = context->ra;
93
 
94
  if (pc[0] == 0x47fe0410                /* mov $30,$16 */
95
      && pc[2] == 0x00000083            /* callsys */
96
      && (pc[1] == 0x201f0067           /* lda $0,NR_sigreturn */
97
          || pc[1] == 0x201f015f))      /* lda $0,NR_rt_sigreturn */
98
    _Unwind_SetSignalFrame (context, 1);
99
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.